Skip to content

Instantly share code, notes, and snippets.

@jayzeng
jayzeng / download_bench.py
Created August 1, 2013 00:58
various ways to download a file, compare their time
import urllib2
import httplib
import os
import time
from urllib2 import Request, urlopen, URLError
def save_file(file):
output_filename = file.split("/")[-1]
if os.path.exists(output_filename):
@jayzeng
jayzeng / twilio.xml
Created August 11, 2013 03:39
twilio
<?xml version="1.0" encoding="UTF-8"?><Response><Say>Welcome to twilio!</Say></Response>
Your YC username:
Company name:
Company url, if any:
Phone number(s):
Please enter the url of a 1 minute unlisted (not private) YouTube video introducing the founders. (Instructions.)
YC usernames of all founders, including you, e1ven, separated by spaces. (That's usernames, not given names: "bksmith," not "Bob Smith." If there are 3 founders, there should be 3 tokens in this answer.)
YC usernames of all founders, including you, e1ven, who will live in the Bay Area January through March if we fund you. (Again, that's usernames, not given names.)
What is your company going to make?
If this application is a response to a YC RFS, which one?
For each founder, please list: YC username; name; age; year of graduation, school, degree and subject for each degree; email address; personal url, github url, facebook id, twitter id; employer and title (if any) at last job before this startup. Put unfinished degrees in parens. List the main contact first. Separate founders with blank lines. Put an asterisk before t
//ImageView angryHuskyImageView = (ImageView)findViewById(R.id.imageView);
//angryHuskyImageView.setTag("http://d24w6bsrhbeh9d.cloudfront.net/photo/a2zQDvw_700b.jpg");
@jayzeng
jayzeng / shift.js
Created March 19, 2014 20:27
left shifting
function shift(input, pos) {
return input.slice(pos, input.length) + input.slice(0, pos);
}
console.log(shift("abcdefg", 2) === "cdefgab");
@jayzeng
jayzeng / gist:9715484
Created March 22, 2014 22:36
run docker on Mac OXS
git clone [email protected]:boot2docker/boot2docker.git
chmod +x boot2docker
sudo mv boot2docker /usr/local/bin/boot2docker
# see https://github.com/boot2docker/boot2docker/blob/master/doc/BUILD.md
build ubuntu image
cd boot2docker
# (references to https://github.com/boot2docker/boot2docker/blob/master/base/Dockerfile)
# note this step takes quite a while
@jayzeng
jayzeng / note
Created March 23, 2014 23:38
Dockerfile magic
How to call dockerfile?
Github:
docker build github_url
Locally:
docker build .
docker build <path>
Trusted builds:
@jayzeng
jayzeng / gist:9877315
Created March 30, 2014 18:23
set up hubot on heroku
- Create a new bot user and invite to the room on hipchat
- Once the bot account is created, go to https://smarttech.hipchat.com/account/xmpp
- Install coffee script and hubot
```
npm install --global coffee-script hubot
```
- Create a new hubot project, cd into the folder and install depenedncies
```
hubot --create hubot-fun
cd hubot-fun
@jayzeng
jayzeng / curl.md
Created April 20, 2014 22:38 — forked from btoone/curl.md

Introduction

An introduction to curl using GitHub's API

The Basics

Makes a basic GET request to the specifed URI

curl https://api.github.com/users/caspyin
#!/bin/bash
# ========================================
# Testing completion suggest in ElasticSearch
# ========================================
curl -X DELETE localhost:9200/hotels
curl -X PUT localhost:9200/hotels -d '
{
"mappings": {
"hotel" : {