Skip to content

Instantly share code, notes, and snippets.

@taroyanaka
taroyanaka / kakasi_sample.sh
Created August 8, 2018 07:34
brew install kakasi
ENGNAMING=`ls *m3u8 | kakasi -Ja -i utf-8 -o utf-8 | kakasi -ja -Ha -Ka -i utf-8 -o utf-8 | tr -d " -"`; mv *.m3u8 $ENGNAMING;
while true
do
sleep 2
LSFILES=`ls`
if [[ $LSFILES =~ .*\.m3u8 ]]; then ./whilefilewaiting.sh ; break; fi;
done
@taroyanaka
taroyanaka / acter_rate_counter_beta.sh
Last active August 9, 2018 15:49
./acter_rate_counter_beta.sh "ポル乃花子"
#! /bin/sh
# ((LESSTHAN=0))
for i in {1..10}
do
curl -s "https://avgle.com/search/videos?search_query=$1&page=$i" > ./foo.txt
LINECOUNTER=`cat foo.txt |grep rating|grep -oE "[0-9]+"|grep -c ""`
cat ./foo.txt >> ./bar.txt
if (( $LINECOUNTER <= 17 ))
@taroyanaka
taroyanaka / cloud_vision_api.rb
Created September 2, 2018 01:51
export GOOGLE_VISION_API_KEY="YOUR_API_KEY", ruby cloud_vision_api.rb ./IMAGEFILEPATH.jpeg |cat|tail -n 5|head -n 1|awk '{print $2}'
#! /usr/bin/env ruby
require 'base64'
require 'json'
require 'net/https'
IMAGE_FILE = ARGV[0]
API_KEY = ENV['GOOGLE_VISION_API_KEY']
API_URL = "https://vision.googleapis.com/v1/images:annotate?key=#{API_KEY}"
find ~/Google\ ドライブ/ocr -type f|while read LINE;do; `~/cloud_vision_api.rb "$LINE"|tail -n 5|head -n 1 >> ~/Downloads/res.txt` ;done
cat ~/Downloads/res.txt
# find ~/Google\ ドライブ/ocr -type f -print0 | xargs -0 rm
find ~/Google\ ドライブ/ocr -type f -print0 | xargs -0 ls
@taroyanaka
taroyanaka / pb_check_and_add.sh
Last active September 2, 2018 05:39
only mac OS cause use pbpaste command (if global clipboard ON, this script be powerful)
#! /bin/sh
PASTE=`pbpaste`
while true
do
if [[ `pbpaste` != $PASTE ]]
then
echo $PASTE >> /tmp/any.txt
fi
PASTE=`pbpaste`
@taroyanaka
taroyanaka / zsh_history_counter
Created September 8, 2018 15:01
only on zsh
cat ~/.zsh_history | awk '{gsub(/\: [0-9]*:[0-9]*\;/,"");print}'| awk '{gsub(/^/,"\"");gsub(/$/,"\"");print}' | tail -n 100 | sort | uniq -c | sort
history-all | awk '{gsub(/^\s*[0-9]* \S* \S* /,"");gsub(/^/,"\"");gsub(/$/,"\"");print}' | sort | uniq -c | sort
@taroyanaka
taroyanaka / most_using_command_execute
Created September 8, 2018 18:09
this script can't do that if the command is alias
history-all | awk '{gsub(/^\s*[0-9]* \S* \S* /,"");gsub(/^/,"\"");gsub(/$/,"\"");print}' | sort | uniq -c | sort | awk '{gsub(/\s+[0-9]* /,"");print}' | tail -n 1 | `which zsh`
ALIAS="foo";cat ~/.zshrc | grep "alias "$ALIAS"=" | awk '{gsub(/alias /,"");gsub(/'"$ALIAS"'=/,"");print}'