This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
location / { | |
uwsgi_pass unix:app.sock; | |
post_action @post_action; | |
} | |
location @post_action { | |
proxy_pass http://dst_host:dst_port; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import httplib2, sys, os, base64, hashlib, hmac, time | |
import json as simplejson | |
from urllib import urlencode, quote_plus | |
aws_key = '' | |
aws_secret_key = '' | |
hostname = open('/etc/hostname').read().rstrip() | |
# XXX: For now, those two names are same. but should be distinguished. | |
instanceid = hostname |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
sfdisk /dev/xvdb <<< "1,,8e" # one big Linux LVM type partition | |
if [ $? != 0 ]; then | |
echo "No data disk?" | |
exit 1 | |
fi | |
pvcreate /dev/xvdb1 | |
vgcreate VolGroup /dev/xvdb1 | |
lvcreate -L 80g -n data00 VolGroup # Just try to create 80g vol.. Mostly failed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import sys, os, re | |
from subprocess import * | |
# get_evenly.py videofile #of_thumbnails - 1 | |
try: | |
fvideo = sys.argv[1] | |
frames = float(sys.argv[2]) | |
except: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import psycopg2 | |
from flask import Flask, request | |
app = Flask(__name__) | |
app.debug = True | |
conn = psycopg2.connect(host='', database='', user='', password='') | |
@app.route('/city', methods=['GET']) | |
def city(): | |
print 'city' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def send_gmail(to = None, subject = '', content = ''): | |
gmail_user = "" | |
gmail_pwd = "" | |
message = u'\From: {}\nTo: {}\nSubject: {}\n\n{}'.format(gmail_user, to, subject, content) | |
try: | |
server = smtplib.SMTP('smtp.gmail.com', 587) | |
server.ehlo() | |
server.starttls() | |
server.login(gmail_user, gmail_pwd) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <time.h> | |
#include <stdio.h> | |
int | |
main(int argc, char* argv[]) { | |
struct timespec ts; | |
struct timespec delay = { .tv_sec = 0, .tv_nsec = 1000 }; | |
int res = -1; | |
clockid_t clk = CLOCK_REALTIME; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
def change_direction(dx, dy): | |
# not allowed! | |
if abs(dx+dy) != 1: | |
raise ValueError | |
if dy == 0: | |
return dy, dx | |
if dx == 0: | |
return -dy, dx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copyright (c) 2014, Younggun Kim | |
# | |
# Permission is hereby granted, free of charge, to any person obtaining a copy | |
# of this software and associated documentation files (the "Software"), to deal | |
# in the Software without restriction, including without limitation the rights | |
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
# copies of the Software, and to permit persons to whom the Software is | |
# furnished to do so, subject to the following conditions: | |
# | |
# The above copyright notice and this permission notice shall be included in |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# NOTE: | |
# You couldn't track original branch (which would imported under current repo) history from current repo. | |
if [ "$#" -ne 2 ]; then | |
echo "Usage: $0 prefix url" | |
exit 0 | |
fi | |
NAME=$1 |
OlderNewer