Skip to content

Instantly share code, notes, and snippets.

View theckman's full-sized avatar

Tim Heckman theckman

  • Los Angeles, CA
View GitHub Profile
@theckman
theckman / wireguard.conf
Created April 11, 2021 07:52 — forked from nealfennimore/wireguard.conf
Wireguard VPN - Forward all traffic to server
# ------------------------------------------------
# Config files are located in /etc/wireguard/wg0
# ------------------------------------------------
# ---------- Server Config ----------
[Interface]
Address = 10.10.0.1/24 # IPV4 CIDR
Address = fd86:ea04:1111::1/64 # IPV6 CIDR
PostUp = iptables -A FORWARD -i wg0 -j ACCEPT; iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE; ip6tables -A FORWARD -i wg0 -j ACCEPT; ip6tables -t nat -A POSTROUTING -o eth0 -j MASQUERADE # Add forwarding when VPN is started
PostDown = iptables -D FORWARD -i wg0 -j ACCEPT; iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE; ip6tables -D FORWARD -i wg0 -j ACCEPT; ip6tables -t nat -D POSTROUTING -o eth0 -j MASQUERADE # Remove forwarding when VPN is shutdown
func doWork(s string, ch <-chan struct{}, wg *sync.WaitGroup) {
defer func() {
<-ch // free up space in the semaphore
wg.Done() // tell the WaitGroup we're finished
}()
fmt.Println(s)
}
func execute(work []string) {
# frozen_string_literal: true
require 'kitchen'
require 'foodcritic'
require 'rubocop/rake_task'
require 'jsonlint/rake_task'
require 'yamllint/rake_task'
require 'rspec/core/rake_task'
# set up test-kitchen
@theckman
theckman / partial_search.go
Last active December 29, 2020 17:08
Simple usage of Chef partial search in Golang
package main
import (
"fmt"
"io/ioutil"
"os"
"github.com/go-chef/chef"
)
@theckman
theckman / testing.go
Last active August 29, 2015 14:18
gocheck dryin' it up
func (t *TestSuite) TestAddTag(c *C) {
c.Assert(len(t.g.Tags), Equals, 0)
t.g.AddTag("test")
c.Assert(len(t.g.Tags), Equals, 1)
c.Check(t.g.Tags[0], Equals, "test")
t.g.AddTag("test2")
t.g.AddTag("test") // verify tags are de-duped
c.Assert(len(t.g.Tags), Equals, 2)

Keybase proof

I hereby claim:

  • I am theckman on github.
  • I am theckman (https://keybase.io/theckman) on keybase.
  • I have a public key whose fingerprint is 0E1A FA42 36D5 AD6E 2530 58DF C49E B0B2 3849 2FC1

To claim this, I am signing this object: