Table of Contents generated with DocToc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git diff | |
diff --git a/tmux-osx.conf b/tmux-osx.conf | |
index 8093298..a7f6295 100644 | |
--- a/tmux-osx.conf | |
+++ b/tmux-osx.conf | |
@@ -1,8 +1,8 @@ | |
set -g default-command "reattach-to-user-namespace -l ${SHELL}" | |
-bind-key -t vi-copy y copy-pipe "reattach-to-user-namespace pbcopy" | |
+bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "reattach-to-user-namespace pbcopy" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ cat /etc/apt/sources.list.d/graylog.list | |
# This file is managed by Puppet. DO NOT EDIT. | |
# The official Graylog package repository | |
deb https://downloads.graylog.org/repo/debian/ stable 2.1 | |
$ apt-get update | |
Ign https://downloads.graylog.org stable Release.gpg | |
Ign https://downloads.graylog.org stable Release | |
Err https://downloads.graylog.org stable/2.1 amd64 Packages | |
server certificate verification failed. CAfile: /etc/ssl/certs/ca-certificates.crt CRLfile: none |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# | |
# Requirements: | |
# Flask==0.11.1 | |
import ipaddress | |
from flask import Flask, request | |
app = Flask(__name__) |
Old Way
func checkBlockedSubdivisions(subdivisions []struct {
GeoNameID uint `maxminddb:"geoname_id"`
IsoCode string `maxminddb:"iso_code"`
Names map[string]string `maxminddb:"names"`
}) bool {
for _, sub := range subdivisions {
if checkRegionInList(sub.Names["en"]) {
return true
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
# Update the packages. | |
apt-get update | |
# Install a few utility tools. | |
apt-get install -y tar wget git |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Have a default hash that can be merged into an array | |
# One other requirement is the default should be overridden by the array | |
default_values = { | |
username => 'user', | |
password => 'password' | |
} | |
nginx_stats = [ | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import netaddr | |
import json | |
# Parse IPs to CIDR ranges from https://apps.db.ripe.net/search/query.html#resultsAnchor | |
def iprange_to_cidr(ip_value): | |
r = ip_value.split(' - ') | |
print(r) | |
return netaddr.iprange_to_cidrs(r[0], r[1]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> + for child in config.children: | |
> + if child.key == "TypesDB": | |
> + paths = child.value | |
I think there's probably a more Pythonic way to do this. | |
List comprehensions is one | |
paths = [ child.value for child in config.children if child.key == "TypeDB" ] | |
Using filter to filter out the children and then doing a list comprehension is more readable than above but requries two O(n) loops. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ sudo facter | grep environment | |
ec2_tag_environment => testing | |
puppet_environment => production |
NewerOlder