Skip to content

Instantly share code, notes, and snippets.

View tsuyoshicho's full-sized avatar

Tsuyoshi CHO tsuyoshicho

View GitHub Profile
@tsuyoshicho
tsuyoshicho / sum_one_to_ten.py
Last active August 29, 2015 14:21
お題「数字を使わずに、1から10まで和を、出力するコードを書いてください」
#!env python
#-*- coding: utf-8 -*-
# see http://togetter.com/li/821309
import sys
length = len('ABCDEFGHIJK')
print sum(range(length))
@tsuyoshicho
tsuyoshicho / sum_one_to_ten2.py
Last active August 29, 2015 14:22
お題「数字を使わずに、1から10まで和を、出力するコードを書いてください」 part 2
#!env python
#-*- coding: utf-8 -*-
# see http://togetter.com/li/821309
import sys
print sum(range(ord('L') - ord('A')))
# Solarized - PuTTY settings ini version
# https://github.com/altercation/solarized
# https://github.com/altercation/solarized/blob/master/putty-colors-solarized/solarized_dark_puttytray.txt
# https://github.com/altercation/solarized/blob/master/putty-colors-solarized/solarized_light_puttytray.txt
# http://blog.remora.cx/2012/10/let-us-use-solarized.html
# # normal
# Colour0="187,187,187"
# Colour1="255,255,255"
# Colour2="0,0,0"
@tsuyoshicho
tsuyoshicho / sakura_keyword_csharp.kwd
Last active January 10, 2019 01:07 — forked from pinzolo/gist:2970346
https://gist.github.com/pinzolo/2970346 からfork。ファイル名をまず設定
// C# キーワード定義ファイル
// CASE=True
#endif
#endregion
#if
#pragma
#region
abstract
as
@tsuyoshicho
tsuyoshicho / solarized dark.col
Created June 19, 2015 03:50
サクラエディタ Solarized カラー from http://sakura.qp.land.to/?Customize%2F%C5%EA%B9%C6%2F76 (Solarizedもどきcolファイル雛形用コメント付き) light/dark作成(オリジナルはdark)
; テキストエディタ色設定 Ver3
; C[XXX]=on/off,bold,BBGGRR,BBGGRR,underline ;
; SOLARIZED HEX 16/8 TERMCOL XTERM/HEX L*A*B sRGB HSB ;
; --------- ------- ---- ------- ----------- ---------- ----------- ----------- ;
; base03 #362b00 8/4 brblack 234 #1c1c1c 15 -12 -12 0 43 54 193 100 21 ;
; base02 #423607 0/4 black 235 #262626 20 -12 -12 7 54 66 192 90 26 ;
; base01 #756e58 10/7 brgreen 240 #4e4e4e 45 -07 -07 88 110 117 194 25 46 ;
; base00 #837b65 11/7 bryellow 241 #585858 50 -07 -07 101 123 131 195 23 51 ;
; base0 #969483 12/6 brblue 244 #808080 60 -06 -03 131 148 150 186 13 59 ;
; base1 #a1a193 14/4 brcyan 245 #8a8a8a 65 -05 -02 147 161 161 180 9 63 ;
@tsuyoshicho
tsuyoshicho / Ideone
Last active October 7, 2017 03:56
重複しない乱数配列(Java版/コレクション活用?版) ref: http://qiita.com/tsuyoshi_cho/items/2c10819b9f667e41dfe2
import java.util.HashSet;
import java.util.ArrayList;
import java.util.Random;
class MakeRandomArray {
public ArrayList<Integer> makeRandomArray(ArrayList<Integer> array, Random rand, int arraySize, int randMax, int randMin){
HashSet<Integer> set = new HashSet<>(arraySize);
for(int i = 1; i <= arraySize; i++){
set.add(random(rand, randMax, randMin));
}
[status]
# http://qiita.com/tettekete/items/7019bf7d1bfa883d8549
showuntrackedfiles = no
@tsuyoshicho
tsuyoshicho / file0.txt
Last active January 9, 2017 02:32
シェルスクリプトでのLTSV出力イディオム ref: http://qiita.com/tsuyoshi_cho/items/4371c94e4e86b8406053
#!/bin/bash
cat << EOS | tr '\n' '\t' | sed -e 's/\t*$//' >> ${log}
name:${app}
time:$(date --iso-8601=seconds)
pid:$$
args:"${*}"
EOS
echo "" >> ${log}
@tsuyoshicho
tsuyoshicho / ssh-select.bat
Last active March 3, 2019 11:22
sshのconfigからpeco/fzfでssh login(n番煎じ) ref: https://qiita.com/tsuyoshi_cho/items/0dc8973d4becf6f2d784
@echo off
sh %~dp0ssh-select.sh %*
@tsuyoshicho
tsuyoshicho / notify-maker.sh
Last active February 24, 2018 09:44
コンソールやシェルスクリプトからのメッセージ通知(日本語OK) ref: https://qiita.com/tsuyoshi_cho/items/a22d895ed67221b8e32e
#!/bin/bash
# Event check
event="$1"
if [ -z "${event}" ];then
# fail
exit 1
fi
# Key