Skip to content

Instantly share code, notes, and snippets.

View YukiSakamoto's full-sized avatar

Yuki Sakamoto YukiSakamoto

  • Osaka, Japan
  • 09:53 (UTC +09:00)
View GitHub Profile
@YukiSakamoto
YukiSakamoto / Extend_STLContainers.cpp
Created February 5, 2014 08:44
Extensions of STL Containers
#include <vector>
template <typename T>
class vector_ex :protected std::vector<T>
{
public:
typedef T data_type;
typedef std::vector<T> base_type;
typedef typename base_type::iterator iterator;
typedef typename base_type::size_type size_type;
@YukiSakamoto
YukiSakamoto / numeric_limits.cpp
Created February 6, 2014 11:02
numeric_limits.cpp
#include <iostream>
#include <numeric>
int main(void) {
std::cout << "numeric_limits= " << std::numeric_limits<double>::epsilon() << std::endl;
return 0;
}
@YukiSakamoto
YukiSakamoto / Extend_string.cpp
Created February 19, 2014 17:11
extend string class
#include <string>
class string_ex : protected std::string
{
public:
typedef std::string base_type;
typedef base_type::iterator iterator;
typedef base_type::const_iterator const_iterator;
typedef base_type::size_type size_type;
@YukiSakamoto
YukiSakamoto / primes.py
Created March 13, 2014 11:32
渡された数以下の素数を列挙する。再帰を用いる場合と用いない場合。
def primes_helper(lim, cur, acc):
if lim < cur:
return acc
elif len( filter( lambda x : cur % x == 0, acc)) == 0:
return primes_helper(lim, cur + 1, acc + (cur,))
else:
return primes_helper(lim, cur + 1, acc)
def primes(lim):
@YukiSakamoto
YukiSakamoto / wscript
Created March 21, 2014 09:32
wscript
vim: filetype:python
def build_here_p(ctx):
import sys
import os
current_dir = os.getcwd()
#print current_dir
#this_wscript_path = os.path.dirname(__file__).abspath()
#this_wscript_path = os.path.dirname( os.__file__ )
this_wscript_path = ctx.path.abspath()
@YukiSakamoto
YukiSakamoto / enzymes_sort.rb
Created March 25, 2014 06:09
酵素のリストをソートする
Pattern = %r{^ec:(\d+).(\d+).(\d+).(\d+)}
all_lines = []
File.open("enzyme_randomized.list") do |f|
f.each_line do |line|
all_lines << line
end
end
@YukiSakamoto
YukiSakamoto / remove_reference_test.cpp
Last active August 29, 2015 14:05
My simple test of boost::remove_reference
#include <iostream>
#include <boost/type_traits.hpp>
int main(void)
{
typedef int& int_ref;
typedef int* int_p;
std::cout << boost::is_same< boost::remove_reference<int>::type, int>::value << std::endl;
std::cout << boost::is_same< boost::remove_reference<int_ref>::type, int>::value << std::endl;
@YukiSakamoto
YukiSakamoto / trigraph.c
Created September 6, 2014 12:45
Hello world program in C with trigraphs
??=include<stdio.h>
int main(void)??<
printf("Hello, World!??/n");
return 0;
??>
@YukiSakamoto
YukiSakamoto / objdump.S
Created September 10, 2014 14:42
Simple test of passing function pointers
./a.out: file format mach-o-x86-64
Disassembly of section .text:
0000000100000e90 <__Z2f1d>:
100000e90: 55 push %rbp
100000e91: 48 89 e5 mov %rsp,%rbp
100000e94: f2 0f 11 45 f8 movsd %xmm0,-0x8(%rbp)
@YukiSakamoto
YukiSakamoto / Kanagawa.csv
Created September 19, 2014 22:05
Starbucks Stores
We can make this file beautiful and searchable if this error is corrected: It looks like row 9 should actually have 10 columns, instead of 5. in line 8.
id,name,region,weekday,friday,saturday,sunday,tel,seats,lan
113,川崎モアーズ店,神奈川県川崎市川崎区,07:00~22:30,07:00~22:30,07:00~22:30,07:00~22:30,044-200-0977,100,STARBUCKS/ docomo/ FLET'S(東)/ SoftBank/ au/ Wi2300
888,アトレ川崎店,神奈川県川崎市川崎区,10:00~21:00,10:00~21:00,10:00~21:00,10:00~21:00,044-221-6333,78,STARBUCKS/ docomo/ FLET'S(東)/ SoftBank/ au/ Wi2300
409,川崎 ラ チッタデッラ店,神奈川県川崎市川崎区,07:00~23:00,07:00~23:00,07:00~23:00,07:00~23:00,044-223-1570,94,STARBUCKS/ docomo/ FLET'S(東)/ SoftBank/ au/ Wi2300
343,川崎 丸井店,神奈川県川崎市川崎区,07:00~23:00,07:00~23:00,07:00~23:00,07:00~23:00,044-246-6765,41,
419,武蔵小杉北口店,神奈川県川崎市中原区,07:00~22:00,07:00~22:00,07:00~22:00,07:00~22:00,044-738-3137,33,STARBUCKS/ docomo/ FLET'S(東)/ SoftBank/ au/ Wi2300
1088,武蔵小杉東急スクエア店,神奈川県川崎市中原区,07:00~22:30,07:00~22:30,07:00~22:30,07:00~22:30,044-738-2350,60,STARBUCKS/ docomo/ FLET'S(東)/ SoftBank/ au/ Wi2300
697,ラゾーナ川崎店,神奈川県川崎市幸区,07:30~22:00,07:30~22:00,07:30~22:00,07:30~22:00,044-874-8359,58,STARBUCKS/ docomo/ FLET'S(東)/ SoftBank/ au/ Wi2300
809,Qiz溝の口店,神奈川県川崎市高津区,07:00~22:30,07:00