Skip to content

Instantly share code, notes, and snippets.

@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 ([email protected])
# The author disclaims copyright to this source code.
import sys
import struct
import socket
import time
import select
from boto.ec2.autoscale import AutoScaleConnection
groupname = ''
as_conn = AutoScaleConnection(
aws_access_key_id='',
aws_secret_access_key=''
)
group = as_conn.get_all_groups(names=[groupname])[0]
from boto.ec2.autoscale import AutoScaleConnection
groupname = ''
as_conn = AutoScaleConnection(
aws_access_key_id='',
aws_secret_access_key=''
)
group = as_conn.get_all_groups(names=[groupname])[0]
@seungjin
seungjin / autoscale_sample
Created November 26, 2012 05:12 — forked from liamf/autoscale_sample
Demonstrates using patched boto to create an autoscaling group of servers, scaled up/down by CPU Utilisation
#################################################################################
# Import modules
#################################################################################
import os
import time
import sys
import socket
import string