Skip to content

Instantly share code, notes, and snippets.

Avatar

Jihyun Yu yjh0502

  • 5minlab
  • Seoul, South Korea
View GitHub Profile
View gist:ba960b376852446dbdb219af00a6f068
root@foo:~/repo/git/zstd # gmake
gmake -C programs
gmake[1]: Entering directory '/root/repo/git/zstd/programs'
cc -I../lib -I../lib/common -I../lib/dictBuilder -I../lib/legacy -O3 -Wall -Wextra -Wcast-qual -Wcast-align -Wshadow -Wstrict-aliasing=1 -Wswitch-enum -Wdeclaration-after-statement -Wstrict-prototypes -Wundef -DZSTD_LEGACY_SUPPORT=1 ../lib/decompress/zstd_decompress.c -c -o ../lib/decompress/zstd_decompress.o
cc -I../lib -I../lib/common -I../lib/dictBuilder -I../lib/legacy -O3 -Wall -Wextra -Wcast-qual -Wcast-align -Wshadow -Wstrict-aliasing=1 -Wswitch-enum -Wdeclaration-after-statement -Wstrict-prototypes -Wundef -DZSTD_LEGACY_SUPPORT=1 ../lib/decompress/zstd_decompress.o ../lib/decompress/huf_decompress.c ../lib/common/zstd_common.c ../lib/common/fse_decompress.c ../lib/common/xxhash.c ../lib/common/entropy_common.c ../lib/compress/zstd_compress.c ../lib/compress/fse_compress.c ../lib/compress/huf_compress.c ../lib/legacy/zstd_v02.c ../lib/legacy/zstd_v06.c ../lib/legacy/zstd_v04.c ../
@yjh0502
yjh0502 / epgsql_bench.erl
Last active Mar 4, 2016
simple epgsql bench
View epgsql_bench.erl
-module(epgsql_bench).
-export([run/2]).
-define(HOST, "").
-define(PORT, "").
-define(USER, "").
-define(PW, "").
-define(DB, "").
@yjh0502
yjh0502 / Makefile
Last active Aug 29, 2015
15ai_client_c
View Makefile
CFLAGS=-Wall -Werror -Wextra -g -ggdb
main: main.c
gcc $(CFLAGS) $< -o $@
@yjh0502
yjh0502 / main.go
Created Dec 30, 2014
OpenVPN TCP-to-UDP proxy
View main.go
package main
import (
"flag"
"fmt"
"io"
"log"
"net"
)
@yjh0502
yjh0502 / test.erl
Created Aug 20, 2014
Simple erlang messaging benchmark
View test.erl
-module(test).
-compile([export_all]).
waitdown(0) -> ok;
waitdown(Count) ->
receive
{'DOWN', _, process, _, normal} ->
waitdown(Count-1)
end.
View star.bash.result
jihyun@ubuntu:~/.tmp$ cat star.bash
#!/usr/bin/env bash
for i in `seq 5 -1 1`
do
out=
for j in `seq $i -1 1`
do
out=$out*
done
View star.bash
#!/usr/bin/env bash
for i in `seq 5 -1 1`
do
out=
for j in `seq $i -1 1`
do
out=$out*
done
echo "$out"
View gist:5617381
diff --git a/src/librustc/middle/check_match.rs b/src/librustc/middle/check_match.rs
index d859e03..23300a9 100644
--- a/src/librustc/middle/check_match.rs
+++ b/src/librustc/middle/check_match.rs
@@ -498,10 +498,29 @@ pub fn specialize(cx: @MatchCheckCtxt,
lookup_const_by_id(cx.tcx, did).get();
let e_v = eval_const_expr(cx.tcx, const_expr);
let match_ = match *ctor_id {
- val(ref v) => compare_const_vals(&e_v, v) == 0,
+ val(ref v) => {
View byun_the_exponental.py
mem = {} #simple memorization
def byun_count(years):
if years in mem:
return mem[years]
count = 1
life = years
while life > 0:
for i in range(2):
life -= 1
@yjh0502
yjh0502 / gist:5097287
Created Mar 6, 2013
Rust container growth rate: 2x to 1.5x
View gist:5097287
diff --git a/src/libcore/at_vec.rs b/src/libcore/at_vec.rs
index d894817..bc3f547 100644
--- a/src/libcore/at_vec.rs
+++ b/src/libcore/at_vec.rs
@@ -269,7 +269,7 @@ pub mod raw {
* * n - The number of elements to reserve space for
*/
pub unsafe fn reserve_at_least<T>(v: &mut @[const T], n: uint) {
- reserve(v, uint::next_power_of_two(n));
+ reserve(v, n + (n>>1));