Skip to content

Instantly share code, notes, and snippets.

@ianchen06
ianchen06 / gist:f20cac909c10fd6fc90814cc4f774c05
Created August 9, 2016 09:24 — forked from evildmp/gist:3094281
Set up Django, nginx and uwsgi

This document has now been incorporated into the uWSGI documentation:

http://uwsgi-docs.readthedocs.org/en/latest/tutorials/Django_and_nginx.html

Set up Django, nginx and uwsgi

Steps with explanations to set up a server using:

@ianchen06
ianchen06 / fix.sh
Created November 1, 2016 04:18
Mac OS X El Capitan 10.11 libsystem_symptoms.dylib missing with XCode8
#!/bin/sh
sudo /usr/bin/sed -i.backup -E -e 's@/usr/lib/system/libsystem_symptoms.dylib(, )?@@' \
$(grep -ril /usr/lib/system/libsystem_symptoms.dylib \
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/lib)
@ianchen06
ianchen06 / README-Template.md
Created November 29, 2016 07:26 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@ianchen06
ianchen06 / interfaces
Created December 9, 2016 08:27
interfaces file in /etc/network for bridged network setup
# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback
#auto br0
#iface br0 inet dhcp
# bridge_ports eth1
# bridge_stp on
# bridge_fd 0
auto br0
iface br0 inet dhcp
@ianchen06
ianchen06 / init.lua
Created February 4, 2017 14:50
init.lua file for hammerspoon
send_escape = false
last_mods = {}
control_key_handler = function()
send_escape = false
end
control_key_timer = hs.timer.delayed.new(0.15, control_key_handler)
control_handler = function(evt)
@ianchen06
ianchen06 / fix_rethinkdb_slow_start_sierra.md
Created February 9, 2017 05:07
Fix RethinkDB slow startup in macOS sierra 10.12

It is due to the default missing hostname setting in macOS sierra 10.12

It is observed when installed clean..

sudo hostname [new name]
sudo scutil --set ComputerName [new name]
sudo scutil --set LocalHostName [new name]
sudo scutil --set HostName [new name]
dscacheutil -flushcache
@ianchen06
ianchen06 / ssh_tunnel.md
Created March 7, 2017 04:08
Cool ssh tunnel tricks, keep alive in background
@ianchen06
ianchen06 / kubernetes.md
Created March 15, 2017 09:35
Kubernetes private docker registry authentication via imagepullsecrets

Kubernetes

Kubernetes uses Secrets to store registry credentials.

When manually configuring authentication with any registry in Kubernetes (including Quay and Docker Hub) the following command is used to generate the Kubernetes registry-auth secret:

$ kubectl create secret docker-registry my-favorite-registry-secret --docker-username=giffee_lover_93 --docker-password='passphrases are great!' --docker-email='[email protected]' --docker-server=registry.example.io
secret "my-favorite-registry-secret" created
If you prefer you can store this in a YAML file by adding the --dry-run and -o yaml flag to the end of your command and copying or redirecting the output to a file:
@ianchen06
ianchen06 / good_doc.py
Created March 29, 2017 01:57
python docs
#!/usr/bin/env python
# coding: utf-8
"""
writeup
~~~~~~~
Writeup the binary.
:copyright: (c) 2017 YingHao Chen
"""
def hello(name):
@ianchen06
ianchen06 / upload_multiple_files_to_hadoop.sh
Created March 30, 2017 23:22
tar small files together and pipe to hadoop
tar czvf - *.json | ssh [email protected] "hadoop fs -put - /user/youbike/youbike_data.tar.gz"