Skip to content

Instantly share code, notes, and snippets.

View shouhei's full-sized avatar

Shouhei shouhei

  • japan
View GitHub Profile
package main
import (
"os"
"text/template"
)
type Hoge struct {
Count int
Material string
@shouhei
shouhei / pre-commit.check.sh
Last active December 24, 2016 00:32
コミット前にブランチ名確認する君
#! /bin/sh
GIT_BRANCHES=`git branch | rev | cut -d ' ' -f1 | rev`
for BRANCH in $GIT_BRANCHES
do
if [[ $BRANCH =~ "-" ]]; then
printf "\e[31m$BRANCH does not keep naming rules.\e[m\n"
printf "\e[31mPlease check your branch naming.\e[m\n"
echo 'git branch -m $NEW $OLD'
exit 1
fi
@shouhei
shouhei / installgo.sh
Created June 12, 2016 07:25
golang をてけとーにインストールするやーつ
#! /bin/bash
## check requirements commands
which wget 1>/dev/null 2>/dev/null;
wget_res=$?
if [ $wget_res -eq 1 ];
then
echo -e "\033[0;31merror\033[0;39m"
echo "please install wget";
exit 1;
{
"outputs": [
{
"mode": {
"refreshRate": 60000,
"size": {
"height": 736,
"width": 1285
}
},
@shouhei
shouhei / read_csv.sh
Created March 29, 2016 08:33
phpでcsvを見るやーつ
#!/bin/bash
php -r '$file=new SplFileObject("./hoge.csv");while(!$file->eof()){var_dump($file->fgetcsv());}'
@shouhei
shouhei / mail.sh
Last active March 25, 2016 09:24
gmail send api | Gmailのapiでメールを送信するやーつ
#!/bin/zsh
CLIENT_ID=
CLIENT_SECRET=
CODE=
ACCESS_TOKEN=
REFRESH_TOKEN=
# @name get_token
# @params $1=client_id
@shouhei
shouhei / url_safe.sh
Last active March 25, 2016 06:51
url safe
echo $target | sed -e "s/\+/\_/" | sed -e "s/\//-/" | sed -e "s/\=/\./" | base64
@shouhei
shouhei / requirements.txt
Last active March 14, 2016 09:45
for sphinx
alabaster==0.7.7
argh==0.26.1
Babel==2.2.0
backports-abc==0.4
backports.ssl-match-hostname==3.5.0.1
certifi==2016.2.28
CommonMark==0.5.4
docutils==0.12
future==0.15.2
Jinja2==2.8
@shouhei
shouhei / find_method.py
Last active March 1, 2016 02:56
python でメソッドがあるかないかを探すやーつ
target = 'hoge'
print filter(lambda n: n.find('method_name')>1, dir(target))
@shouhei
shouhei / fis.sh
Last active February 29, 2016 11:34
zsh functions
function fis()
{
find . -name "*.$1" | xargs grep -n $2
}