This file contains hidden or 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 ruby | |
require 'net/ftp' | |
ftp = Net::FTP.new('www.myftpserver.com') | |
ftp.passive = true | |
ftp.login('myuserid','mypassowrd') | |
files = ftp.chdir('/data') | |
#Currnet localpath |
This file contains hidden or 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 | |
# PowerSet program | |
def PowerSet(base): | |
power_set = [] | |
b = len(base) | |
map(lambda g: power_set.append(map(lambda x: base[x], | |
filter(lambda x: g[x], range(0, b)))), | |
map(lambda value: map(lambda x: (value >> x) & 1, range(b - 1, -1, -1)), | |
map(lambda value: value ^ (value / 2), range(0, 2**b)))) |
This file contains hidden or 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
<?php | |
// php loop based on recursion | |
// why do we need while / for statement in program language? | |
// and in php, I cannot pass php function to php function as function arg. :-( | |
// Anonymous functions are available since PHP 5.3.0. http://us2.php.net/manual/en/functions.anonymous.php | |
// I am using 5.2.6 now. | |
class Foo | |
{ | |
public function loop($a,$b) | |
{ |
This file contains hidden or 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
// get rid of for/while in your ecmascrip! | |
loop = function(givenF,a,b) { | |
if ( a >= 0 && b >= a ) { eval(givenF()); a++; loop(givenF,a,b); } | |
} | |
sayHello = function() { | |
print("say hello\n"); | |
} | |
loop(sayHello,1,4); |
This file contains hidden or 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 | |
# get rid of for/while in your python code! | |
def loop(givenF,a,b): | |
if ( a >= 0 and b >= a) : | |
givenF() | |
a += 1 | |
loop(givenF,a,b) | |
def sayHello(): | |
print("say hello") |
This file contains hidden or 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
/** | |
* this source is from http://www.openjs.com/scripts/others/dump_function_php_print_r.php | |
*/ | |
/** | |
* Function : dump() | |
* Arguments: The data - array,hash(associative array),object | |
* The level - OPTIONAL | |
* Returns : The textual representation of the array. | |
* This function was inspired by the print_r function of PHP. |
This file contains hidden or 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
<?php | |
function get_microtime() | |
{ | |
list($usec, $sec) = explode(' ', microtime()); | |
return ((float)$usec + (float)$sec); | |
} | |
$start_time = get_microtime(); | |
// I do not use this function. Don't need it. Record this code just for reference |
This file contains hidden or 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 | |
# copy files into target directory with timestamp | |
import os | |
import sys | |
from datetime import date | |
print("USAGE: python cpHere.py /Users/seungjin/Desktop/a"); |
This file contains hidden or 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 | |
# connectionCheck | |
import sys | |
from urllib2 import urlopen | |
import socket | |
host = sys.argv[1] | |
port = int(sys.argv[2]) | |
size = 1024 |
This file contains hidden or 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
/* image rotate javascript */ | |
/* This script and many more are available free online at | |
The JavaScript Source!! http://javascript.internet.com | |
Created by: Benoit Asselin | http://www.ab-d.fr */ | |
function rotate(p_deg) { | |
if(document.getElementById('canvas')) { | |
/* | |
Ok!: Firefox 2, Safari 3, Opera 9.5b2 |
OlderNewer