Skip to content

Instantly share code, notes, and snippets.

#include<stdio.h>
int main(void) {
char hoge[5] = {'f', 'u', 'g', 'a', '\0'};
printf("%s\n", hoge);
return 0;
}
@atton
atton / password.hs
Created December 26, 2014 11:59
password.hs
import System.Random
import System.Environment
import Data.Maybe
main = do
arg <- getArgs
gen <- newStdGen
putStrLn $ fromMaybe "" $ listToMaybe arg >>= (return . (password gen) . read)
-- putStrLn . (password gen) $ fromMaybe 0 $ listToMaybe arg >>= return . read
-- putStrLn . (password gen) . read $ fromMaybe "0" $ listToMaybe arg
@atton
atton / ar.rb
Last active August 29, 2015 14:12
sinple emluate scoped module by refinements
#!/usr/bin/env ruby
class ActiveRecord
def save
puts 'ActiveRecord'
end
end
@atton
atton / Makefile
Created March 1, 2015 02:38
Escape Agda for LaTeX
# Settings
TARGET=escape_agda
SOURCES=$(wildcard *.agda)
SOURCES_FOR_TEX=$(subst .agda,.eagda,$(SOURCES))
# dependencies
$(TARGET).pdf : $(TARGET).dvi
dvipdfmx $<
@atton
atton / hash_keys.rb
Created March 18, 2015 12:53
hash keys
#!/usr/bin/env ruby
=begin
[30] pry(main)> a.class.ancestors
=> [Twitter::NullObject,
Twitter::NullObject::Customizations,
Comparable,
Twitter::NullObject::GeneratedMethods,
Naught::NullObjectTag,
Naught::Conversions,
@atton
atton / .pryrc
Last active January 4, 2016 19:53
crash logs pry-rails saved multibyte characters into history with rb-readline
Pry.history.instance_eval do
@saver = ->(line) { save_to_file (line.force_encoding(STDIN.external_encoding))}
end
@atton
atton / tmux-ambiguous-width-cjk.patch
Last active August 29, 2015 14:21 — forked from waltarix/tmux-do-not-combine-utf8.patch
Fix tmux character width of east asian ambiguous optimized for Ricty 3.2.4
diff --git a/utf8.c b/utf8.c
index 63723d7..05ae973 100644
--- a/utf8.c
+++ b/utf8.c
@@ -194,7 +194,193 @@ struct utf8_width_entry utf8_width_table[] = {
{ 0x10a05, 0x10a06, 0, NULL, NULL },
};
+/* Random order */
+struct utf8_width_entry utf8_cjkwidth_table[] = {
@atton
atton / dhcp.global
Created December 23, 2015 09:48
FreeRADIUS dhcp configuration example which supports multiple interfaces
server dhcp.ens6 {
listen {
type = dhcp
ipaddr = *
port = 67
interface = ens6
broadcast = yes
performance {
skip_duplicate_checks = yes
}
package main
import "fmt"
import "time"
func yo(c chan int) {
fmt.Printf("%d\n", <-c)
}
func main() {
c := make(chan int, 0) // dead lock
@atton
atton / 20160815_GuP.md
Last active August 14, 2016 10:45
ガルパン上映会日程

ガルパン上映会 in 611

時間 予定
13:00 - 15:15 TV版 1-6話
15:15 - 15:30 休憩
15:30 - 17:45 TV版 7-12話
17:45 - 18:30 OVA
18:30 - 19:30 晩御飯
19:30 - 21:30 劇場版