How do I make my async coroutine function not block?

I’m trying to write some concurrent Python.

In my app below, I’m trying to subscribe to a websocket feed, but then continue through the app, so this code should just print hello. Instead, it blocks on feed.__init__.

I’m hoping I can build a websocket client to some update some application state.

How do I do feed.__init__ and continue running my program, while the websocket runs in the background?

def main():
  myFeed = feed('XBTUSD')
  while True:

import websockets
import asyncio
import json

class feed:
    def __init__(self, symbol):
        self.symbol = symbol
        self.uri = "wss://,quote:{}".format(symbol)
        # asyncio.get_event_loop().run_forever()

    async def socket(self):
      async with websockets.connect(self.uri) as websocket:
        while True: 
          msg = await websocket.recv()

    def process_msg(self, msg):
        data = msg['data'][0]
        if data['symbol'] == self.symbol:
            self.last_message = msg 


Go to Source
Author: cjm2671

Is there a way to add an event from the top panel calendar without opening up the calendar app?

I just want a little “+” button on the top bar calendar so I can add events without having to go into the full calendar.

I think it would be very quick and useful for most people instead of a read-only solution in the top panel.

Does a solution exist for this? How do I go about implementing such a solution if it does not?

Go to Source
Author: plants

gnuplot: Can you set shell variables in a script and then later call them?

I want to be able to issue shell commands from a gnuplot script, such as setting a variable, but it appears that the system command spawns a new shell instance as opposed to issuing commands to the shell instance which is running the gnuplot script. See the following script where the first line allows assignment of $foo, but the second line cannot access that variable. In this case, $foo is assigned as an arbitrary string as opposed to a reference to the directory, hence the "

#!/usr/bin/gnuplot -p
system "export foo="$HOME/path/to/dir";echo $foo"
system "echo $foo"
set datafile separator "t"
#plot "`echo $foo`/bar.dat" using 2:3
plot "<( sed '5p' $foo/bar.dat )" using 2:3

Go to Source
Author: T. Zack Crawford

How to use Apache resource by HTTPS in pacemaker?

I have a problem when i change apache url to HTTPS. Before the change every this working fine with http. Now my company need to use the Virtal ip by HTTPS. so that i didn’t find any suitable tutorial about this issue.

i am working on debian 9. more details are below:


 <Location /server-status>
 SetHandler server-status
 Order Deny,Allow
 Deny from all
 Require local


<VirtualHost *:80>
DocumentRoot /var/www/html
Redirect "/" "https://ip_address/"

Error i received

Failed Actions:
* Apache_monitor_0 on server1 'unknown error' (1): call=59, status=complete, exitreason='none',
    last-rc-change='Wed Sep  9 17:28:19 2020', queued=0ms, exec=71ms
* pgsqld_promote_0 on server2 'unknown error' (1): call=63, status=complete, exitreason='server1 is the best candidate to promote, aborting current promotion',
    last-rc-change='Wed Sep  9 16:57:25 2020', queued=0ms, exec=496ms

pcs status

I tried to add resource like this but it didn’t work

pcs resource create Apache ocf:heartbeat:apache  configfile=/etc/apache2/apache2.conf  statusurl="https://localhost/server-status"  op monitor interval=1min --force

pcs resource create Apache ocf:heartbeat:apache  configfile=/etc/apache2/apache2.conf  statusurl="http://localhost/server-status"  op monitor interval=1min --force

Go to Source
Author: Karippery

Bulk VMware vCenter updates vs. GitOps

What is state of the art for managing* multiple VMware vCenter hosts in terms of GitOps?

What I read in the online documentation, it feels like less GitOps but maybe I have missed something.

Managing vCenter hosts can include:

  • update licenses (automation works for provisioning but not update?)
  • install updates “download ZIP files..” (browser login..)

Go to Source
Author: Peter Muryshkin

How to prevent WordPress from redirecting single page to prefixed category archive with same name?

I have been trying to solve this problem for hours. I would like to have a page with a simple slug (/blog) and a category term with the same name (/category/blog) exist on my site together at the same time. But the problem I am running into is that my page (/blog) keeps redirecting to the category archive page (/category/blog).

I have tried the following:

  • adjusting my permalinks by clearly specifying my category base
  • using remove_action(‘template_redirect’, ‘redirect_canonical’); to suppress redirects
  • using add_filter( ‘template_redirect’, ‘blog_redirect_filter’, 10, 3 ); to try and target my blog category specifically

I am running out of ideas. How can I stop my site from redirecting an existing page to a category archive when they each have different slugs?


I figured it out! Classic wait-until-you-post-publicly-before-figuring-it-out-yourself problem. It was a fun mix of Yoast, custom permalinks, and category bases all conflicting with each other.

My answer:

  • Make sure your category base is specified in Permalinks. Save them.
  • Remove any custom permalink slugs in the category terms.
  • Go to Yoast > Search Appearance > Taxonomies and scroll to the very bottom. Make sure Category URLs is set to Keep.
  • Clear any cache and/or flush_rewrite_rules.
  • Voila it’s fixed.

Go to Source
Author: Beth Mac

db2cli license file not being used

I’m using the db2 driver for CLI and ODBC to configure an ODBC connection to DB2 on IBM i/OS from CentOS. I’m trying the following command:

db2cli execsql -connstring "protocol=TCPIP;database=MyDB;hostname=MyHost;ServiceName=446;uid=MyUser;pwd=MyPass"

And getting the following error which seems pretty straightforward:

[IBM][CLI Driver] SQL1598N  An attempt to connect to the database server failed because of a licensing problem.  SQLSTATE=42968

I believe I have the paths and everything correct:

# Environment
export PATH=$PATH:/opt/DB2/odbc_cli/clidriver/bin/
export DB2_CLI_DRIVER_INSTALL_PATH=/opt/DB2/odbc_cli/clidriver
export LD_LIBRARY_PATH=/opt/DB2/odbc_cli/clidriver/lib

license file: /opt/DB2/odbc_cli/clidriver/license/db2consv_is.lic

I have also attempted to move the license to a few other paths without any success. It is valid and works on another (windows) installation without issues. Any idea what I can troubleshoot from here?

Go to Source
Author: user19702

Is it possible to add a Slack call to a Google Calendar event?

When I invite a co-worker to meet with me, I often want to meet via a Slack call. It is easy to add a link to the calendar invite for a Zoom call, a Hangouts call, or even a Jitsi call (we use Google Calendar and there are integrations for all three). I am wondering if there is some way to achieve the same convenient “hop on the call in one click” when using Slack.

Go to Source
Author: lucas

Choosing between DI (without container) and Composition

I’m working on a classes that are designed to read a defined file format; said format is comprised of 2 separate files (FileA and FileB). For ease of use, the format is referred to as the FileA format, but a valid “file” must have a FileB. The files share the same path prefix, but alter in suffix; therefore my current classes appears as:

class FileReaderA:
    def __init__(self, path: pathlib.Path):
            self.a = path.with_suffix('.fa')
            self.b = FileReaderB(path)
    # methods related to operating on FileA types

class FileReaderB:
    def __init__(self, path: pathlib.Path):
            self.b = path.with_suffix('.fa')
    # methods related to operating on FileB types 

The classes are separated since FileReaderB does not depend on FileReaderA and can be used independently to read FileB types, however a valid FileA requires its associated FileB. Therefore, composition made sense, at first. Now I’m wondering if DI is the more appropriate solution, but it requires that FileReaderB be explicitly instantiated and passed to the constructor of FileReaderA, which is less than ideal form a user standpoint with this API:

>>> frb = FileReaderB(path)
>>> fra = FileReaderA(path, frb)

Thus I am forced to abstract it by using a factory:

def reader(path: pathlib.Path):
    return FileReaderA(path, FileReaderB(path))

>>> fra = reader(path)

This seems verbose and I feel as though I’m introducing more code and layers of abstraction to achieve the same result, all around the guise for better unit testing of decoupled classes.

What is wrong with just using Composition over enforcing DI?

Go to Source
Author: pasta_sauce

Angular.js, node.js: require or import ? neither work for me :(

I am very new to Angular.js and node.js and I am facing a problem since this morning that has been partially solved. How to update a json file with data entered by a user via a form.

Thanks to some help that I got here, I managed to do that using lowdbwhich looks like an awesome dependency. The thing is, I can only make it work from a test file, like so:

1/ test.js (that I run node test.js)

const FileSync = require('lowdb/adapters/FileSync')

const dbFileName = "database/lexicon.json";
const adapter = new FileSync(dbFileName)
const db = low(adapter)

// Add another entry
    "title": "Here's a new entry",
    "topics": ["ajax", "rails"],
    "content": "This is very complicated",
    "link": "",
    "mainCategory": "Node.js"

2/ Controller from where I would like it to work:

function EntryController ($http) {
    const ctrl = this;
    const API = '../database/lexicon.json';

    this.entry = {
    title: "",
    topics: [],
    content: "",
    link: "",
    mainCategory: ""
    this.submitEntry = function () {
        const low = require('lowdb')
        const FileSync = require('lowdb/adapters/FileSync')
        const dbFileName = "database/lexicon.json";
        const adapter = new FileSync(dbFileName)
        const db = low(adapter)
        // Add another entry
            "title": "Number 1",
            "topics": ["ajax", "rails"],
            "content": "This is very complicated",
            "link": "",
            "mainCategory": "Node.js"

    .controller('EntryController', EntryController);

But when running the app and submitting the form I get this error message require is not defined

I tried something similar with import but I get a similar error message: Cannot use import statement outside a module

Can anybody help?

Go to Source
Author: Olivier Girardot

What commands will allow me to programatically enquirer how of a gnome terminal: how many tabs it has, and what are their pwd’s

When I have a gnome terminal open, is there a command that will allow me to programatically enquirer of this gnome terminal:

(1) How many tabs the gnome terminal has open on it?

(2) What is the pwd of each of these tabs?

I loose my virtual machine in the evening, so I want to write a script to store the above information, and then programatically reopen all the gnome terminals the next day, upon log in.

Go to Source
Author: Rory Cornish

How do I dump raw data from a TCP port in Windows using the netsh command?

I have an apparently simple issue which is proving very difficult to find an answer for.

The site has a highly-secured Windows Server 2019 installation and an appliance connected to it running on a certain TCP port.

I need a sample of the raw data coming out of that port, taken for a few minutes, dumped into a binary file. It needs to be as raw as possible (i.e. it needs to resemble what we would read from the TCP stream when we would connect to that same port from a local .NET application).

It is highly preferable to use only built-in Windows tools for this (i.e. netsh), but worst-case windump or telnet are also fine.

Go to Source
Author: Ruslan

Is adding encryption before hashing more secure?

One way to secure a password in the database is to hash it with salt i.e. appending a random string to the password and then hash it and store the value.

Does encrypting the password || salt then hashing it make it more secure? Is it really necessary (or can I skip the encryption part)?

Go to Source
Author: xcoder