Skip to content

Instantly share code, notes, and snippets.

View lqez's full-sized avatar
:octocat:
Doing something on net

Hyunwoo Park lqez

:octocat:
Doing something on net
View GitHub Profile
" Vim syntax file
" Language: JSON
" Maintainer: Jeroen Ruigrok van der Werven <asmodai@in-nomine.org>
" Last Change: 2009-06-16
" Version: 0.4
" {{{1
" Syntax setup {{{2
" For version 5.x: Clear all syntax items
" For version 6.x: Quit when a syntax file was already loaded
@lqez
lqez / gist:1182973
Created August 31, 2011 07:03
Add border and shadow to all png
ls *.png | awk '{split($0,s,".");printf( "convert %s -bordercolor transparent -border 5 \\( +clone -channel A -morphology EdgeOut Octagon:5 +channel +level-colors white \\) -compose DstOver -composite \\( +clone -background black -shadow 60x5+5+5 \\) -background transparent -layers merge +repage %s_outline.png\n", $0, s[1] );}' | /bin/sh
@lqez
lqez / gist:1520683
Created December 26, 2011 07:12
dropping tables in django database
#!/usr/bin/python
import os
import settings
fn = 'drop_tables.sql'
try:
os.remove( fn )
except:
pass
@lqez
lqez / gist:1520810
Created December 26, 2011 09:38
An alternative approach to drop all tables in django project
#!/usr/bin/python
# Alternative approach.
import os
import MySQLdb
print 'drop remaining tables...'
for name, db in settings.DATABASES.iteritems():
conn = MySQLdb.connect( db['HOST'], db['USER'], db['PASSWORD'], db['NAME'] )
@lqez
lqez / gist:1559081
Created January 4, 2012 08:21
Use define variable in define
#define CONCAT_X(t1,t2) t1##t2
#define CONCAT(t1,t2) CONCAT_X(t1,t2)
/* usage */
#define PREFIX TAEYEON__
#define foo CONCAT(PREFIX,foo)
void foo() {} /* this function will be renamed into 'TAEYEON__foo' */
@lqez
lqez / gist:1604406
Created January 13, 2012 03:17
svr dot
digraph idc {
nodesep="1.0";
ranksep="2.0";
node [fontname="Verdana", shape="record", fontsize="15"]
edge [fontname="Verdana", fontsize="10"]
subgraph cluster_LB {
label="Load Balancers";
{ rank = same; l2 l1; }
@lqez
lqez / gist:1815068
Created February 13, 2012 08:33
cloudfuse start/stop script for ucloudbiz.olleh.com storage service.
#! /bin/sh
### BEGIN INIT INFO
# Provides: cloudfuse
# Should-Start: $named
# Default-Start: 2 3 4 5
# Default-Stop:
# Short-Description: fast remote file copy program daemon
# Description: Cloudfuse is a FUSE application which provides access to
# Rackspace's Cloud Files (or any installation of Swift).
@lqez
lqez / gist:1986046
Created March 6, 2012 12:37
system-wide git ignore setup
echo ".DS_Store" >> /etc/gitignore
git config --system core.excludesfile /etc/gitignore
( must with write privileges in /etc directory )
@lqez
lqez / gist:2350170
Created April 10, 2012 10:24
kenburn random function for jquery.cross-slide.js
function kenburn_random( force_zoom )
{
var xpos = Math.floor(Math.random() * 100);
var ypos = Math.floor(Math.random() * 100);
var zoom = (Math.random()*3);
if( zoom < 1.0 || force_zoom == 1 ) zoom = 1.0;
return xpos+'% '+ypos+'% '+zoom+'x';
}
/* usage
@lqez
lqez / gist:2404749
Created April 17, 2012 09:07
Modified swipe.js to get callback point on beginning swipe.
/*
* Swipe 1.0
*
* Brad Birdsall, Prime
* Copyright 2011, Licensed GPL & MIT
*
*/
window.Swipe = function(element, options) {