Skip to content

Instantly share code, notes, and snippets.

View ngpestelos's full-sized avatar

Nestor G Pestelos Jr ngpestelos

View GitHub Profile

Things that programmers don't know but should

(A book that I might eventually write!)

Gary Bernhardt

I imagine each of these chapters being about 2,000 words, making the whole book about the size of a small novel. For comparison, articles in large papers like the New York Times average about 1,200 words. Each topic gets whatever level of detail I can fit into that space. For simple topics, that's a lot of space: I can probably walk through a very basic, but working, implementation of the IP protocol.

[Unit]
Description=MyApp
After=docker.service
Requires=docker.service
[Service]
TimeoutStartSec=0
ExecStartPre=-/usr/bin/docker kill busybox1
ExecStartPre=-/usr/bin/docker rm busybox1
ExecStartPre=/usr/bin/docker pull busybox
@aisrael
aisrael / docker_bashrc
Last active August 29, 2015 14:01
A bunch of useful bash functions and aliases for Docker.
# Use 'docker.io' if using the official packages on Ubuntu 14.04+
alias dip="docker inspect --format '{{ .NetworkSettings.IPAddress }}'"
drm() { docker rm ; }
dri() { docker rmi ; }
alias dkd="docker run -d -P"
alias dki="docker run -t -i -P"
alias docker_rmi_all='docker rmi $(docker images|tail -n +2|awk '\''{print $1":"$2}'\'')'
#####
@shin1x1
shin1x1 / Vagrantfile
Created December 10, 2013 06:47
Docker Provisioner sample on Vagrant 1.4
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "precise64"
config.vm.provision "docker" do |d|
d.run "ubuntu",
cmd: "bash -l",
args: "-v '/vagrant:/var/www'"
end
@dqminh
dqminh / applause_formatter.rb
Last active December 18, 2015 04:59
rspec formatter that applause you when your tests pass
require "rspec/core/formatters/progress_formatter"
class ApplauseFormatter < RSpec::Core::Formatters::ProgressFormatter
def initialize(output)
super(output)
unless File.exists? "/tmp/applause.mp3"
p "Downloading applause for awesomeness"
system "wget http://www.soundjay.com/human/applause-1.mp3 -O /tmp/applause.mp3"
end
end

Security is Hard

Massive Assignment

  • watch for ActiveRecord Relation, like has_many, has_many :through
  • watch for user_roles, `group_users
  • UPDATE action

Admin

@radamanthus
radamanthus / gist:5095797
Created March 6, 2013 00:48
RailsGirls followup activity
<This is a brain dump. Please forgive any typos>
I'd like to share an idea for a RailsGirls followup activity.
I noticed that having your stuff deployable and out on the net is a very powerful source of inspiration.
For me it makes me keep on working on it, just knowing that other people can see it.
One of the stumbling blocks in learning Rails is deployment. It's an advanced topic that is oddly too often taught in intro courses.
Forget about teaching deployment. Let's just give the newbs a ready-to-use VPS.

Development box installation guide

This guide will show how to setup a VirtualBox similiar to an Ubuntu 12.04.1 server for use with Amazon EC2.

Covered in this guide:

  • VeeWee: Tool for building base boxes which will be used by vagrant
  • Vagrant: Tool for managing virtual machines with an easy to use CLI
  • Librarian: Bundler for chef cookbooks
  • Chef-solo & Knife solo: Tool for automating installing and management of servers
@cmarguel
cmarguel / philippine-defense-squad.md
Last active May 25, 2016 21:01
Filipinos overreacting to foreigners and fellow Filipinos but mainly foreigners

philippine-defense-squad.txt v 0.1

This text file seeks to become a comprehensive listing of all instances of times when Filipinos overreact to criticism (both deserved and undeserved) by descending upon the subject like a swarm of angry bees and inflicting their wrath through letters, blogs, Photoshop contests, and other zany means of reaction. Anyone who figures out how to contact me is welcome to contribute.

  • the spoon incident in Canada, which really turned out to be the fault of the boy;
  • Art Bell's racist comments against Pinoys, actually a hoax
  • Filipinos getting angry over the Faye Nicole San Juan incident, which later turned out to be a hoax
  • Claire Danes goes to the Philippines; gets declared persona non grata after making a few remarks that some people didn't like hearing
  • Americans go to Jollibee and get flamed by a thousand angry Pinoys who can't bear the thought that other cultures might be weirded out by other cultures
  • Malu Fernandez receives flames and death threats after putting her
@tansengming
tansengming / configure.rb
Created July 9, 2012 07:37
Ruby configure blocks
# How Clearance / Hoptoad does it
module Clearance
class << self
attr_accessor :configuration
end
def self.configure
self.configuration ||= Configuration.new
yield(configuration)
end