Skip to content

Instantly share code, notes, and snippets.

@valvallow
valvallow / b.sh
Last active March 19, 2019 02:05
seq 0 99 | sed -e 's/.*/□/g' -e "1,$(echo $(date +%j)/3.65 | bc)s/.*/■/g" | tr '\n' ' ' | tr -d ' ';echo $(date +%j)/3.65 | bc | sed -e 's/^/ /g' -e 's/$/%/g'
$ date +%j | awk '{len=int($1/3.65);for(i=0;i<len;i++)printf "%c", "X";printf"\n%d%%",len}'
@ECHO OFF
REM 今日の日付
SET today=%DATE:~-10,4%%DATE:~-5,2%%DATE:~-2%
REM イベントログコード4800=ログオフ, 4801=ログオンのイベントログを取得
WMIC NTEVENT WHERE "(logfile='security' AND (eventcode='4800' or eventcode='4801') and timegenerated >= '%today%')" GET EventCode,TimeGenerated /FORMAT:CSV > C:\logoff.log\%today%.log
exit
#!/bin/sh
#
# it works on only cygwin.
#
if [ $# -eq 0 ]
then
netsh wlan show profiles | cut -d':' -f 2 | sed -e 's/^[ ]*//g' -e '1,8d'
else
reg add HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer /v link /t REG_BINARY /d 00000000 /f
pause
@valvallow
valvallow / year_progress.sh
Last active April 23, 2018 02:27
year progress
seq -w 00 99 | sed -e "1,$(echo "scale=2;" \(\($(date +%s) - $(date -d $(date +%Y)-01-01 +%s)\) / 86400\) / 365 | bc | sed -e 's/^\.//g')s/.*/ /g" -e 's/ /■/g' -e 's/ //g' -e 's/[0-9][0-9]/□/g' | tr '\n' ' ' | sed -e 's/ //g';echo -n ' ';echo "scale=2;" \(\($(date +%s) - $(date -d $(date +%Y)-01-01 +%s)\) / 86400\) / 365 | bc | sed -e 's/^\.//g' -e 's/$/%/g'
@valvallow
valvallow / get-withings-data.sh
Created December 22, 2016 14:56
get withings data command
#!/bin/sh
NOW=`date +%s`
YESTERDAY=`date --date='-1day' +%s`
wget -qO - "http://wbsapi.withings.net/measure?action=getmeas&oauth_consumer_key=xxx...xxx&oauth_nonce=xxx...xxx&oauth_signature=xxx...xxx&oauth_signature_method=HMAC-SHA1&oauth_token=xxx...xxx&oauth_version=1.0&userid=nnn...nnn&oauth_timestamp=1234567890&startdate=$YESTERDAY&enddate=$NOW"
@valvallow
valvallow / gosh-tweet-update.scm
Created December 22, 2016 14:37
gosh repl tweet
#!/usr/local/bin/gosh
(use net.twitter)
(use gauche.parseopt)
(define (main args)
(let-args (cdr args)
((help "h|help" => (cut usage (car args)))
(consumer-key "consumer-key=s" "")
(consumer-secret "consumer-secret=s" "")
#!/bin/sh
SSH_SERVER="git-server" # .ssh/config
SSH_PASSWORD="*****"
SSH_SERVER_REPOS_ROOT_PATH='/repos'
BACKUP_DIR="/home/valvallow/repos"
REPOS_LIST_FILE="/home/valvallow/repos.list"
GIT_COMMAND_PATH="/home/valvallow/opt/bin/git"
# ----------------------------
# find repository
@valvallow
valvallow / transpose.scm
Last active December 28, 2015 07:29
transpose tsv/csv command.
#!/usr/bin/env gosh
(use text.csv)
(use file.util)
(use gauche.parseopt)
(define (usage cmd)
(print "Usage: " (sys-basename cmd) " [option ...] <file or input>")
(print " h|help : Show this help")
(print " d|delimiter : default:<tab>")