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 | |
OPENSSL_VERSION="1.0.1g" | |
curl -O http://www.openssl.org/source/openssl-$OPENSSL_VERSION.tar.gz | |
tar -xvzf openssl-$OPENSSL_VERSION.tar.gz | |
mv openssl-$OPENSSL_VERSION openssl_i386 | |
tar -xvzf openssl-$OPENSSL_VERSION.tar.gz | |
mv openssl-$OPENSSL_VERSION openssl_x86_64 | |
cd openssl_i386 |
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
// | |
// Using CoreLocation on Mac OS X with command-line | |
// $ clang CoreLocationTest.m -framework cocoa -framework CoreLocation | |
// $ ./a.out | |
// location service enabled | |
// 2011-12-01 21:03:01.839 a.out[10214:903] latitude,logitude : 35.606647, 140.695538 | |
// 2011-12-01 21:03:01.842 a.out[10214:903] timestamp : 2011-12-01 21:01:36 +0900 | |
// tmiz moo@tmiz.net | |
// | |
#import <cocoa/cocoa.h> |
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
// | |
// USAGE: | |
// $ clang++ main.cpp -framework CoreFoundation -framework IOKit -o SystemSerial | |
// $ ./SystemSerial | |
// Serial Number(System): XXXXXXXXXXX | |
// | |
// Reference. | |
// http://developer.apple.com/library/mac/#technotes/tn1103/_index.html | |
// | |
// tmiz moo@tmiz.net |
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 fib | |
>>> fib.alt_fib(10) | |
55 | |
>>> fib.alt_fib(100) | |
354224848179261915075L | |
>>> fib.alt_fib(1000) | |
43466557686937456435688527675040625802564660517371780402481729089536555417949051890403879840079255169295922593080322634775209689623239873322471161642996440906533187938298969649928516003704476137795166849228875L | |
>>> fib.alt_fib(10000) | |
33644764876431783266621612005107543310302148460680063906564769974680081442166662368155595513633734025582065332680836159373734790483865268263040892463056431887354544369559827491606602099884183933864652731300088830269235673613135117579297437854413752130520504347701602264758318906527890855154366159582987279682987510631200575428783453215515103870818298969791613127856265033195487140214287532698187962046936097879900350962302291026368131493195275630227837628441540360584402572114334961180023091208287046088923962328835461505776583271252546093591128203925285393434620904245248929403901706233888991085841065183173360437470737908552631764325733993712871937587746897479926305837065742830161637 |
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 fib_gen_(): | |
temp1,temp2 = 0,1 | |
while 1: | |
yield temp1 + temp2 | |
temp2,temp1 = temp1,temp2+temp1 | |
def alt_fib(n): | |
if n==0:return 0 | |
elif n==1:return 1 | |
a = fib_gen_() |
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
cache_fib={} | |
def c_fib(n): | |
if cache_fib.has_key(n): | |
return cache_fib[n] | |
if n==0: | |
cache_fib[0]=0 | |
elif n==1: | |
cache_fib[1]=1 | |
else: | |
cache_fib[n] = c_fib(n-1)+c_fib(n-2) |
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 fib(n): | |
if n==0:return 0 | |
if n==1:return 1 | |
return fib(n-1)+fib(n-2) |
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
tell application "Safari" | |
if not (exists front document) then return | |
set _title to name of front document | |
set _url to URL of front document | |
end tell | |
set the clipboard to _url & return & _title & return |
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 | |
""" | |
$ ./genEmbeddedFloatTable txtCopyFromExcel.txt aCertainCoefTable | |
const float aCertainCoefTable[24] = { | |
0.10f , 0.09f , 0.09f , 0.08f , 0.07f , 0.07f , 0.07f , 0.06f , 0.06f , 0.06f , | |
0.05f , 0.04f , 0.04f , 0.04f , 0.03f , 0.03f , 0.02f , 0.01f , 0.01f , 0.06f , | |
0.06f , 0.06f , 0.06f , 0.06f | |
}; |
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
# sleep sort | |
import threading | |
import time | |
class SleepAndAppend(threading.Thread): | |
def __init__(self, value, targetList): | |
threading.Thread.__init__(self) | |
self.value = value | |
self.targetList = targetList | |
def run(self): |