Skip to content

Instantly share code, notes, and snippets.

"Diversity is not about big sticks and hitting people over the head.
It is about creating a welcome and open environment and active
efforts to recruit members who would not otherwise participate.
Great efforts by PyLadies are proving to be very effective.
In contrast, big stick politics drive people away.
Please abandon this notion of using diversity as a stick to bonk
people over the head. It is counterproductive, misguided and offensive."
@progrium
progrium / bash
Created November 13, 2011 11:39
parse_http for nc http
# writes host to a host file
nc -l -p 9998 -c "./parse_http>/tmp/cgi;. /tmp/cgi>/dev/null && echo $HTTP_HOST > host"
# pipemill the request body
nc -l -p 9998 -c "./parse_http>/tmp/cgi;. /tmp/cgi | while read line; do something; done"
# route on the path
# uhh, well, sure, just use if on $HTTP_PATHINFO
@kennethlove
kennethlove / Description.md
Created October 12, 2012 23:47
GSWD Chef needs
  • Install build-essentials, git-core, vim, mercurial
  • Install postgresql-server
  • Edit /etc/postgresql/9.1/main/postegresql.conf
    • Change listen_address to = '*'
  • Edit /etc/postgresql/9.1/main/pg_hba.conf
    • Add new line host all all 10.0.0.0/16 md5
  • Add new postgresql superuser named "vagrant" with password "vagrant"
    • sudo su postgres
    • createuser -s -W vagrant
  • Add postgresql to defaults so it runs at boot
maintainer "YOUR_COMPANY_NAME"
maintainer_email "YOUR_EMAIL"
license "All rights reserved"
description "Installs/Configures pants"
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version Time.at(`git --git-dir=#{File.join(File.dirname(__FILE__),'.git')} log --max-count=1 --pretty=format:%ct`.to_i).strftime("1.0.%Y%m%d%H%M")
@ssimeonov
ssimeonov / chef_resource_rake.rb
Created June 18, 2013 22:40
Chef LWRP subclassing example: rake resource subclasses rvm_shell.
class Chef
class ResourceFactory
class Rake
def self.create(*args, &block)
register
Chef::Resource::Rake.new(*args, &block)
end
def self.register
@klass ||= begin
#!/bin/sh
bin_path=/opt/ruby-210/embedded/bin
update-alternatives --install /usr/bin/ruby ruby $bin_path/ruby 10 \
--slave /usr/bin/irb irb $bin_path/irb \
--slave /usr/bin/erb erb $bin_path/erb \
--slave /usr/bin/rdoc rdoc $bin_path/rdoc \
--slave /usr/bin/ri ri $bin_path/ri \
--slave /usr/bin/testrb testrb $bin_path/testrb \
@addyosmani
addyosmani / backboneglobalpubsub.md
Created February 4, 2012 19:37
Backbone.js global pub/sub

Generally one implements notifications by listening for events on specific models but if one wishes to have a single global message interchange, it could be done as follows:

var pubsub = new Backbone.Model;

View1 = Backbone.View.extend({
  initialize: function(){
    pubsub.bind('custom event', callback);
  }
 // ...
@bryanveloso
bryanveloso / brew-services.rb
Created December 8, 2011 09:39 — forked from lwe/brew-services.rb
External script for homebrew to simplify starting services via launchctl, out of the box support for any formula which implements #startup_plist. (This version fixes the deprecation warning raised on Formula.resolve_alias.)
#!/usr/bin/env ruby -w
# brew-services(1) - Easily start and stop formulas via launchctl
# ===============================================================
#
# ## SYNOPSIS
#
# [<sudo>] `brew services` `list`<br>
# [<sudo>] `brew services` `restart` <formula><br>
# [<sudo>] `brew services` `start` <formula> [<plist>]<br>

aws-cli bash helper functions

The official AWS command line tools, have support for configuration profiles. See Configuring the AWS Command Line Interface - Named Profiles.

Managing multiple profiles with the AWS CLI itself is relatively straight forward, switching between them with --profile flag on the command line or the AWS_PROFILE environment variable.

These helpers extend that functionality for convenience with other tools in the ecosystem.

aws-profile

FROM gcr.io/ynli-k8s/spark:v2.3.0
RUN rm $SPARK_HOME/jars/guava-14.0.1.jar
ADD http://central.maven.org/maven2/com/google/guava/guava/23.0/guava-23.0.jar $SPARK_HOME/jars
ADD https://storage.googleapis.com/hadoop-lib/gcs/gcs-connector-latest-hadoop2.jar $SPARK_HOME/jars
RUN mkdir -p /opt/hadoop/conf
COPY conf/core-site.xml /opt/hadoop/conf
COPY conf/spark-env.sh $SPARK_HOME/conf
ENTRYPOINT [ "/opt/entrypoint.sh" ]