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

#!/usr/bin/env python
import urllib2
import pinboard
pinuser = raw_input('Pinboard username: ')
pinpasswd = raw_input('Pinboard password: ')
oldtag = raw_input('Tag to rename: ')
newtag = raw_input('Rename tag to: ')
@csu
csu / gist:5252291
Created March 27, 2013 06:55
Interactive Data Map iFrames
<iframe name="mapframe" id="mapframe" src="http://18069595.nhd.weebly.com/files/theme/mapframe.html" height=400 width=58%></iframe>
<iframe name="dataframe" id="dataframe" src="http://18069595.nhd.weebly.com/files/theme/dataframe.html" height=400 width=40%></iframe>
@csu
csu / gist:5252298
Created March 27, 2013 06:57
Embedding PDF documents using Google Docs
<iframe src="http://docs.google.com/gview?url=http://18069595.nhd.weebly.com/files/theme/dikotter-transcript.pdf&embedded=true" style="width:900px; height:900px;" frameborder="0"></iframe>
@csu
csu / gist:5252295
Last active December 15, 2015 11:19
Link to control iFrame
<a href="/files/theme/map_guangdong.html" TARGET="dataframe" id="rectangle11">
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 / bits.php
Created September 17, 2012 12:01
Bits WordPress Page Template
<?php
/*
Template Name: Bits
*/
get_header(); ?>
<?php
query_posts('cat=13');
while ( have_posts() ) : the_post(); ?>
@csu
csu / gist:3616693
Created September 4, 2012 04:48
homebrew fail :(
Last login: Tue Sep 4 12:43:23 on ttys000
csu:~ christophersu$ brew pip Glances
==> pip install glances==1.4 --install-option=--prefix=/usr/local/Cellar/glances/1.4
==> Build Environment
HOMEBREW_VERSION: 0.9.3
HEAD: 7053db47f7f62e8d88238ffc8b56b5059364add6
CPU: 8-core 64-bit ivybridge
OS X: 10.8.1-x86_64
Xcode: 4.4.1
@csu
csu / latestgrowl.sh
Created September 1, 2012 01:23
Retrieve latest entries from Growl history
#!/bin/bash
sqlite3 /Users/christophersu/Library/Application\ Support/Growl/notifications.history "SELECT ZTITLE FROM ZNOTIFICATION" | tail -5