Skip to content

Instantly share code, notes, and snippets.

View BanzaiMan's full-sized avatar

Hiro Asari BanzaiMan

View GitHub Profile
$ sudo dtrace -n 'syscall::open*:entry/execname == "path_helper"/{ trace(copyinstr(arg0)) }'
dtrace: description 'syscall::open*:entry' matched 7 probes
dtrace: error on enabled probe ID 7 (ID 160: syscall::open:entry): invalid user access in action #1 at DIF offset 24
dtrace: error on enabled probe ID 4 (ID 946: syscall::open_nocancel:entry): invalid user access in action #1 at DIF offset 24
dtrace: error on enabled probe ID 4 (ID 946: syscall::open_nocancel:entry): invalid user access in action #1 at DIF offset 24
dtrace: error on enabled probe ID 4 (ID 946: syscall::open_nocancel:entry): invalid user access in action #1 at DIF offset 24
dtrace: error on enabled probe ID 4 (ID 946: syscall::open_nocancel:entry): invalid user access in action #1 at DIF offset 24
dtrace: error on enabled probe ID 4 (ID 946: syscall::open_nocancel:entry): invalid user access in action #1 at DIF offset 24
dtrace: error on enabled probe ID 4 (ID 946: syscall::open_nocancel:entry): invalid user access in action #1 at DIF offset
#!/bin/bash
source /etc/profile
if [[ -s ~/.bash_profile ]] ; then
source ~/.bash_profile
fi
ANSI_RED="\033[31;1m"
ANSI_GREEN="\033[32;1m"
ANSI_RESET="\033[0m"
@BanzaiMan
BanzaiMan / gist:7fceafa1819fb149ac0d7eb3d8137ebb
Last active August 25, 2016 17:12
Why does this Perl one-liner does not drop the last dupe?
$ echo x:x:y:y:z:x:y:z | perl -e 'print join(":", grep { !$seen{$_}++ } split(/:/, scalar <>))'
x:y:z:z
@BanzaiMan
BanzaiMan / errexit.sh
Last active August 5, 2016 14:30
Test "set -e" behavior inside a function in Bash
#!/bin/bash
# set -x
function test_function
{
set -e
echo "opts in test_function: $-"
false
echo pass through
2016-07-27T01:57:07.618998+00:00 app[web.1]: 2016-07-27 01:57:07 - TypeError - no implicit conversion of nil into String:
2016-07-27T01:57:07.619014+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/jwt-1.5.4/lib/jwt.rb:63:in `digest'
2016-07-27T01:57:07.619015+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/jwt-1.5.4/lib/jwt.rb:63:in `sign_hmac'
2016-07-27T01:57:07.619016+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/jwt-1.5.4/lib/jwt.rb:24:in `sign'
2016-07-27T01:57:07.619017+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/jwt-1.5.4/lib/jwt.rb:83:in `encoded_signature'
2016-07-27T01:57:07.619017+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/jwt-1.5.4/lib/jwt.rb:93:in `encode'
2016-07-27T01:57:07.619018+00:00 app[web.1]: /app/lib/travis/build/addons/jwt.rb:28:in `block in before_before_script'
2016-07-27T01:57:07.619019+00:00 app[web.1]: /app/lib/travis/build/addons/jwt.rb:19:in `each'
2016-07-27T01:57:07.619020+00:00 app[web.1]: /app/lib/travis/build/addons
@BanzaiMan
BanzaiMan / fix_github_font.css
Created July 23, 2016 14:19
Disable BlinkMacSystemFont on GitHub.com
/* Create a Stylish style with this and apply to github.com
https://news.ycombinator.com/item?id=12110682 */
body, .intgrs-page .main-content, .blog-content, .migration-wrapper, .migrate-owners-wrapper, .setup-wrapper, .showcase-page-title, .tooltipped::after { font-family: Helvetica, arial, nimbussansl, liberationsans, freesans, clean, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol" !important; }
.markdown-body { font-family: "Helvetica Neue", Helvetica, "Segoe UI", Arial, freesans, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol" !important; }
body { font-size: 13px !important; line-height: 1.4 !important; }
.blob-code { line-height: 1.4 !important; }
@BanzaiMan
BanzaiMan / pry-tricks.md
Last active January 30, 2018 16:24
A few `pry` tricks I learned from @JoshCheek

Pry tricks

ls [-v] obj

Lists methods defined on obj.

[1] pry(main)> str = "foobar"
=> "foobar"
[2] pry(main)> ls str
@BanzaiMan
BanzaiMan / gist:893d68ec634d8d7f57d8f7b7b77094de
Created May 5, 2016 08:23
~/.ivy2, ~/.sbt complete listings
$ find ~/.{ivy2,sbt} -type f
/home/travis/.ivy2/cache/commons-logging/commons-logging/ivydata-1.0.4.properties
/home/travis/.ivy2/cache/commons-logging/commons-logging/ivy-1.0.4.xml.original
/home/travis/.ivy2/cache/commons-logging/commons-logging/jars/commons-logging-1.0.4.jar
/home/travis/.ivy2/cache/commons-logging/commons-logging/ivy-1.0.4.xml
/home/travis/.ivy2/cache/org.json4s/json4s-ast_2.10/jars/json4s-ast_2.10-3.2.10.jar
/home/travis/.ivy2/cache/org.json4s/json4s-ast_2.10/ivy-3.2.10.xml.original
/home/travis/.ivy2/cache/org.json4s/json4s-ast_2.10/ivy-3.2.10.xml
/home/travis/.ivy2/cache/org.json4s/json4s-ast_2.10/ivydata-3.2.10.properties
/home/travis/.ivy2/cache/org.json4s/json4s-core_2.10/jars/json4s-core_2.10-3.2.10.jar
language: ruby
rvm:
- 1.9
- 2.0
- 2.1
- 2.2
- 2.3.0
- rbx-2
- rbx-3.26
matrix:
diff --git a/lib/travis/build/addons/rethinkdb.rb b/lib/travis/build/addons/rethinkdb.rb
index eecddda..211a67d 100644
--- a/lib/travis/build/addons/rethinkdb.rb
+++ b/lib/travis/build/addons/rethinkdb.rb
@@ -16,14 +16,14 @@ module Travis
sh.cmd "apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 #{RETHINKDB_GPG_KEY}", sudo: true
sh.cmd 'add-apt-repository "deb http://download.rethinkdb.com/apt $(lsb_release -cs) main"', sudo: true
sh.cmd "apt-get update -qq", assert: false, sudo: true
- package_version = rethinkdb_version + `lsb_release -cs`
- sh.cmd "apt-get install -y -o Dpkg::Options::='--force-confnew' rethinkdb=#{package_version}", sudo: true, echo: true, timing: true