Skip to content

Instantly share code, notes, and snippets.

View utisam's full-sized avatar

Masatoshi Tsushima utisam

View GitHub Profile
@utisam
utisam / _nkf
Created December 13, 2015 08:11
Zsh Completion of nkf
#compdef nkf
arguments=(
"(-j -e -s -w -w80 -w8 -w16 -w16B0 -w16B -w16L -w16L0)-j[JIS コードを出力する。(デフォルト)]"
"(-j -e -s -w -w80 -w8 -w16 -w16B0 -w16B -w16L -w16L0)-e[EUC コードを出力する。]"
"(-j -e -s -w -w80 -w8 -w16 -w16B0 -w16B -w16L -w16L0)-s[Shift_JIS コードを出力する。]"
"(-j -e -s -w -w80 -w8 -w16 -w16B0 -w16B -w16L -w16L0)"{-w,-w80}'[UTF8 コードを出力する。 (BOM 無し)]'
"(-j -e -s -w -w80 -w8 -w16 -w16B0 -w16B -w16L -w16L0)-w8[UTF8 コードを出力する。]"
"(-j -e -s -w -w80 -w8 -w16 -w16B0 -w16B -w16L -w16L0)"{-w16,-w16B0}'[UTF16 コードを出力する。 (Big Endian / BOM 無し)]'
"(-j -e -s -w -w80 -w8 -w16 -w16B0 -w16B -w16L -w16L0)-w16B[UTF16 コードを出力する。 (Big Endian / BOM 有り)]"
@utisam
utisam / _cookiecutter
Created December 13, 2015 08:10
Zsh Completion of Cookiecutter
#compdef cookiecutter
_arguments -s -S\
{-V,--version}"[Show the version and exit.]"\
"--no-input[Do not prompt for parameters and only use cookiecutter.json file content]"\
{-c,--checkout}"[branch, tag or commit to checkout after git clone]:TEXT"\
{-v,--verbose}"[Print debug information]"\
"--replay[Do not prompt for parameters and only use information entered previously]"\
{-f,--overwrite-if-exists}"[Overwrite the contents of the output directory if it already exists]"\
{-o,--output-dir}"[Where to output the generated project dir into]:output directory:_files"\
@utisam
utisam / cpp.xml
Created January 8, 2015 20:02
gedit snippets for boost Test
<snippet>
<text><![CDATA[BOOST_WARN(${1:predicate});
$0]]></text>
<tag>WARN</tag>
<description>BOOST_WARN</description>
</snippet>
<snippet>
<text><![CDATA[BOOST_WARN_BITWISE_EQUAL(${1:left}, ${2:right});
$0]]></text>
<tag>WARN_BITWISE_EQUAL</tag>
@utisam
utisam / vienc
Created April 11, 2014 03:11
Edit a AES-encrypted text file
#!/usr/bin/env python3
#-*- coding:utf-8 -*-
from Crypto.Cipher import AES
import argparse
import base64
from getpass import getpass
import os
import shutil
import subprocess
import sys
@utisam
utisam / init_array.cpp
Created November 7, 2013 22:24
g++ ... NG clang++ ... OK
#include <array>
#include <iostream>
using namespace std;
int main () {
array<int, 3> a({1, 2, 3});
for (int i = 0; i < a.size(); i++)
cout << a[i] << endl;
return 0;
}
@utisam
utisam / urls.py
Created June 16, 2012 04:21
Django AJAX views.py
from django.conf.urls import patterns, include, url
urlpatterns = patterns('',
url(r'^$', 'ajax.views.home', name='home'),
url(r'^data/', 'ajax.views.data', name='data'),
)