Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# http://docs.python-requests.org/en/master/api/ | |
import requests | |
class RequestsApi: | |
def __init__(self, base_url, **kwargs): | |
self.base_url = base_url | |
self.session = requests.Session() | |
for arg in kwargs: | |
if isinstance(kwargs[arg], dict): | |
kwargs[arg] = self.__deep_merge(getattr(self.session, arg), kwargs[arg]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Run Docker as non-root user (without sudo)in ubuntu/linux | |
To fix the Docker permission denied error and use Docker as non-root user, | |
(like Got permission denied while trying to connect to the Docker daemon socket at...connect: permission denied) | |
create a group called “docker” with the following command: | |
$ sudo groupadd docker | |
Next, add your user to the docker group: | |
$ sudo usermod -aG docker $USER |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#################### | |
# Define Decorator # | |
#################### | |
def psycopg2_cursor(conn_info): | |
"""Wrap function to setup and tear down a Postgres connection while | |
providing a cursor object to make queries with. | |
""" | |
def wrap(f): | |
@wraps(f) | |
def wrapper(*args, **kwargs): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- show running queries (pre 9.2) | |
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query | |
FROM pg_stat_activity | |
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%' | |
ORDER BY query_start desc; | |
-- show running queries (9.2) | |
SELECT pid, age(clock_timestamp(), query_start), usename, query | |
FROM pg_stat_activity | |
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set nocompatible " be iMproved, required | |
filetype off " required | |
" set the runtime path to include Vundle and initialize | |
set rtp+=~/.vim/bundle/Vundle.vim | |
call vundle#begin() | |
" alternatively, pass a path where Vundle should install plugins | |
"call vundle#begin('~/some/path/here') | |
" let Vundle manage Vundle, required |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-----BEGIN PGP PUBLIC KEY BLOCK----- | |
mQINBF6d9xMBEADL3gKxSON9LoGccw5Fxlny7Aj+tlD2AMp2ZzaUSUXX3kqGHPR/ | |
HVlIgh4+qHzJOra42P/Vakrg3GmLKxwFG42/IJwbIVIVFLKfb9wI5Gi8QjN5nW5M | |
FKraFtwsJnr9KVk1mrEBkh4IUYsftJq9b+LN41260OJUbCYTuMLqVE6I4qGzNzZm | |
Po5ge1tfo49MQv89ltNrY1iAM/cE9gZvBPUqcDPjS3em1ZudmzprX1ThmFq7Xt2P | |
AKhWywlCH7hH35lwTurjGMOAvJZm43gWIkEwxoWyydGxnn/yN39vsp4XgrFXkPp3 | |
UPeBXdK0/rtkBATFADOVVHTOKRn8nyX64jTBrw7/HIvdAckezAl6FiT7Q/xTZdvf | |
ybDxSqH/RRXxLW6XbROvTkOvQwKT6iSNomM/JNzcXd6xyzn1WDk5KKnfLmOKMkVU | |
M1VHxiJsIi6+7GhR3+Nf6y6oMYiUhCVUAllRCHuYl3OuO9/wSyz6X1qY8LXBvX07 |