Skip to content

Instantly share code, notes, and snippets.

@jgworks
jgworks / .vimrc
Created April 26, 2017 18:50
.vimrc
"set expandtab
"set shiftwidth=4
"set softtabstop=4
let mapleader = ','
set incsearch ignorecase hlsearch
" Press space to clear search highlighting and any message already displayed.
nnoremap <silent> <Space> :silent noh<Bar>echo<CR>
@jgworks
jgworks / Makefile
Created February 17, 2017 19:00
Make file for go projects
## simple makefile to log workflow
.PHONY: all test clean build install
GO=go
GOFLAGS ?= $(GOFLAGS:)
GOARCH ?= amd64 #$(GOARCH:amd64)
all: fmt vet build
build:
@jgworks
jgworks / custom_config.vim
Created February 17, 2017 17:14
vim-go shortcuts
command! W w
command! Q q
let g:go_highlight_functions = 1
let g:go_highlight_methods = 1
let g:go_highlight_structs = 1
let g:go_highlight_operators = 1
let g:go_highlight_build_constraints = 1
let g:go_fmt_command = "goimports"
let g:go_metalinter_enabled = 1
#!/bin/bash
mkdir -p /etc/traefik/
curl -L 'https://github.com/containous/traefik/releases/download/v1.1.2/traefik' > /usr/local/sbin/traefik
chmod +x /usr/local/sbin/traefik
# curl 'https://raw.githubusercontent.com/containous/traefik/master/traefik.sample.toml' > /etc/traefik/traefik.toml
cat > /usr/lib/systemd/system/traefik.service <<EOF
[Unit]
Description=traefik http proxy
@jgworks
jgworks / consul.service
Created December 20, 2016 18:10 — forked from yunano/consul.service
/etc/systemd/system/consul.service
[Unit]
Description=consul agent
Requires=network-online.target
After=network-online.target
[Service]
EnvironmentFile=-/etc/sysconfig/consul
Environment=GOMAXPROCS=2
Restart=on-failure
ExecStart=/usr/local/sbin/consul agent $OPTIONS -config-dir=/etc/consul.d
@jgworks
jgworks / axferfilter.lua
Last active October 14, 2016 02:33
lua script to filter out private A records and replace internal domain with external domain on powerdns slave
-- lua script to filter out private A records and replace internal domain with external domain on powerdns slave
-- sqlite> select * from domain;
-- 1|example.com|[u'10.0.0.1']|Slave|1476367424|0|1|0
-- sqlite> insert into domainmetadata values (1, 1, 'LUA-AXFR-SCRIPT', '/var/opt/pdns/axferfilter.lua');
pdnslog("loading axferfilter.lua")
ranges={
"127.0.0.0/8",
#!/bin/bash
# Requires:
# iTem2 3c
# pup
# imgcat
curl -s "http:$(curl -s xkcd.com | pup 'div[id="comic"] img attr{src}')" | imgcat; curl -s xkcd.com | pup 'div[id="comic"] img attr{title}'

Keybase proof

I hereby claim:

  • I am jgworks on github.
  • I am jgworks (https://keybase.io/jgworks) on keybase.
  • I have a public key whose fingerprint is 03F5 18E6 55CB CD28 EFE2 49AB EDDA 324E E919 4C19

To claim this, I am signing this object:

#!/usr/bin/env python
# Example output:
# $ python gistfile1.py --max-prefix=23
# {'children': [{'children': [{'name': '10.100.0.0/23'},
# {'name': '10.100.2.0/23'}],
# 'name': '10.100.0.0/22'},
# {'children': [{'name': '10.100.4.0/23'},
# {'name': '10.100.6.0/23'}],
# 'name': '10.100.4.0/22'}],
#!/usr/bin/env python
#
# Reads from standard input, dumps it onto a Confluence page
# You'll need to modify the URL/username/password/spacekey/page title
# below, because I'm too lazy to bother with argv.
import sys
import ssl
from xmlrpclib import Server
def update_page(username, pw):