Skip to content

Instantly share code, notes, and snippets.

# Two input variables (1 array of hashes, 1 hash)
[
{
"key1": "value1a",
"key2": "value2a"
},
{
"key1": "value1b",
"key2": "value2b"

class RegisterFinish(luigi.Task):
    item_id = luigi.IntParameter()
    run_id = luigi.IntParameter()

    def requires(self):
        return [RunSubJob(self.item_id, self.run_id), NodepJob(self.item_id, self.run_id)]

    def output(self):
@fields
fields / keybase.md
Created December 16, 2016 18:40
keybase.md

Keybase proof

I hereby claim:

  • I am fields on github.
  • I am fields (https://keybase.io/fields) on keybase.
  • I have a public key whose fingerprint is 0E0B B45D 237B FACC 8D0D B47C DF7E 7EE8 7C19 81F5

To claim this, I am signing this object:

Even after terraform apply, terraform plan still sees policy changes:
~ aws_s3_bucket.bucketname
policy: "{\"Statement\":[{\"Action\":\"s3:PutObject\",\"Effect\":\"Allow\",\"Principal\":{\"AWS\":\"arn:aws:iam::xxxxx:root\"},\"Resource\":\"arn:aws:s3:::bucketname/*\",\"Sid\":\"\"}],\"Version\":\"2012-10-17\"}" => "{\"Statement\":[{\"Action\":\"s3:PutObject\",\"Effect\":\"Allow\",\"Principal\":{\"AWS\":\"arn:aws:iam:xxxx:root\"},\"Resource\":\"arn:aws:s3:::bucketname/*\"}],\"Version\":\"2012-10-17\"}"
The policy file I’m specifying doesn’t have a SID, because a) I don’t want to hardcode that (and it should be optional), and b) it may be applied to multiple buckets.
This is the policy file:
@fields
fields / session_rename.sh
Created January 5, 2016 19:41
Bash script to rename the current window
#!/bin/bash
echo -n -e "\033]0;$1\007"
@fields
fields / make_gemfile_from_gems.rb
Created April 1, 2014 13:37
make a Gemfile from currently installed gems
#!/usr/bin/env ruby
gems = `gem list`
puts "source https://rubygems.org"
gems.each_line{|line|
(gem, versions) = line.split(' ')
highest_version = versions.split(',').first.gsub(/[\(\)]/, '')
puts "gem '#{gem}', '#{highest_version}'"
}
@fields
fields / speedtest_mongo.rb
Created November 18, 2013 18:51
speedtest_mongo.rb
#!/usr/bin/env ruby
require 'yajl'
require 'mongo'
speedtest_json = `/path/to/speedtest-cli --json`
begin
if speedtest_json.nil? or speedtest_json == ""
raise Yajl::ParseError
@fields
fields / send_mail_to_reminders.scpt
Created September 17, 2013 13:25
applescript to create reminders from mail in mountain lion
using terms from application "Mail"
on perform mail action with messages theMessages for rule theRule
tell application "Mail"
set theText to "This AppleScript is intended to be used as an AppleScript rule action, but is also an example of how to write scripts that act on a selection of messages or mailboxes." & return & return & "To view this script, hold down the option key and select it again from the Scripts menu."
repeat with eachMessage in theMessages
set theSubject to subject of eachMessage
set theBody to content of eachMessage
try
-- If this is not being executed as a rule action,
-- getting the name of theRule variable will fail.
@fields
fields / Vagrantfile
Created May 20, 2013 15:48
Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
# override these variables in ~/.vagrant.d/Vagrantfile for your local changes
$local_username ||= `whoami`.strip
$local_projects_directory ||= "~/projects/vagrant/"
$vm_memory ||= "4096"
$vm_cpus ||= "4"
$server_root_password = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
@fields
fields / gist:5189677
Created March 18, 2013 18:43
script for checking ulimits
return-limits(){
for process in $@; do
process_pids=`ps -C $process -o pid --no-headers | cut -d " " -f 2`
if [ -z $@ ]; then
echo "[no $process running]"
else
for pid in $process_pids; do
echo "[$process #$pid -- limits]"
cat /proc/$pid/limits
done