Skip to content

Instantly share code, notes, and snippets.

@sr
sr / tsproxy.service
Created March 18, 2023 11:28
tsproxy systemd service
[Unit]
Description=Tailscale Proxy
Wants=network-pre.target tailscaled.service
After=network-pre.target tailscaled.service
StartLimitIntervalSec=0
[Service]
EnvironmentFile=/etc/default/tsproxy
ExecStart=/usr/local/bin/tsproxy \
--state="${STATE_DIRECTORY}" \
#!/usr/bin/osascript
# Usage: omnifocus-inbox Do something @Work
on run argv
set AppleScript's text item delimiters to " "
set theText to argv as string
tell application "OmniFocus"
parse tasks into default document with transport text theText
end tell
end run
@sr
sr / gist:3277766
Created August 6, 2012 19:23 — forked from rzezeski/gist:3250870
detect bad merge index files
#!/usr/bin/env escript
%% -*- erlang -*-
-include_lib("kernel/include/file.hrl").
-compile(export_all).
-define(LOG(S), io:format(S)).
-define(LOG(S,A), io:format(S,A)).
main(Dirs) ->
CodePath = case os:getenv("RIAK_LIB") of
@sr
sr / Gemfile
Created December 19, 2011 13:55
Janky on Heroku
source "http://rubygems.org"
gem "janky", "~>0.9"
gem "pg"
gem "thin"
RuntimeError (ERR wrong number of arguments for 'mget' command): /vendor/gems/ruby/1.8/gems/redis-2.2.0/lib/redis/client.rb:39:in `raw_call_command_without_newrelic_trace'
/vendor/gems/ruby/1.8/gems/rpm_contrib-1.0.13/lib/rpm_contrib/instrumentation/redis.rb:22:in `call' /vendor/gems/ruby/1.8/gems/newrelic_rpm-3.0.1/lib/new_relic/agent/method_tracer.rb:193:in `trace_execution_scoped'
/vendor/gems/ruby/1.8/gems/rpm_contrib-1.0.13/lib/rpm_contrib/instrumentation/redis.rb:20:in `call' /vendor/gems/ruby/1.8/gems/redis-2.2.0/lib/redis.rb:178:in `mget' /Users/sr/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/vendor/gems/ruby/1.8/gems/redis-2.2.0/lib/redis.rb:177:in `mget'
/vendor/internal-gems/chimney/lib/chimney/remote.rb:664:in `read_partition_values'
/vendor/internal-gems/chimney/lib/chimney/remote.rb:636:in `partition_usage'
/vendor/internal-gems/chimney/lib/chimney/remote.rb:686:in `partition_info'
/app/controllers/site_controller.rb:253:in `fi
@sr
sr / cloudkick-resque
Created November 21, 2010 14:15
cloudkick plugin for resque
#!/usr/bin/env ruby
$:.unshift "lib"
require "init"
workers = Resque.workers
total = workers.size.to_f
idling = workers.select { |w| w.idle? }.size
working = Resque.working.reject { |w| w.idle? }.size.to_f
busyness = (working / total) * 100
@sr
sr / ci
Created September 1, 2010 15:26
sandboxed CI script for bundler 0.9 and 1.0
#!/bin/sh
source `dirname $0`/ci-env
if [[ -x script/ci ]]; then
script/ci
else
test -f Gemfile.lock
if [ `head -n1 Gemfile.lock` == "GEM" ]; then
gem install bundler --no-rdoc --no-ri
@sr
sr / ci.rake
Created July 27, 2010 11:33 — forked from albertoperdomo/ci.rake
namespace :ci do
task :copy_yml do
sh "cp #{Rails.root}/config/example_database.yml #{Rails.root}/config/database.yml"
end
desc "Prepare for CI and run entire test suite"
task :build do
ENV["RACK_ENV"] = "test"
Rake::Task['db:migrate'].invoke
Rake::Task['db:test:prepare'].invoke
@sr
sr / app.js
Created June 26, 2010 20:43
Hoptoad middleware for Connect
var sys = require("sys"),
connect = require("connect"),
hoptoad = require("connectHoptoad");
module.exports = connect.createServer(
function (req, res) {
throw Error("fail")
},
hoptoad("SECRET", ["development"])
);
@sr
sr / rpgrc
Created April 26, 2010 00:07
my ~/.rpgrc
# rpg installs package contents in these locations:
RPGBIN='/Users/srozet/bin'
RPGLIB='/Users/srozet/.rubylib'
RPGMAN='/usr/share/man'
# rpg keeps its package database, index, and gem cache in these locations:
RPGPATH='/Users/srozet/.rpg'
RPGDB='/Users/srozet/.rpg/db'
RPGINDEX='/Users/srozet/.rpg/index'
RPGPACKS='/Users/srozet/.rpg/packs'