Skip to content

Instantly share code, notes, and snippets.

View rhysd's full-sized avatar
🐕
Fixing an off-by-wan error

Linda_pp rhysd

🐕
Fixing an off-by-wan error
View GitHub Profile
@rhysd
rhysd / openhash.rb
Created June 4, 2011 18:50
practice for Ruby.
#! /usr/local/bin/ruby
class OpenHash
def initialize elems,f = ->(ob){ return ob.hash}
@hashf = f
@val = { }
elems.each do |elem|
insert elem
end
@rhysd
rhysd / oulogin
Created June 11, 2011 14:31
Osaka-u Wireless LAN Login
#! /usr/local/bin/ruby
# -*- coding: utf-8 -*-
Profile = "/.oulogin_profile"
require 'mechanize'
require 'rubygems'
idx = ARGV.index "-help"
if idx != nil
@rhysd
rhysd / .vimrc
Created October 11, 2011 15:33
my vim setting
let mapleader = ','
syntax on
"行番号表示
set number
"バックアップファイルいらない
set nobackup
"vi協調モードoff
set nocompatible
"自動インデント
@rhysd
rhysd / LINDA_PP_quine.rb
Created November 10, 2011 23:47
AA-Quine
eval($q= "$q='eva l($q=% p.split *%p)'%[$q,'' ];$o= 0;(m=%q_efg!q !+b<b/tj{f/uj
nft|}j }u>b\\ j^<qsj ou)j& 3>>1@(!(+u;% r\\%p-u ^*<%p,>u!jg)j &3>>2*~<qvut<
foe_ ).si ze.tim es{| i|m[ i]-= 1};eval(m );p( 0,8, 14,8 ,4,6
,4,7 ,4,1 2,15,5, 36,1 3,6, 13); p(1, 6,16 ,6,6 ,6,4 ,5,6 ,12,
13,7 ,36, 13,6 ,13 );p( 2,4, 18,4 ,8,6 ,3,4 ,8,4,4,4,11, 9,36,4,5,4,6
,4,5 ,4); p(2, 4,18,4, 8,7, 2,4, 8,4,5,4,9,4,3,4 ,35,4,5,4,6 ,4,5,4);p(2
,4,1 8,4, 8,4, 1,3,1, 4,8, 4,5, 4,8,4,
@rhysd
rhysd / .vimrc
Created December 11, 2011 07:34
Emacs信者向け.vimrc
:qa!
@rhysd
rhysd / make_array.hpp
Created February 23, 2012 18:38
make_array
template <
class... Args,
class Result = std::array<
typename std::decay<typename std::common_type<Args...>::type>::type,
sizeof...(Args)
>
>
inline Result make_array(Args &&... args)
{
return Result{{ std::forward<Args>(args)... }};
@rhysd
rhysd / hoge.cpp
Created May 3, 2012 16:38
Preprocess-time stdin
#include <iostream>
int main()
{
char str[] = ""
#include "/dev/tty"
"";
std::cout << str << std::endl;
@rhysd
rhysd / examples.rb
Last active October 4, 2015 07:58
Examples for Yahoo Japanese Analysis Library
require 'yahoo-japanese-analysis'
# use module's class methods directly
# configration
YahooJA.configure do |config|
config.app_key = 'your appid'
end
# "日本語形態素解析" API
#include <vector>
#include <algorithm>
template<class T>
class sorter_base{
public:
sorter_base(std::vector<T> const& values_) : values(values_){}
void set_values(std::vector<T> const& values_)
{
values = values_;
@rhysd
rhysd / euler1.rb
Created May 12, 2012 19:59
euler 1
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-
MAX = 1000-1
def f(i)
(1..(MAX/i)).map{|n| n*i }.inject 0,&:+
end
#