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>
#!/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}'
@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",

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:

" copy all this into a vim buffer, save it, then...
" source the file by typing :so %
" Now the vim buffer acts like a specialized application for mastering vim
" There are two queues, Study and Known. Depending how confident you feel
" about the item you are currently learning, you can move it down several
" positions, all the way to the end of the Study queue, or to the Known
" queue.
" type ,, (that's comma comma)
@jgworks
jgworks / gist:3946975
Created October 24, 2012 16:04
Random Bash Code
# set DIR to location of this file
DIR=$(cd "$(dirname "$0")"; pwd)