Skip to content

Instantly share code, notes, and snippets.

View uu59's full-sized avatar

uu59

View GitHub Profile
fullName: "+workflow+for_items"
state: "success"
result:
subtaskConfig:
+for-0=dir=0=foo:
+for_item:
+config:
rb>: "Workflow.config"
+for_paths:
for_each>:
timezone: UTC
_export:
foo: tmp_${session_date_compact}
td:
database: uu59test
+initialize:
td_ddl>:
create_tables: ["${foo}"]
class SqlEruby < Erubis::EscapedEruby
def escaped_expr(expr)
"#{self.class.to_s}.escape(#{expr})"
end
def self.escape(str)
ActiveRecord::Base.connection.instance_variable_get(:@connection).escape(str.to_s)
end
end
$ pry -r json -r oj -r yajl
[1] pry(main)> json = "[0.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100e100]"
=> "[0.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100e100]"
[2] pry(main)> JSON.parse json
=> [0.0]
[3] pry(main)> Yajl.load json
=> [100.0]
[4] pry(main)> Oj.load json
=> [#<BigDecimal:7faa1e380c00,'0.1E3',9(117)>]
[5] pry(main)> RUBY_DESCRIPTION
[Unit]
Description=digdag
[Service]
User=uu59
Restart=always
TimeoutStartSec=30s
Type=simple
ExecStart=/home/uu59/digdag-server/start.bash
@uu59
uu59 / dl.rb
Last active May 30, 2016 00:32
#!/usr/bin/env ruby
percent = (ENV["D"] || "50").to_i
content = ARGF.read
if STDOUT.tty?
print content.chars.map{|c| next c unless c.match(/[\x20-\x7f]/); rand(1..100) <= percent ? " " : c}.join
else
print content
end
#!/bin/bash
set -ue
ask() {
local default=${2:-""}
printf "%s" "${1}: (${default}) " >&2
read in
echo ${in:-$default}
}
#!/bin/bash
#vim:set ft=bash:
set -u
ghq-grep() {
for repo in $(ghq list); do
echo $repo:
(cd "$(ghq root)/$repo" && PAGER= git grep --full-name "$@")
echo
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
$ ruby -rubygems -e 'p Gem::Specification.count'
560
$ bundle exec ruby -rubygems -e 'p Gem::Specification.count'
78
$ bundle exec ruby -rubygems -e 'Bundler.with_clean_env { p Gem::Specification.count }'
78
$ bundle exec ruby -rubygems -e 'Bundler.with_clean_env { system("ruby -rubygems -e \"p Gem::Specification.count \"")}'