given a database named db:
SELECT pg_terminate_backend(pid)
FROM pg_stat_activity
WHERE datname='db'
AND state = 'idle in transaction'
given a database named db:
SELECT pg_terminate_backend(pid)
FROM pg_stat_activity
WHERE datname='db'
AND state = 'idle in transaction'
This tutorial will explain how to make WhatsApp desktop application portable on Windows platform. Maybe this can work for other platforms as well.
For this to work NodeJs and asar package are required.
Firstly download latest version of WhatsApp. The following link contains all Windows (x64) releases:
from __future__ import print_function, unicode_literals | |
from setuptools import setup, find_packages | |
$Import | |
__author__ = "$USER" | |
with open("requirements.txt", 'r') as file: | |
requirements = file.readlines() | |
SELECT pg_terminate_backend(pid)
FROM pg_stat_activity
WHERE pid <> pg_backend_pid()
AND state = 'idle'
AND state_change < current_timestamp - INTERVAL '5' MINUTE;
#!/usr/bin/env python | |
import sys | |
import getopt | |
import re, quopri, codecs | |
import vobject | |
def parse_vcf(f): | |
""" | |
Parses a vcf string, potentially containing many vcards | |
@returns: A list of Contacts |
########## | |
# Tweaked Win10 Initial Setup Script | |
# Primary Author: Disassembler <disassembler@dasm.cz> | |
# Modified by: alirobe <alirobe@alirobe.com> based on my personal preferences. | |
# Version: 2.12.1, 2018-03-15 | |
# Primary Author Source: https://github.com/Disassembler0/Win10-Initial-Setup-Script | |
# Tweaked Source: https://gist.github.com/alirobe/7f3b34ad89a159e6daa1/ | |
# Tweak difference: | |
# | |
# @alirobe's version is a subset focused on safely disabling telemetry, some 'smart' features and 3rd party bloat ... |
def make_dicts_from_result_proxy(proxy):
res = proxy.fetchall()
if res:
keys = res[0].keys()
res = [dict(zip(keys, i.values())) for i in res]
return res
make_dicts_from_result_proxy(engine.execute("SELECT * FROM example"))
def cast_for_in_statement(iterable):
iterable = ["'{}'".format(n) for n in iterable]
return "({})".format(", ".join(iterable))
Following example class shows how to use boto3 to upload files to s3 using a programmable configuration
from uuid import uuid1
import boto3
from botocore.client import Config
from boto3.session import Session
class S3Storage(object):
# Author: Pieter Noordhuis | |
# Description: Simple demo to showcase Redis PubSub with EventMachine | |
# | |
# Update 7 Oct 2010: | |
# - This example does *not* appear to work with Chrome >=6.0. Apparently, | |
# the WebSocket protocol implementation in the cramp gem does not work | |
# well with Chrome's (newer) WebSocket implementation. | |
# | |
# Requirements: | |
# - rubygems: eventmachine, thin, cramp, sinatra, yajl-ruby |