Skip to content

Instantly share code, notes, and snippets.

@yawara
yawara / caesar.py
Created July 13, 2016 14:39
Caesar Crypto
import string
def caesar(plaintext, shift):
alphabet_lower = string.ascii_lowercase
alphabet_upper = string.ascii_uppercase
alphabet = alphabet_lower + alphabet_upper
shifted_alphabet = alphabet_lower[shift:] + alphabet_lower[:shift] + alphabet_upper[shift:] + alphabet_upper[:shift]
table = str.maketrans(alphabet, shifted_alphabet)
return plaintext.translate(table)
@yawara
yawara / btsync.conf
Created June 27, 2016 22:51
upstart init script for btsync
description "BitTorrent Sync"
author "Yawara ISHIDA"
start on filesystem or runlevel [2345]
stop on shutdown
script
CONFIG="/etc/btsync/btsync.conf"
BTSYNC="/usr/lib/btsync-core/btsync"
exec su ywr -c "$BTSYNC --nodaemon --config $CONFIG"
@yawara
yawara / file0.txt
Created January 27, 2016 18:31
Debian 7 WheezyにCUDA 7.5をインストールする。 ref: http://qiita.com/yawara/items/a2eef8f9074f0a1e4261
> cat /etc/issue
Debian GNU/Linux 7 \n \l
> uname -a
Linux debian 3.2.0-4-amd64 #1 SMP Debian 3.2.73-2+deb7u2 x86_64 GNU/Linux
@yawara
yawara / file0.txt
Created January 27, 2016 09:38
メモ:iPython3でreloadを有効にする。 ref: http://qiita.com/yawara/items/5c9f1190080644dd9816
In [1]: %load_ext autoreload
In [2]: %autoreload 2
In [3]: from foo import some_function
In [4]: some_function()
Out[4]: 42
In [5]: # foo.pyを開いてsome_functionが43を返すように変更すると
@yawara
yawara / file0.txt
Created January 27, 2016 09:24
MacOSXにOpenJTalkを導入する。 ref: http://qiita.com/yawara/items/fe165636847b18e51def
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
@yawara
yawara / graph-tool.rb
Last active August 29, 2015 14:24 — forked from jiayun/graph-tool.rb
require 'formula'
class GraphTool < Formula
homepage 'http://graph-tool.skewed.de/'
url 'http://downloads.skewed.de/graph-tool/graph-tool-2.2.31.tar.bz2'
sha1 '5e0b1c215ecd76191a82c745df0fac17e33bfb09'
head 'https://github.com/count0/graph-tool.git'
depends_on 'pkg-config' => :build
depends_on 'boost' => 'c++11'
@yawara
yawara / hello.sh
Last active August 29, 2015 14:18
hello
<!DOCTYPE html>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<html>
<body>
#!/bin/bash
echo "Hello, world"
touch "~/Desktop/$(date)"
</body>
</html>
@yawara
yawara / nohw.c
Last active August 29, 2015 14:18
No Hello World
#include <stdio.h>
int main(void)
{
FILE* fp_out = freopen("/dev/null", "w", stdout);
FILE* fp_err = freopen("/dev/null", "w", stderr);
printf("Hello, world!\n");
fclose(fp_out);
fclose(fp_err);
return 0;
#!/usr/bin/env python
import itertools
import requests
from requests.auth import HTTPBasicAuth
az = [chr(i) for i in range(ord('a'), ord('z')+1)]
AZ = [chr(i) for i in range(ord('Z'), ord('Z')+1)]
nums = [str(i) for i in range(10)]
@yawara
yawara / myip.sh
Created March 6, 2015 18:04
getting my ip
#!/bin/bash
echo $(curl http://www.cman.jp/network/support/go_access.cgi 2>/dev/null | grep '\([0-9]\{1,3\}\.\)\{3\}' | gsed -e 's/.*[^0-9]\([0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{3\}\).*/\1/' | head -n 1)