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 | |
from altgraph import Graph | |
def read_graph(f): | |
g = Graph.Graph() | |
for l in file(f): | |
l = l.rstrip().split() |
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 | |
import Image | |
def conv(f): | |
Image.open(f).convert('LA').save('output.png') | |
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
int ack(int m, int n) { | |
if (m == 0) return n + 1; | |
if (n == 0) { | |
return ack(m - 1, 1); | |
} else { | |
return ack(m - 1, ack(m, n - 1)); | |
} | |
} |
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
#include <iostream> | |
using namespace std; | |
// 符号と値を貰って足される数を返すわ | |
int calc( bool hugou, int num ) | |
{ | |
int ret = 0; | |
if( hugou ) | |
{ |
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 | |
def tarai(x, y, z): | |
if x <= y: | |
return y | |
else: | |
return tarai( | |
tarai(x-1, y, z), | |
tarai(y-1, z, x), | |
tarai(z-1, x, y)) |
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 os | |
import cmd | |
def file_auto_complete(text, line, begidx, endidx): | |
""" auto complete of file name. | |
""" | |
line = line.split() |
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
<!doctype html> | |
<!-- | |
"Notations" theme designed by Ben Delaney (http://bendelaney.me) | |
Available in the Tumblr theme garden: http://www.tumblr.com/theme/8631 --> | |
<html lang="en"> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> |
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
int simple_atoi(const char* a) { | |
int ans = 0; | |
while (*a != '\0') { | |
ans = ans * 10 + (*a++) - '0'; | |
} | |
return ans; | |
} |
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 numpy as np | |
from scipy.optimize import leastsq | |
def fit_func(parameter, x, y): | |
a = parameter[0] | |
b = parameter[1] | |
residual = y - (a*x*x + b) |
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
unsigned char reverse_bit8(unsigned char x) | |
{ | |
x = ((x & 0x55) << 1) | ((x & 0xAA) >> 1); | |
x = ((x & 0x33) << 2) | ((x & 0xCC) >> 2); | |
return (x << 4) | (x >> 4); | |
} | |
unsigned short reverse_bit16(unsigned short x) | |
{ |
NewerOlder