Skip to content

Instantly share code, notes, and snippets.

### Keybase proof
I hereby claim:
* I am boostrack on github.
* I am hflambo (https://keybase.io/hflambo) on keybase.
* I have a public key whose fingerprint is B92D 2343 7A5B 4B80 5687 4CBC A890 28C9 61A7 D5EF
To claim this, I am signing this object:

Using Dnsmasq with Ubuntu for VM web application testing

When using virtual machines for testing web apps in various browsers (e.g. Internet Explorer), I have found it rather tedious having to continually tweak the hosts file within each new VM for the purpose of adding entries pointing back to the host machine's development web server address.

Instead, the steps below will setup Dnsmasq on a Ubuntu 14.04LTS or 12.04LTS host machine for the purpose of serving both it's own DNS queries and that of virtual machine guests. Dnsmasq will parse your host's /etc/hosts file where we will keep a single set of DNS entires to our test web applications.

Method 1

configurations {
apt
}
dependencies {
compile 'com.squareup.dagger:dagger:1.1.0'
apt 'com.squareup.dagger:dagger-compiler:1.1.0'
}
android.applicationVariants.all { variant ->
@boostrack
boostrack / .gitignore
Last active August 29, 2015 14:20 — forked from meeDamian/.gitignore
# PROJECT `.gitignore`
# put it in the *root* of your project
# most likely just append this line to the already existing file
/secret.properties
@boostrack
boostrack / Example of SVG sprites.markdown
Last active September 14, 2015 09:48
Example of SVG sprites
@boostrack
boostrack / LambdaPi.java
Last active September 21, 2015 07:15 — forked from thomasdarimont/LambdaPi.java
Approximate PI in almost one line with Lambdas in Java 8 :) - Theory here: http://www.stealthcopter.com/blog/2009/09/python-calculating-pi-using-random-numbers/
package de.tutorials.training.java8.lambda;
import java.util.stream.IntStream;
import static java.lang.Math.*;
import static java.util.concurrent.ThreadLocalRandom.*;
/**
* Author: Thomas Darimont
*/
@boostrack
boostrack / packer-aws-ami-template.json
Last active September 22, 2015 12:21 — forked from sumeetpareek/packer-aws-ami-template.json
packer template to create aws ami using ansible provisioner
{
"variables": {
"aws_access_key": "", // This helps me connect to AWS
"aws_secret_key": ""
},
"builders": [{
"type": "amazon-ebs",
"access_key": "{{user `aws_access_key`}}",
"secret_key": "{{user `aws_secret_key`}}",
"region": "us-east-1",
@boostrack
boostrack / pr.md
Created October 2, 2015 15:01 — forked from piscisaureus/pr.md
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = [email protected]:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@boostrack
boostrack / rename p128p1 to eth0
Created October 21, 2015 20:30
rename p128p1 to eth0
sudo INTERFACE=p128p1 MATCHADDR=$(ip addr show $INTERFACE | grep ether | awk '{print $2}') /lib/udev/write_net_rules
http://www.hellovinoth.com/ubuntu-14-04-renaming-ethernet-interfaces-from-p1p1%E2%80%B3-to-eth0%E2%80%B3/
Here’s how to rename your network card in Ubuntu 14.04:
Get your ethernet card MAC address: ifconfig | grep HWaddr
keep it handy (open a new Terminal window for following steps)
cd /etc/udev/rules.d
backup your file: cp 70-persistent-net.rules 70-persistent-net.rules.bak
edit your file: sudo nano 70-persistent-net.rules
@boostrack
boostrack / docker-cleanup
Created December 3, 2015 09:26 — forked from wdullaer/docker-cleanup
Cleanup unused Docker images and containers
#!/bin/sh
# Cleanup docker files: untagged containers and images.
#
# Use `docker-cleanup -n` for a dry run to see what would be deleted.
untagged_containers() {
# Print containers using untagged images: $1 is used with awk's print: 0=line, 1=column 1.
# NOTE: "[0-9a-f]{12}" does not work with GNU Awk 3.1.7 (RHEL6).
# Ref: https://github.com/blueyed/dotfiles/commit/a14f0b4b#commitcomment-6736470
docker ps -a | tail -n +2 | awk '$2 ~ "^[0-9a-f]+$" {print $'$1'}'