Skip to content

Instantly share code, notes, and snippets.

/**
* from Flare demo
* Demos/uutils/GraphUtils.as
*/
/**
* Create a diamond tree, with a given branching factor at
* each level, and depth levels for the two main branches.
* @param b the number of children of each branch node
* @param d1 the length of the first (left) branch
<html>
<head>
<script>
// only works with firefox 3.5
if (navigator.geolocation) {
var watchID = navigator.geolocation.watchPosition(function(position) {
do_something(position.coords.latitude, position.coords.longitude);
}
);
} else {
import java.io.*;
import java.net.*;
class SimpleServer
{
private static SimpleServer server;
ServerSocket socket;
Socket incoming;
BufferedReader readerIn;
PrintStream printOut;
@seungjin
seungjin / .emacs
Created July 26, 2010 02:25
.emacs file
(setq load-path (append '("~/.emacs.d") load-path))
;;'side line number'
(require 'linum)
(global-linum-mode)
;;;Clearing Shell Mode Output
;;http://www.emacswiki.org/emacs/ShellMode#toc11
(defun clear-shell ()
@seungjin
seungjin / .bash_profile
Created August 6, 2010 05:22
my .bash_profile for os x
# File: .bash_profile
# Author: Seung-jin Kim <http://www.github.com/seungjin>
# Last Change: 8/5/2010
# Download:
# Home:
# License:
# Disclaimer: Published as-is, no support, no warranty
export PATH=$HOME/Applications/emacs/bin:$HOME/Applications/scala-2.7.7.final/bin:/opt/local/bin:/opt/local/sbin:/usr/local/mysql/bin:$PATH
#export DISPLAY=:0.0
@seungjin
seungjin / ll function bash shell for mac
Created August 19, 2010 18:12
my bash shell for ll and lla
#!/bin/bash
function ll {
ls -lFh | awk '{if ($9) print $9}'
}
function lla {
ls -lFha | awk '{if ($9) print $9}'
}
@seungjin
seungjin / python mysql escape_string method
Created August 20, 2010 07:48
python mysql escape_string method
#!/usr/env python
import MySQLdb
MySQLdb.escape_string("'")
@seungjin
seungjin / mysql_table_export.rb
Created August 21, 2010 05:47
export mysql's table into xml
require 'Database_connection'
require 'rubygems' #ruby 1.9 does not need it
require 'builder'
require 'iconv'
$KCODE = "UTF-8"
$dbcon = Database_connection.new().seungjin()
$builder = Builder::XmlMarkup.new(:target=>$resultxml="", :indent=>2, :encoding=>'UTF-8')
$builder.instruct!(:xml, :version => "1.0", :encoding => "UTF-8")
#!/usr/bin/env python
##
## sexpr.py - by Yusuke Shinyama
##
## * public domain *
##
from abstfilter import AbstractFeeder, AbstractFilter, AbstractConsumer
@seungjin
seungjin / abstfilter.py
Created August 21, 2010 17:48
A simple framework for pipelining between objects.
#!/usr/bin/env python
## $Id: abstfilter.py,v 1.1.1.1 2003/07/01 23:28:27 euske Exp $
##
## abstfilter.py - A framework for cascade filters.
##
## AbstractFeeder
##
class AbstractFeeder: