This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /*文字列"stressed"の文字を逆に(末尾から先頭に向かって)並べた文字列を得よ.*/ | |
| package main | |
| import ( | |
| "fmt" | |
| ) | |
| // RevString 与えられた文字列を逆順にして返す関数 | |
| func RevString(v string) string { | |
| // 引数の文字列をrune配列に変換 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| augroup MyAutoCmd | |
| if executable('pdftotext') | |
| " PDFファイルを開いた時、text形式に変換してから開く | |
| autocmd BufRead *.pdf :enew | 0read !pdftotext -layout -nopgbrk "#" - | |
| endif | |
| " 圧縮ファイルとPDFファイルを開いた時、readonlyモードで開き、j/kキーマップを変更 | |
| autocmd BufRead *.zip,*.gz,*.bz2,*.xz,*.pdf setlocal readonly nolist | |
| \| nn <buffer> j <C-E> | nn <buffer> k <C-Y> | |
| augroup END |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $ pdftogz -layout -nopgbrk "Sed & Awk 2nd Edition.pdf" | |
| # Sed & Awk 2nd Edition.gzが作成されます |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| # histgram | |
| # | |
| # Usage: | |
| # $ cat <(history 1) | awk '{print $2}' | ./hist.sh | head -20 | |
| # | |
| # Ref: | |
| # http://www.google.co.jp/url?q=https://qiita.com/kkdd/items/88581a2d04843c3c7ce7&sa=U&ved=0ahUKEwj56-To7c3fAhUOMt4KHXDnBU4QFggXMAA&usg=AOvVaw2ipKMrPVwtPbXKKyhzSKNV | |
| cat "$@" | sort | uniq -c | sort -k1nr | awk '{printf "%16s %4d\n",$2,$1;}' | |
| exit 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| pdftotext "somepdffile.pdf" - | apack "somepdffile.xz" - |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| # Catch local data as first argument, and ranking of words top | |
| # Usage: | |
| # | |
| # In shell, top 20 | |
| # $ cat *.sh | ./words-rank-local.sh 20 | |
| # | |
| # In vim commandline, top 5 | |
| # :new | r !cat *.sh | ./# 5 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Shell commends | |
| ```sh | |
| expac -HM '%m %n' | sort -n # display installed packages size | |
| ``` | |
| # Vim scripts | |
| ```vim | |
| :w !tweet.sh " 選択範囲をツイート投稿.depends https://github.com/ShellShoccar-jpn/kotoriotoko | |
| :w `=tempname()` | vim package % | cw " 現在のバッファの無名バッファを適当な名前で保存しながらpackageという文字列で検索してquickfix listに表示する |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python3 | |
| from itertools import takewhile | |
| # Fibonacci numbers module | |
| # <<自己紹介>> | |
| # フィボナッチ数列の出力 | |
| # fibに入れる数字までフィボナッチを出力 | |
| # <<使い方>> | |
| # fibo.fib(数字)←使えない | |
| # fibo.fib2(数字) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $(function ($){ | |
| // テーブルの入力フォームにインプットした際に発動 | |
| $('td input').on('input',function () { | |
| // name属性と入力フォームの値を取得 | |
| var inp = {name: $(this).attr('name'), | |
| value: $(this).val()}; | |
| console.log(inp); // 入力をjavascriptでコンソールに表示 | |
| inp = JSON.stringify(inp); | |
| $.post({ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def _read_tables(*files, **kwargs): | |
| """ Read general delimited files into DataFrame | |
| Super function of `pd.read_table()` | |
| """ | |
| return pd.DataFrame( | |
| {f: pd.read_table(f, **kwargs).squeeze() for f in files}) | |
| setattr(pd, 'read_tables', _read_tables) # pd.read_tables()として使えるようにする |