Skip to content

Instantly share code, notes, and snippets.

@ksomemo
ksomemo / fold_length.hs
Last active December 18, 2015 01:39
foldによるリストの長さを求めるためのメモ
foldr (+) 4 [1, 2, 3] -- 1 + (2 + (3 + 4)) == 10
foldl (+) 1 [2, 3, 4] -- ((1 + 2) + 3) + 4 == 10
1 + (2 + (3 + 4))
(+) 1 (2 + (3 + 4))
(+) 1 ((+) 2 ((+) 3 4))
((1 + 2) + 3) + 4
(+) ((1 + 2) + 3) 4
#!/bin/sh
FILES=`find $1 -name \*.php`
for file in $FILES
do
php -l $file
done
@ksomemo
ksomemo / lint_php_files_with_xargs.sh
Created June 11, 2013 05:24
lint php files with xargs (parallel)
find dir -name '*.php' -print0 | xargs -0 -n1 -P8 php -l
@ksomemo
ksomemo / ajaxPolling.js
Created June 15, 2013 07:08
jQueryのajaxによるポーリング
var totalCount = 0;
var interval = 30000;
var delay = 3500;
var eachInterval = 1500;
function ajaxPolling(){
$.ajax({
url: "target url"
success:function(data){
var eachCount = 0;
@ksomemo
ksomemo / sum_from_num_text.sh
Last active August 11, 2017 05:11
1行に数値のみを記載されたテキストの合計値を出力する
#!/bin/sh
sum=0
while read line
do
sum=`expr $sum + $line`
done < num.txt
@ksomemo
ksomemo / tortoiseProcUpdate.bat
Created June 24, 2013 07:39
TortoiseSVNでUpdate後に、ディレクトリの調整
@ECHO OFF
set baseDir="C:\baseDir"
echo %baseDir%
TortoiseProc /command:update /path:%baseDir%
set RESULT=%ERRORLEVEL%
@ksomemo
ksomemo / Jenkins_plugin_list.txt
Created June 25, 2013 05:45
Jenkins plugin list
Ant Plugin
Build Trigger Badge Plugin
Credentials Plugin
CVS Plugin
External Monitor Job Type Plugin
Javadoc Plugin
Jenkins GIT client plugin
Jenkins GIT plugin
Jenkins Multiple SCMs plugin
Jenkins Phing plugin
@ksomemo
ksomemo / svn_commit_symbolic_link.sh
Created June 28, 2013 07:27
svnで対象をsymbolic linkに変更した際のcommit方法
@ksomemo
ksomemo / gist-h-command.txt
Created November 2, 2013 19:11
gist -h | gist -f gist-h-command.txt -d this.
Gist (v4.1.1) lets you upload to https://gist.github.com/
The content to be uploaded can be passed as a list of files, if none are
specified STDIN will be read. The default filename for STDIN is "a.rb", and all
filenames can be overridden by repeating the "-f" flag. The most useful reason
to do this is to change the syntax highlighting.
If you'd like your gists to be associated with your GitHub account, so that you
can edit them and find them in future, first use `gist --login` to obtain an
Oauth2 access token. This is stored and used by gist in the future.
REPO_DIR=git-pack-gc
LINE_NUM=100000 #000
FILE_NAME=numbers.txt
GIT_OBJECTS_DIR='.git/objects'
echo "mkdir and git init"
mkdir ${REPO_DIR}
cd ${REPO_DIR}
git init