Skip to content

Instantly share code, notes, and snippets.

View uu59's full-sized avatar

uu59

View GitHub Profile
[Unit]
Description=digdag
[Service]
User=uu59
Restart=always
TimeoutStartSec=30s
Type=simple
ExecStart=/home/uu59/digdag-server/start.bash
@uu59
uu59 / .gitignore
Created August 13, 2012 08:12
socket.io and Sinatra
vendor/
.bundle/
node_modules/
Gemfile.lock
# -- coding: utf-8
require "pp"
require "rubygems"
require 'sinatra'
require 'sinatra/base'
module Sinatra
module Helpers
class Stream
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
@uu59
uu59 / better-google-groups.user.js
Created August 3, 2012 18:36
Better Google Groups
// ==UserScript==
// @name Better Google Groups
// @namespace http://uu59.org/
// @version 1.0.0
// @include http://productforums.google.com/forum/*
// ==/UserScript==
function addStyle(css) {
var id = "better-google-groups";
var style = document.querySelector('#' + id);
$ 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
@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}
}