Skip to content

Instantly share code, notes, and snippets.

@tbutts
tbutts / tmux-migrate-options.py
Last active February 29, 2024 08:11
For tmux configs: Merge deprecated/removed -fg, -bg, and -attr options into the -style option
#!/usr/bin/env python
# vim: set fileencoding=utf-8
#
# USAGE:
# Back up your tmux old config, run the script and redirect stdout to your conf
# file. Example:
#
# $ cp ~/.tmux.conf ~/.tmux.conf.orig
# $ python ./tmux-migrate-options.py ~/.tmux.conf.orig > ~/.tmux.conf
#
@hoto17296
hoto17296 / app.py
Created September 6, 2017 10:53
Nginx + uWSGI + Flask on Amazon Linux
from flask import Flask
application = Flask(__name__)
@application.route("/")
def hello():
return "Hello World!"
@denkiwakame
denkiwakame / cn.md
Last active January 19, 2022 07:25
苗字変わった

※ 2016年11月時点の内容です. 各市町村, 金融機関ごとに規定が異なるので必ず確認してください

① はんこ屋

  • 認印をすぐ買う
    • 旧姓・新姓の認印が両方入る印鑑ケースが便利. がま口系が丁度2本収納できる.
  • 銀行印は金融機関によって旧姓使用可のところがあるが, 変更した方が良い. 受取は2営業日〜7営業日後.
  • 苗字変わる予定がある婿or嫁はもともと認印・銀行印ともに下の名前で作った方が良い.

② 役所

住民票・税証明カード

#define FOR(i, b, e) for (typeof(e) i = (b); i < (e); ++i)
// for arrays
#define arrsz(a) ( sizeof(a) / sizeof(a[0]) )
#define darr(a) if (opt_debug) { copy( (a), (a) + arrsz(a), ostream_iterator<int>(cerr, " ") ); cerr << endl; }
#define darr2(a) if (opt_debug) { FOR(__i, 0, (arrsz(a))){ darr( (a)[__i] ); } }
// for vectors
#define ALL(a) (a).begin(), (a).end()
#define dvec(v) if (opt_debug) { copy( ALL(v), ostream_iterator<int>(cerr, " ") ); cerr << endl; }
@cocodrips
cocodrips / CODERUNNER_Cluster
Last active August 29, 2015 14:10
CodeRunner 予選Bの敵の属性をK-meansで分類したやつ
0 : ( 24 48 68 73 74 89 99 )
1 : ( 20 34 46 47 54 71 78 )
2 : ( 6 13 14 16 23 25 28 29 30 37 41 43 50 51 53 55 58 59 60 61 65 66 69 70 72 75 79 83 84 85 86 88 90 92 94 97 )
3 : ( 1 7 15 26 33 36 38 64 76 80 81 91 96 100 )
4 : ( 3 17 35 44 45 52 67 77 )
5 : ( 9 10 21 27 87 )
6 : ( 4 62 82 95 98 )
7 : ( 5 18 31 39 40 56 )
8 : ( 8 12 22 32 42 57 63 )
9 : ( 2 11 19 49 93 )
@finaiized
finaiized / union-find.py
Created June 15, 2014 03:04
Implements various algorithms for union find, based on Algorithms, Part I
class QuickFind(object):
"""
Implements the quick find algorithm for the dynamic connectivity problem
Cost model (in array read/writes):
Initialization: N
Union: N
Find: 1
Algorithm:
anonymous
anonymous / gist:8079281
Created December 22, 2013 07:00
function google() {
local str opt
if [ $# != 0 ]; then # 引数が存在すれば
for i in $*; do
str="$str+$i"
done
str=`echo $str | sed 's/^\+//'` #先頭の「+」を削除
opt='search?num=50&hl=ja&ie=euc-jp&oe=euc-jp&lr=lang_ja'
opt="${opt}&q=${str}"
fi
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import csv
import codecs
import numpy as np
import MeCab
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.cluster import KMeans, MiniBatchKMeans
@rike422
rike422 / gist:7096675
Created October 22, 2013 07:48
casper.js使い方

casper.jsとは

CasperJS is an open source navigation scripting & testing utility written in Javascript for the PhantomJS WebKit headless browser and SlimerJS (Gecko). It eases the process of defining a full navigation scenario and provides useful high-level functions, methods & syntactic sugar for doing common tasks such as:

参考資料

コマンド

@Shinpeim
Shinpeim / 00.md
Last active January 16, 2020 13:08
Scala 入学式の資料

Better Java としての Scala

Hello World

  • src/main/scala/Main.scala
object Main {
  def main(args: Array[String]): Unit = {
    println("hello scala!")