Skip to content

Instantly share code, notes, and snippets.

David Darrell incon

  • Swift Networks
  • Perth, Australia
View GitHub Profile
@incon
incon / upgrade-postgres-9.5-to-9.6.md
Created May 28, 2018 — forked from delameko/upgrade-postgres-9.5-to-9.6.md
Upgrading PostgreSQL from 9.5 to 9.6 on Ubuntu 16.04
View upgrade-postgres-9.5-to-9.6.md

TL;DR

Install Postgres 9.5, and then:

sudo pg_dropcluster 9.6 main --stop
sudo pg_upgradecluster 9.5 main
sudo pg_dropcluster 9.5 main
View enable_dnsmasq_on_osx.sh
# bash <(curl -s https://gist.github.com/drye/5387341/raw/ec72cddfe43ec3d39c91a3c118cb68ab14a049f8/enable_dnsmasq_on_osx.sh)
# ----------------------
# installing dnsmasq and enable daemon
# ----------------------
brew install dnsmasq
sudo cp -v $(brew --prefix dnsmasq)/homebrew.mxcl.dnsmasq.plist /Library/LaunchDaemons
# ----------------------
# adding resolver for vbox domain
# ----------------------
@incon
incon / dnsmasq OS X.md
Created Dec 27, 2017 — forked from ogrrd/dnsmasq OS X.md
Setup dnsmasq on OS X
View dnsmasq OS X.md

Never touch your local /etc/hosts file in OS X again

To setup your computer to work with *.dev domains, e.g. project.dev, awesome.dev and so on, without having to add to your hosts file each time.

Requirements

Install

View AoC-2017-day13.js
const input = require("fs").readFileSync("day13-input.txt", "UTF-8");
function cycle() {
keys = Object.keys(map);
keys.forEach(key => {
up = map[key]["up"];
depth = map[key]["length"];
if (up) {
map[key]["state"] += 1;
if (map[key]["state"] == depth - 1) {
View AoC-2017-day12.js
const input = require("fs").readFileSync("day12-input.txt", "UTF-8");
pairs = {};
input.split("\n").forEach(row => {
split = row.split(" <-> ");
split[1] = split[1].split(", ");
pairs[split[0]] = split[1];
});
count = 0;
View AoC-2017-day11.js
const input = require("fs").readFileSync("day11-input.txt", "UTF-8");
const map = {
n: { x: 0, y: 1 },
ne: { x: 1, y: 1 },
se: { x: 1, y: -1 },
s: { x: 0, y: -1 },
sw: { x: -1, y: -1 },
nw: { x: -1, y: 1 }
};
View AoC-2017-day9.js
let data = require("fs").readFileSync("day9-input.txt", "UTF-8");
let garbage = 0;
let total = 0;
let canceled = false;
let ignore = false;
let depth = 0;
data.split("").forEach(char => {
if (ignore) {
View AoC-2017-day8.js
const data = require("fs").readFileSync("day8-input.txt", "UTF-8");
map = {};
maxCPU = 0;
data.split("\n").forEach(row => {
action = row.split(" if ")[0].split(" ");
conditionStr = row.split(" if ")[1];
conditionVar = conditionStr.split(" ")[0];
actionVar = action[0];
increment = action[1] === "inc";
View AoC-2017-day5.js
function part1(str) {
let numbers = str.split("\n").map(num => parseInt(num));
let count = 0;
let nextIndex = 0;
let mazeSize = numbers.length;
while (nextIndex < mazeSize) {
count++;
const currentIndex = nextIndex;
nextIndex = numbers[currentIndex] + currentIndex;
numbers[currentIndex] = numbers[currentIndex] + 1;
You can’t perform that action at this time.