Skip to content

Instantly share code, notes, and snippets.

@dm7
dm7 / centos_python_dev_env_setup
Created May 16, 2018 06:19 — forked from ygorth/centos_python_dev_env_setup
CentOS 7: Install Python 3.6.1, pip, virtualenv, and virtualenvwrapper
#!/bin/bash
#####################################################################
## IMPORTANT ##
# Run this script with root (sudo su -), wont work if run as sudo.
# Change the variables as needed.
######################################################################
USER=youruser # User that will have ownership (chown) to /usr/local/bin and /usr/local/lib
USERHOME=/home/${USER} # The path to the users home, in this case /home/youruser
PYSHORT=3.6 # The Python short version, e.g. easy_install-${PYSHORT} = easy_install-3.6
PYTHONVER=3.6.1 # The actual version of python that you want to download from python.org
@dm7
dm7 / postgres-cheatsheet.md
Created March 24, 2018 07:40 — forked from baditaflorin/postgres-cheatsheet.md
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

If run with -E flag, it will describe the underlaying queries of the \ commands (cool for learning!).

Most \d commands support additional param of __schema__.name__ and accept wildcards like *.*

@dm7
dm7 / postgres-cheatsheet.md
Created March 24, 2018 07:40 — forked from baditaflorin/postgres-cheatsheet.md
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

If run with -E flag, it will describe the underlaying queries of the \ commands (cool for learning!).

Most \d commands support additional param of __schema__.name__ and accept wildcards like *.*

@dm7
dm7 / ec2-running-time.py
Created March 22, 2018 17:36 — forked from sudharsans/ec2-running-time.py
Python Boto3 script to find the number of minutes an instance has been running.
import boto3
from datetime import datetime, timezone
from functools import reduce
import operator
ec2 = boto3.client('ec2')
cloudtrail = boto3.client('cloudtrail')
def get_events(instanceid):
response = cloudtrail.lookup_events (
@dm7
dm7 / supervisord.service
Created March 21, 2018 12:03 — forked from mozillazg/supervisord.service
install and configure supervisord on centos 7.
[Unit]
Description=supervisord - Supervisor process control system for UNIX
Documentation=http://supervisord.org
After=network.target
[Service]
Type=forking
ExecStart=/bin/supervisord -c /etc/supervisord/supervisord.conf
ExecReload=/bin/supervisorctl reload
ExecStop=/bin/supervisorctl shutdown
@dm7
dm7 / README.md
Created March 21, 2018 11:45 — forked from hofmannsven/README.md
My simply Git Cheatsheet
@dm7
dm7 / server.conf
Created March 17, 2018 06:44 — forked from iliakan/server.conf
Nginx configuration for separated frontend and backend endpoints
upstream example-webpack {
server 127.0.0.1:8080;
}
upstream example-backend {
server 127.0.0.1:3000;
}
server {
listen 80;
@dm7
dm7 / introrx.md
Created February 12, 2018 10:48 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
@dm7
dm7 / jwt_token_decorator.py
Created December 28, 2017 11:42 — forked from h3ar7dump/jwt_token_decorator.py
jwt_token_decorator for tornado use
"""
>>>pip install PyJWT
>>>import jwt
"""
import jwt
from jwt import exceptions
def jwt_token_decorator(func):
"""jwt_token简单验证装饰器
:param func: