Skip to content

Instantly share code, notes, and snippets.

@mostlygeek
mostlygeek / about.md
Created August 9, 2011 15:17 — forked from jasonrudolph/about.md
Programming Achievements: How to Level Up as a Developer
@mostlygeek
mostlygeek / recipe.rb
Created January 30, 2012 19:50 — forked from poobury/recipe.rb
S3 File Resource for Chef
# Source accepts http/https or the protocol region:// with the host as the bucket
# access_key_id and secret_access_key are just that
# Note resource name has changed from s3_file to s3_aware_remote_file
# for the eu-west-1 region:
s3_aware_remote_file "/var/bulk/the_file.tar.gz" do
source "s3-eu-west-1://your.bucket/the_file.tar.gz"
access_key_id your_key
secret_access_key your_secret
owner "root"
@mostlygeek
mostlygeek / blog.md
Created May 18, 2012 14:50 — forked from groundwater/blog.md
Why Method Overloading Sucks in Scala

Introduction

Method overloading sucks in Scala because it detracts from your flexibility. An implicit conversion is a feature of Scala that let's the compiler look up how to convert objects between types at compile time.

Let's say I define a method with the following signature:

def doSomething( action: Action )

Somewhere else in the code I write:

#!/usr/bin/env python
#
# s3-download.py - a quick-and-dirty download script to download from S3
# implemented using Boto, which automatically applies AWS IAM role credentials
#
# This code is distributed under the MIT license from
# http://opensource.org/licenses/MIT:
#
# Copyright (c) 2013 Martijn Koster
#
#!/bin/bash
# update the system
sudo apt-get --yes update
sudo apt-get --yes upgrade
# node.js using PPA (for statsd)
sudo apt-get install --yes python-software-properties
sudo apt-add-repository ppa:chris-lea/node.js
sudo apt-get update --yes
@mostlygeek
mostlygeek / gist:7131906
Last active November 29, 2016 13:31 — forked from cemre/gist:4402564
An easy (ha!) way to resize and png optimize screenshots in OSX. This is good for resampling and then optimizing retina screenshots when sending to people. It dumps things into Dropbox/public/Screenshots, and copies the public URL to the clipboard. Bind it to a hot key to to make it easy to use. Check out the output: https://dl.dropboxuserconten…
#!/bin/bash
# *******************************
# Instructions on turning this into an OSX service:
# http://blog.lanceli.com/2012/08/downscale-screenshot-at-hight-resolution-on-retina-mackbook-pro.html
# *******************************
# the path where screenshots to save
DROPBOX_ID= ENTER YOUR DROPBOX ID HERE
#!/usr/bin/env python
import boto.sqs
from boto.sqs.message import RawMessage
conn = boto.sqs.connect_to_region('us-east-1')
q = conn.get_queue('tiles-data-processing-queue-stage')
q.set_message_class(RawMessage)
m = q.read()
@mostlygeek
mostlygeek / lambda_cloudsearch.js
Created November 3, 2015 23:45 — forked from fzakaria/lambda_cloudsearch.js
Send CloudTrail events to CloudSearch with AWS Lambda
console.log('Loading event');
var CLOUDSEARCH_ENDPOINT = < INSERT HERE >
var async = require('async');
var jpath = require('json-path')
var zlib = require('zlib');
var aws = require('aws-sdk');
var s3 = new aws.S3({
apiVersion: '2006-03-01'
});
@mostlygeek
mostlygeek / vim.markdown
Created November 27, 2015 18:29 — forked from socketwiz/vim.markdown
Vim cheat sheet

##motions

motion description
h Count characters left
l Count characters right
^ To the first character of the line
$ To the last character of the line
f<char> To the counth character occurrence to the right. F<char> to the counth character occurrence to the left
t<char> To 1 character just before the counth character occurrence to the right
T<char> To 1 character just before the counth character occurrence to the left
@mostlygeek
mostlygeek / table.md
Last active November 6, 2018 23:12
Pref Experiment Recipes (Filtered)

source:

curl https://gist.githubusercontent.com/rehandalal/bcd4818457b5697e1d9e98951de1713e/raw/3723219fe3ceb294d353bed1a8bf4692b59a6bc0/filtered-recipes.json | \
    jq -c '.[] | {id: .id, slug: .latest_revision.arguments.slug, pref: .latest_revision.arguments.preferenceName, created: .latest_revision.date_created, creator : .latest_revision.creator | "\(.first_name) \(.last_name)", ft: .latest_revision.filter_expression}' | \
    jq -c '. | "$$ \(.id) $$ \(.created) $$ \(.creator) $$ \(.slug) $$ \(.pref) $$ \(.ft) $$"'  | sed 's/"//g' | sed  's/|/\&#124;/g' | sed 's/\$\$/|/g' | sort
id created creator slug pref name filter expression
311 2017-11-21T18:29:39.911418Z null null pref-flip-autofill-release-1405217-2-2 extensions.formautofill.available ( [normandy.userId]