Skip to content

Instantly share code, notes, and snippets.

@import <Foundation/CPObject.j>
@implementation AppController : CPObject
{
}
- (void)applicationDidFinishLaunching:(CPNotification)aNotification
{
var theWindow = [[CPWindow alloc] initWithContentRect:CGRectMakeZero() styleMask:CPBorderlessBridgeWindowMask];
@yllan
yllan / gist:2382900
Created April 14, 2012 08:29
Perfume JPN Live Auction
5/11 blncag(607) 14000 4月 27日 23時 42分
http://page5.auctions.yahoo.co.jp/jp/auction/e122014254
5/9 blncag(607) 15000 4月 27日 23時 43分
http://page10.auctions.yahoo.co.jp/jp/auction/m100350233
5/11 lastlite55(809) 16000 4月 27日 15時 50分
http://page10.auctions.yahoo.co.jp/jp/auction/m100318453
val h_over_g_to_x1 = (1 to B).par.map(x1 => (h * g_inverse.modPow(x1, p)).mod(p) -> x1.toLong).toMap.seq
@tailrec def build(p: BigInt, g_inverse: BigInt, h_over_g_inverse_x1: BigInt, x1: Long, bound: Long, hash: Map[BigInt, Long]): Map[BigInt, Long] =
if (x1 > bound)
hash
else
build(p, g_inverse, (h_over_g_inverse_x1 * g_inverse).mod(p), x1 + 1, bound, hash + (h_over_g_inverse_x1 -> x1))
@yllan
yllan / gist:2403086
Created April 17, 2012 02:58
Bitwise Combination
#include<stdio.h>
void print_binary(long x, int digit)
{
for (int i = 1 << (digit - 1); i; printf("%d", !!(x & i)), i >>= 1);
puts("");
}
long next(long x)
{
故事到中期為止都滿有創意、頗引人入勝。不過結局處理就有點理所當然,比較缺乏驚喜。
仍然是部好電影,只是沒像 Up 那樣讓我感動。公主看起來很漂亮,有幾個鏡頭讓我心動了(?)。
@yllan
yllan / Golem.sh
Last active October 7, 2015 07:37
Maintenance Script
# Build Golem
sbt assembly
# Run golem as daemon
nohup java -jar target/Golem-assembly-1.0.jar </dev/null &
@yllan
yllan / gist:3971308
Created October 29, 2012 03:29
AV 明星臉
劉德華 http://www.nownews.com/newspic/1454/i1454312.jpg
周杰倫 http://www.nownews.com/newspic/1454/i1454315.jpg
歐漢聲 http://www.nownews.com/newspic/1454/i1454319.jpg
劉謙 http://www.nownews.com/newspic/1454/i1454316.jpg
浩子 http://www.nownews.com/newspic/1668/i1668092.jpg
納豆 http://www.nownews.com/newspic/1667/i1667369.jpg
張韶涵 http://www.nownews.com/newspic/1454/i1454318.jpg
白雲 http://www.nownews.com/newspic/1667/i1667371.jpg
王仁甫 http://ppt.cc/dbBM
HEBE http://ppt.cc/WP4k
@yllan
yllan / gist:4065172
Created November 13, 2012 10:48
Set the iTunes Language
# Add
defaults write $(mdls -name kMDItemCFBundleIdentifier -raw /Applications/iTunes.app) AppleLanguages "(zh_TW, en)"
# Remove
defaults delete $(mdls -name kMDItemCFBundleIdentifier -raw /Applications/iTunes.app) AppleLanguages
# One Time
/Applications/iTunes.app/MacOS/iTunes -AppleLanguages "(zh_TW, English)"
@yllan
yllan / gist:4095822
Created November 17, 2012 13:02
scala regex replace with function transformation
scala> """\{(\d+)\}""".r.replaceAllIn("""{123} {ABC} {45}""", m=>(m.group(1).toInt + 1).toString)
res1: String = 124 {ABC} 46