Skip to content

Instantly share code, notes, and snippets.

MASAKI Haruka reasonset

Block or report user

Report or block reasonset

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@reasonset
reasonset / temporary-disable-device.zsh
Created Apr 22, 2018
Turn on/off device with xinput and zenity.
View temporary-disable-device.zsh
#!/usr/bin/zsh
setopt EXTENDED_GLOB
device="$(zenity --title="Select Device" --width=600 --height=500 --list --column="DEVICES" "${(f)$(xinput --list | ruby -e 'print ARGF.each.map {|i| i =~ /[^A-Za-z]*([A-za-z1-9 ]+[a-zA-Z0-9])\s*id=(\d+)/; "#$2 #$1\n" }.join.chomp')}"| perl -ne '/\d+/; print $&;')"
if (( $? == 0 )) && [[ -n $device ]]
then
action="$(zenity --list --column="ACTION" "turn on" "turn off")"
if (( $? == 0 )) && [[ -n $action ]]
then
View forcedtodo.zsh
#!/bin/zsh
#### Default Settings ####
hts_voicefile=/usr/share/open-jtalk/voices/mei_normal.htsvoice
mecab_dictdir=/usr/share/open-jtalk/dic/
jtalk_tuning=(-a 0.6 -r 0.8 -fm -2.0 -jf 1.5)
jtalk_tmpfile=$HOME/tmp/forcedtodo.wav
notify_interval=180
notify_time=15000
task_editor=mousepad
View md2html_styled.zsh
#!/usr/bin/zsh
# Generate HTML files from Markdown files.
# It convert foo/bar.md to foo/bar.html
# This needs Pandoc.
STYLE_FILE="$HOME/local/repos/markdown-css/build/github/github.css"
BODY_CLASS="github"
PANDOC_OPTS=(-s --self-contained -t html5 -c $STYLE_FILE --toc)
for i in **/*.md
@reasonset
reasonset / zsh_parellel_queue_sock.zsh
Created Jun 6, 2016
Multi thread programming in Zsh with Socket Queue version.
View zsh_parellel_queue_sock.zsh
#!/usr/bin/zsh
zmodload zsh/net/socket
producer() {
typeset -i threads="$1"
typeset -i deadcount=0
shift
@reasonset
reasonset / parallel_queue.zsh
Created Jun 5, 2016
Sample of parallel processing in Zsh script.
View parallel_queue.zsh
#!/usr/bin/zsh
worker() {
worker_num=$1
while true
do
exec 9>| lock
flock -x 9
num=$(read -e)
exec 9>&-
@reasonset
reasonset / firefox-latest.zsh
Created May 23, 2016
Invoke latest Firefox with switching settings.
View firefox-latest.zsh
#!/bin/zsh --extended-glob
# If $1 == --profile
# use directory $2 instead".${profile_dir:-latest}"
if [[ $1 == --profile ]]
then
shift
profile_dir="$1"
shift
@reasonset
reasonset / mk-windows-virtual-disc.zsh
Created May 4, 2016
clone cdrdao (Linux), mount Daemon Tools (Windows)
View mk-windows-virtual-disc.zsh
#!/usr/bin/zsh
# This is intend to generate image with cdrdao in Linux and mount with DAEMON Tools in Windows.
# If you give -r as first argument, This program reads disc with cdrdao.
# Any prefix means file name without extension.
# For example, "foo/bar" means foo/bar.{bin,toc,cue}
# Usage:
# mk-windows-virtual-disc.zsh <existing_image_prefix> <output_prefix>
# mk-windows-virtual-disc.zsh -r <linux_output_prefix> <windows_output_prefix>
if [[ $1 == "-r" ]]
View purebuilder2-20160418.diff
diff --git a/README.md b/README.md
index dc3f176..6f79d20 100644
--- a/README.md
+++ b/README.md
@@ -168,3 +168,25 @@ Copy `config_sample/accs` as a ACCS directory and configure what you want.
Build this ACCS.
Please execute in an ACCS directory.
+
+Functions
View purebuilder2.diff
diff --git a/rubylib/pbmarkdown.rb b/rubylib/pbmarkdown.rb
index 95b843f..97acdfc 100644
--- a/rubylib/pbmarkdown.rb
+++ b/rubylib/pbmarkdown.rb
@@ -16,7 +16,15 @@ class Kramdown::Parser::Kramdown
# Is Header?
when :header
- ::DOC.stock_header(arg[-1][:level], arg[-1][:raw_text])
+ @used_ids ||= {}
View puredoc.diff
diff --git a/puredoc.rb b/puredoc.rb
index 4f604f8..a478a58 100755
--- a/puredoc.rb
+++ b/puredoc.rb
@@ -224,7 +224,7 @@ class PureDoc
(cur - i.level).times {|n| result << proc4close.call( (cur - n), ( cur - n - offset ) ) }
end
- result << proc4each.call(i.level, (i.level - offset), i.title)
+ result << proc4each.call(i.level, (i.level - offset), i.title, i.id)
You can’t perform that action at this time.