Skip to content

Instantly share code, notes, and snippets.

#!/bin/env python27
# -- coding: utf-8 --
import dataset
from sqlalchemy.exc import OperationalError
import time
class Local_storage:
def __init__(self):
#!/bin/env python27
# -- coding: utf-8 --
import requests
import dataset
from sqlalchemy.exc import OperationalError
import time
from bs4 import BeautifulSoup
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import requests
import json
import smtplib, os
from email.MIMEMultipart import MIMEMultipart
from email.MIMEBase import MIMEBase
from email.MIMEText import MIMEText
@seungjin
seungjin / gist:f408f9e793a829a1699b
Created October 18, 2014 01:10
tmux detach instead exit it
exit() {
if [[ -z $TMUX ]]; then
builtin exit
else
tmux detach
fi
}
@seungjin
seungjin / changeKeyboardInput
Created October 16, 2014 08:21
applescript that change your keyboad input type
on changeKeyboardInput(language)
tell application "System Events" to tell process "SystemUIServer"
click (menu bar item 1 of menu bar 1 whose description is "text input")
#click menu item theInputSource of menu 1 of result
click menu item language of menu 1 of result
end tell
end changeKeyboardInput
on run argv
if item 1 of argv = "en" then
"*****************************************************************************
"" NeoBundle core
"*****************************************************************************
if has('vim_starting')
set nocompatible " Be iMproved
" Required:
set runtimepath+=~/.vim/bundle/neobundle.vim/
endif
//http://stackoverflow.com/questions/6564558/wildcards-in-the-pattern-for-http-handlefunc
/*
The patterns for http.Handler and http.HandleFunc aren't regular expressions or globs. There isn't a way to specify wildcards. They're documented here.
That said, it's not too hard to create your own handler that can use regular expressions or any other kind of pattern you want. Here's one that uses regular expressions (compiled, but not tested):
*/
type route struct {
pattern *regexp.Regexp
func request_worker(http_response chan<- string, url string, r *http.Request) {
c := appengine.NewContext(r)
client := urlfetch.Client(c)
resp, err := client.Get(url)
if err != nil {
return
}
contents, err := ioutil.ReadAll(resp.Body)
if err != nil {
os.Exit(1)
package main
import (
"fmt"
"io/ioutil"
"net/http"
"os"
"time"
)
#!/usr/bin/env python2
# Quick and dirty demonstration of CVE-2014-0160 by Jared Stafford (jspenguin@jspenguin.org)
# The author disclaims copyright to this source code.
import sys
import struct
import socket
import time
import select