Skip to content

Instantly share code, notes, and snippets.

View tyabu12's full-sized avatar

Tomohito YABU tyabu12

  • Tokyo, Japan
View GitHub Profile
import readline
import sqlite3
def print_row(row):
print('(' + ', '.join(str(_) for _ in row) + ')')
conn = sqlite3.connect(':memory:')
c = conn.cursor()
while True:
@tyabu12
tyabu12 / isucon8-qualifier-bench.sh
Last active July 27, 2019 05:21
ISUCON 8予選の vagrant からベンチ投げるスクリプト
#!/bin/bash
# 初回のみ
git clone --depth 1 https://github.com/matsuu/vagrant-isucon
cd vagrant-isucon/isucon8-qualifier
vagrant up bench
# ホストアドレスをカンマ区切りで指定
IMAGE_HOST_IP="XXX.XXX.XXX.XXX,XXX.XXX.XXX.XXX"
@tyabu12
tyabu12 / vlc_gen_thumbnails.sh
Last active December 21, 2018 15:10
Thumbnails generator script using VLC.
#!/bin/bash
VLC="vlc -I dummy"
TARGET_DIR="movies"
THUMBNAIL_DIR="movies/thumbnails"
THUMBNAIL_FMT="jpg"
set -eux
gen_options() {
@tyabu12
tyabu12 / cloudSettings
Last active March 5, 2022 13:56
Visual Studio Code Settings Sync Gist
{"lastUpload":"2022-03-05T13:56:10.268Z","extensionVersion":"v3.4.3"}
@tyabu12
tyabu12 / Vagrantfile
Last active November 28, 2018 05:47
A Vagrantfile to create Debian stretch with Docker.
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure("2") do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
@tyabu12
tyabu12 / isucon6-qualifier-bench.sh
Last active July 15, 2019 01:23
ISUCON6 予選 で vagrant からベンチ投げるスクリプト
#!/bin/bash
# 初回のみ
git clone --depth 1 https://github.com/matsuu/vagrant-isucon
cd vagrant-isucon/isucon6-qualifier
vagrant up bench
IMAGE_HOST_IP="XXX.XXX.XXX.XXX"
vagrant ssh bench -c "sudo -u isucon sh -c 'cd /home/isucon/isucon6q; ./isucon6q-bench -target $IMAGE_HOST_IP'"
@tyabu12
tyabu12 / upload_to_vagrant_cloud.sh
Last active November 4, 2022 07:46
Vagrant cloud upload script.
#!/bin/bash
USERNAME="CHANGE ME"
PROVIDER_NAME="virtualbox"
ACCESS_TOKEN="CHANGE ME"
set -eu
if [ $# -ne 3 ]; then
cat <<_EOT_
@tyabu12
tyabu12 / pixiv-isucon2016-bench.sh
Last active July 15, 2019 01:23
pixiv-isucon2016 で vagrant からベンチ投げるスクリプト
#!/bin/bash
# 初回のみ
git clone --depth 1 https://github.com/tyabu12/vagrant-pixiv-isucon2016.git
cd vagrant-pixiv-isucon2016
vagrant up bench
IMAGE_HOST_IP="XXX.XXX.XXX.XXX"
vagrant ssh bench -c "sudo -u isucon sh -c '/opt/go/bin/benchmarker -t http://$IMAGE_HOST_IP -u /opt/go/src/github.com/tyabu12/private-isu/benchmarker/userdata'"
@tyabu12
tyabu12 / isucon7-qualifier-bench.sh
Last active July 15, 2019 01:23
ISUCON7 予選 で vagrant からベンチ投げるスクリプト
#!/bin/bash
# 初回のみ
git clone --depth 1 https://github.com/matsuu/vagrant-isucon
cd vagrant-isucon/isucon7-qualifier
vagrant up bench
# ホストアドレスをカンマ区切りで指定
IMAGE_HOST_IP="XXX.XXX.XXX.XXX,XXX.XXX.XXX.XXX"
@tyabu12
tyabu12 / extract_img_isucon7_qualify.go
Last active July 9, 2019 11:40
ISUCON7 予選で DB から画像データをぶっこ抜いてくるコード ʕ◔ϖ◔ʔ
package main
import (
"flag"
"fmt"
"log"
"os"
"time"
_ "github.com/go-sql-driver/mysql"