Skip to content

Instantly share code, notes, and snippets.

View hoto17296's full-sized avatar

Yuki Ishikawa hoto17296

View GitHub Profile
@hoto17296
hoto17296 / Rakefile
Created May 14, 2014 00:26
Jekyllでブログを書くのが楽しくなるRakefile
EDITOR = 'vim'
namespace :blog do
desc '新しいエントリを作成'
task :new, [:title] do |task, args|
raise 'Usage: rake blog:new[title]' if args.title.nil?
date = Time.now.strftime("%Y-%m-%d")
file = "_posts/#{date}-#{args.title}.md"
raise file + ' is already exist.' if File.exist?(file)
@hoto17296
hoto17296 / deploy.sh
Last active August 29, 2015 14:13
デプロイツールを使う程でもないときの git pull するだけのデプロイスクリプト
#!/bin/sh
TARGET='staging'
APPDIR='~/app'
BRANCH='master'
while getopts :bdt: OPT
do
case $OPT in
'b' ) BRANCH="$OPTARG" ;;
@hoto17296
hoto17296 / 強くてニューゲーム
Last active December 23, 2015 05:29
Cookie Clicker
MS4wMzZ8fDEzNzkzNzE4NDc4NjZ8MTExMTExfDI5MjA2MTE5MTg4OzcwNzA5MTMwMDg3MzsyNzs3Nzk0OzI3OzQ4Oy0xOy0xOzE3ODUxNDA2OTEyMTY3NDkzMDA7MDswOzA7MDswfDAsMTEsMTE4LDA7MTQ4LDE0OCwzNzk0NDg1MCwwOzE1LDMwLDc5OTA1LDA7MTUsMzAsMzk2NTA1LDA7MTUsMTUsMTU3NzYxNywwOzE1LDE1LDM4MTU5OTYsMDsxNSwxNSwxNTI0MTMwNiwwOzE1LDE1LDI1MjIxMjEwOSwwOzE1LDE1LDM3MDI1NjE1NzcsMDsxNSwxNSwzNzQyNDIyOTI0MCwwO3wzMDAyMzk5NzUxNTY5NDUxOzIyNTIzOTUzODI0ODM2Mjc7MjI1MTgwMDg4NzQwNTIxNzsyODE0NzQ5Nzc1NTA1NDA5OzY1NTc1NXw0NTAzNTk5NjI3MzcwNDk1OzE3NTkyMTgzOTQ3MjYz%21END%21
@hoto17296
hoto17296 / texc
Last active December 27, 2015 16:39
texコンパイルしてpdf作って開く一連の動作をまとめた
#!/bin/sh
error(){ echo "Error: $1" 1>&2 && exit 1; }
if [ $# -eq 0 ]; then error 'Too few arguments.'; fi
if [ $# -gt 2 ]; then error 'Too many arguments.'; fi
clean()
{
echo 'Clean:'
if [ $# -eq 0 ]
@hoto17296
hoto17296 / snowfall.css
Last active December 31, 2015 17:19
こなああああああゆきいいいいいい ねぇ!!!
@charset "utf-8";
/* labelと:checked擬似クラスで擬似onClick実装 */
#snowfall label {
font-size: xx-large;
fon-weight: bold;
color: #fff;
background-color: #99f;
padding: .5em 1em;
margin: 1em 0;
@hoto17296
hoto17296 / server.sh
Created January 12, 2017 03:57
全てのサーバに対して一括操作をするためのコマンド群
#!/bin/bash -eu
PRODUCTNAME-help() {
echo -e "usage: PRODUCTNAME <command> [<args>]\n"
echo -e "commands:"
echo -e " hosts サーバ一覧を表示"
echo -e " git-log-remote [<hosts>] デプロイされていない差分コミットがあれば表示"
echo -e " check-update [<hosts>] yum パッケージの更新を表示"
echo -e " update [<hosts>] yum パッケージを更新"
echo
@hoto17296
hoto17296 / iptables
Last active January 27, 2017 03:48
NAT + ロードバランサ + 踏み台 サーバ
*nat
:PREROUTING ACCEPT [0:0]
:INPUT ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
:POSTROUTING ACCEPT [0:0]
-A POSTROUTING -s 10.0.0.0/16 -o eth0 -j MASQUERADE
COMMIT
@hoto17296
hoto17296 / thread.py
Created July 18, 2017 10:26
Python で マルチスレッド + イベントループ2本
import logging
import asyncio
from threading import Thread
logging.basicConfig(format='%(threadName)s:%(message)s', level=logging.INFO)
logger = logging.getLogger()
async def hello():
while True:
logger.info('Hello')
@hoto17296
hoto17296 / client.py
Last active July 31, 2017 11:46
Python 3 標準モジュールで HTTP + numpy array をやりとり
from http.client import HTTPConnection
import numpy as np
# GET
conn = HTTPConnection('', 8080)
conn.request('GET', '/')
res = conn.getresponse()
conn.close()
print(res.status)
@hoto17296
hoto17296 / tensorboard.sh
Created August 1, 2017 10:11
Docker イメージ内の TensorBoard を操作するスクリプト
#!/bin/bash -u
image_name=docker_image_name
tb_container_name=tensorboard
port=6006
app_root=$(cd $(dirname $0)/..; pwd)
show_help() {
echo "Usage: bin/tensorboard (start|stop|restart|status)"