Skip to content

Instantly share code, notes, and snippets.

View woozyking's full-sized avatar

Runzhou Li (Leo) woozyking

View GitHub Profile
@woozyking
woozyking / push_to_deploy.sh
Last active March 22, 2018 18:53
Git push to deploy leveraging Linux user:group as a "container/sandbox"
#!/usr/bin/env bash
#######################################################
# Git Based Push to Deploy Env Setup
# To Use:
# ./push_to_deploy.sh <name of user> [optional crontab]
#######################################################
set -e
@woozyking
woozyking / cache_mongo_ids.py
Last active December 23, 2019 22:38
Cache MongoDB Document IDs in Redis SET with Python
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from pymongo import MongoClient
from bson import ObjectId
import redis
def cache_ids(db, cache, cache_key, reset=True, limit=1000):
if reset:
@woozyking
woozyking / master.sh
Last active January 2, 2016 14:49
CentOS Disco Deplyment
#!/bin/bash
DISCO_USER=disco
# Update and clean cache
yum clean all -y
# Add EPEL repo
# http://wiki.centos.org/AdditionalResources/Repositories
# http://fedoraproject.org/wiki/EPEL
@woozyking
woozyking / setup.sh
Created October 22, 2013 05:14
Ubuntu Docker Dev Env
#!/bin/bash
# First step we update and upgrade
sudo apt-get update && sudo apt-get upgrade -y
# Second step install git as it's almost always needed nowadays
sudo apt-get install git -y
(cd /tmp && git clone --depth 1 https://github.com/visionmedia/git-extras.git && cd git-extras && sudo make install)
# For Docker
@woozyking
woozyking / v1.py
Last active December 19, 2015 06:58
Tame PycURL
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import pycurl
def iter_chunks(data, delimiter):
chunks = data.split(delimiter)
for chunk in chunks: