Skip to content

Instantly share code, notes, and snippets.

@kendellfab
kendellfab / golang-request
Created August 26, 2013 14:27
Golang Example for adding custom headers to a request.
client := &http.Client{]
req, err := http.NewRequest("POST", "http://example.com", bytes.NewReader(postData))
req.Header.Add("User-Agent", "myClient")
resp, err := client.Do(req)
defer resp.Body.Close()
@jhedstrom
jhedstrom / gist:6125918
Created July 31, 2013 20:36
Running Firefox headless for selenium/Behat tests
if [ ! -f /tmp/.X5-lock ]; then /usr/bin/Xvfb :5 -ac -screen 0 1024x768x8 & fi
export DISPLAY=:5.0 # firefox needs this to know where to find a display to run on
java -jar /opt/selenium/selenium-server-standalone-2.26.0.jar > /dev/null 2>&1 &
@crifkin
crifkin / gist:5986419
Created July 12, 2013 17:57
Crifkin 2013 DCLA Vagrant help
NOTE: version numbers are at the time of this writing
1. Download and install Virtualbox (4.2.16)
2. Download and install Vagrant (1.2.3)
3. Check ruby and rubygems versions
4. Install berkshelf gem
gem install berkshelf --version '>= 1.4.0'
5. Install berkshelf vagrant plugin
vagrant plugin install vagrant-berkshelf --plugin-version '1.2.0'
6. Add vagrant basebox provided in Crifkin Training package (precise64_chef11.box)
@willurd
willurd / web-servers.md
Last active April 19, 2025 01:56
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@theangryangel
theangryangel / AuthController.js
Created February 28, 2013 21:54
sails (v0.8.82) + passport + passport-local Rough Example. For the love of all that is holy, don't use this in production.
// api/controllers/AuthController.js
var passport = require('passport');
var AuthController = {
login: function (req,res)
{
res.view();
},
@ncremins
ncremins / gist:3812686
Created October 1, 2012 16:00
[MySQL] comma separated column names
SELECT GROUP_CONCAT(column_name ORDER BY ordinal_position)
FROM information_schema.columns
WHERE table_schema = 'DATABASE_HERE' AND table_name = 'TABLE_HERE'
@marktheunissen
marktheunissen / pedantically_commented_playbook.yml
Last active January 22, 2025 09:27 — forked from phred/pedantically_commented_playbook.yml
Insanely complete Ansible playbook, showing off all the options
This playbook has been removed as it is now very outdated.
@paulschwarz
paulschwarz / gist:2776456
Created May 23, 2012 17:15 — forked from ciastek/gist:2776416
Global Vagrantfile to override number of CPUs used by VM
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant::Config.run do |config|
config.vm.customize ["modifyvm", :id, "--cpus", 1]
end