Skip to content

Instantly share code, notes, and snippets.

View K-atc's full-sized avatar
:octocat:
Octocatic Days

K_atc K-atc

:octocat:
Octocatic Days
View GitHub Profile
@K-atc
K-atc / hoge.txt
Created September 5, 2015 02:58
python キーボード入力しているかのように文字列を出力する@for文禁止
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure
dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
@K-atc
K-atc / .bashrc
Created August 14, 2015 11:47
[ubuntu] .bashrc
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
@K-atc
K-atc / binary_search.py
Created August 2, 2015 06:12
ソートアルゴリズム&探索アルゴリズム
# -*- coding: utf-8 -*-
import sys
def binary_search(list, n):
imin = 0
imax = len(list)
while True:
i = (imin + imax) / 2
print "%d < %d < %d" % (imin, i, imax)
if list[i] == n:
@K-atc
K-atc / Readme.md
Created July 8, 2015 16:52
Whitespace Parser

Whitespace Parser

  • -p オプション必須
  • プログラムは暫定的
@K-atc
K-atc / tateyomi.py
Created July 4, 2015 21:18
縦読み
# coding: UTF-8
import sys
if not(len(sys.argv) >= 2):
print "tateyomi: 縦読みしてくれるプログラム"
print "usage: python tateyomi.py <file> [<offset>]"
exit()
offset = 0
if len(sys.argv) > 2:
@K-atc
K-atc / uudecode.py
Created July 4, 2015 16:48
uudecode
import uu
import sys
if not(len(sys.argv) >= 2):
print "uudecode: "
print "usage: python uudecode.py <file>"
exit()
uu.decode(sys.argv[1], sys.stdout)
@K-atc
K-atc / onion_base64decode.py
Created July 4, 2015 16:48
onion Base64 decode
# -*- coding: utf-8 -*-
import sys
import base64
if not(len(sys.argv) >= 3):
print "onion Base64 decoder: "
print "usage: python onion_base64decode.py <Base64 encoded file> <n>"
exit()
f = open(sys.argv[1], 'r')
@K-atc
K-atc / rot13.py
Created July 4, 2015 09:59
ROT13
# -*- coding: utf-8 -*-
import sys
if not(len(sys.argv) >= 2):
print "ROT13: アルファベットを一文字毎に13文字後のアルファベットに置き換えるプログラム"
print "usage: python rot13.py <cipher-text file>/<plain-text file>"
exit()
filename = sys.argv[1]
@K-atc
K-atc / bg-job.rb
Created May 17, 2015 14:46
特定のタスクをバックグラウンド実行し、好きなタイミングで終了するRubyスクリプト
# coding: utf-8
# $ cat ./hoge.sh
# #!/bin/bash
# while true; do
# date; sleep 1
# done
cmd = "sh ./hoge.sh"
pid = Process.spawn cmd, STDOUT=>STDOUT
@K-atc
K-atc / Main.c
Last active August 29, 2015 14:19
#include <stdio.h>
#define SHARP_OP_TEST(expr) (printf("#expr = %s, expr = %d\n", #expr, (expr)) )
#define var(i) printf("var" #i " = %d\n" , var ## i)
#define CONBINE(a, b) (printf("%s\n", a##b))
int main(void){
const char test[] = "This is test";
int var1 = 10;
SHARP_OP_TEST(1+2);