Skip to content

Instantly share code, notes, and snippets.

View csu's full-sized avatar

Christopher Su csu

  • San Francisco, CA
View GitHub Profile
@csu
csu / nginxproxy.md
Created January 21, 2016 05:02 — forked from soheilhy/nginxproxy.md
How to proxy web apps using nginx?

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for example1.com, example2.com, and example1.com/images on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers

javascript:(function()%7Bvar%20d%3Ddocument%2Cw%3Dwindow%2Ce%3Dw.getSelection%2Ck%3Dd.getSelection%2Cx%3Dd.selection%2Cs%3D(e%3Fe()%3A(k)%3Fk()%3A(x%3Fx.createRange().text%3A0))%2Cl%3Dd.location%2Ce%3DencodeURIComponent%2Cp%3D'%22'%2B((e(s))%3Fe(s)%3Ae(document.title))%2B'%22%20'%2Be(l.href)%3Bwindow.open('http%3A%2F%2Fcircular.io%2F%3Fp%3D'%2Bp)%7D)()
var d=document,w=window,e=w.getSelection,k=d.getSelection,x=d.selection,s=(e?e():(k)?k():(x?x.createRange().text:0)),l=d.location,e=encodeURIComponent,p='"'+((e(s))?e(s):e(document.title))+'" '+e(l.href);window.open('http://circular.io/?p='+p);
@csu
csu / gist:99ba5c637cb40ff50f90
Created October 3, 2015 19:49
recursively unzip all zip archives in a directory and its subdirectories
find . -name "*.zip" | while read filename; do unzip -o -d "`dirname "$filename"`" "$filename"; done;
@csu
csu / gist:7b605646bf686218878d
Created July 12, 2015 02:50
clone all repos
#!/bin/bash
GIT_CLONE_CMD="git clone --quiet --mirror --recursive "
REPOLIST=`curl --silent https://api.github.com/users/csu/repos -q | grep "\"ssh_url\"" | awk -F': "' '{print $2}' | sed -e 's/",//g'`
for REPO in $REPOLIST; do
${GIT_CLONE_CMD}${REPO}
done
@csu
csu / gist:b40b46b5634a0288f845
Created July 12, 2015 02:49
get all repo ssh_urls
REPOLIST=`curl --silent https://api.github.com/users/csu/repos -q | grep "\"ssh_url\"" | awk -F': "' '{print $2}' | sed -e 's/",//g'`
@csu
csu / keybase.md
Created June 4, 2015 21:13
keybase.md

Keybase proof

I hereby claim:

  • I am csu on github.
  • I am csu (https://keybase.io/csu) on keybase.
  • I have a public key whose fingerprint is 6643 A3B8 CD47 0906 FD8D 044A F914 3111 A573 6153

To claim this, I am signing this object:

-----> Fetching custom git buildpack... done
-----> Multipack app detected
=====> Downloading Buildpack: https://github.com/mbuchetics/heroku-buildpack-nodejs-grunt
=====> Detected Framework: Node.js
PRO TIP: Avoid using semver ranges starting with '>' in engines.node
See https://devcenter.heroku.com/articles/nodejs-support
-----> Requested node range: > 0.8.x
-----> Resolved node version: 0.12.3
-----> Downloading and installing node
-----> Writing a custom .npmrc to circumvent npm bugs
Error in library(Rserve) : there is no package called 'Rserve'
Execution halted
[qtp927327686-22] WARN org.eclipse.jetty.servlet.ServletHandler -
javax.servlet.ServletException: org.rosuda.REngine.Rserve.RserveException: Cannot connect: Connection refused
at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:420)
at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:538)
at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:716)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:668)
at com.google.inject.servlet.ServletDefinition.doService(ServletDefinition.java:263)
at com.google.inject.servlet.ServletDefinition.service(ServletDefinition.java:178)