Skip to content

Instantly share code, notes, and snippets.

There are three easy to make mistakes in go. I present them here in the way they are often found in the wild, not in the way that is easiest to understand.

All three of these mistakes have been made in Kubernetes code, getting past code review at least once each that I know of.

  1. Loop variables are scoped outside the loop.

What do these lines do? Make predictions and then scroll down.

func print(pi *int) { fmt.Println(*pi) }
@grugq
grugq / gist:03167bed45e774551155
Last active April 6, 2024 10:12
operational pgp - draft

Operational PGP

This is a guide on how to email securely.

There are many guides on how to install and use PGP to encrypt email. This is not one of them. This is a guide on secure communication using email with PGP encryption. If you are not familiar with PGP, please read another guide first. If you are comfortable using PGP to encrypt and decrypt emails, this guide will raise your security to the next level.

@mychaelstyle
mychaelstyle / build.gradle
Created March 28, 2014 06:04
Example Gradle build Java with FindBugs and PMD and CPD
apply plugin: "java"
apply plugin: "eclipse"
apply plugin: "maven"
apply plugin: "findbugs"
apply plugin: "pmd"
def defaultEncoding = 'UTF-8'
[compileJava, compileTestJava]*.options*.encoding = defaultEncoding
sourceCompatibility = 1.7
@rmoriz
rmoriz / 1_smime-clients.md
Last active December 17, 2023 13:41
S/MIME is the industry standard for secure E-Mail and build into every relevant mail client. From Outlook to Thunderbird, from Blackberry to Apple Mail on OSX and iOS. http://smime.io/
@irctrakz
irctrakz / IOC Splunker
Created February 8, 2013 23:18
Script to parse openIOC format files and search Splunk for extracted IP addresses.
#! /usr/bin/perl
#
# Script written to pull IP data from openIOC and search Splunk.
#
use strict;
use warnings;
$|=1;
@j3tm0t0
j3tm0t0 / initvpn.sh
Last active September 25, 2020 13:57
user-data file for cloud-init script to initialize openswan and xl2tpd for L2TP/IPsec on Amazon Linux AMI
#!/bin/sh
IPSEC_SECRET=SECRET
VPN_USERNAME=vpnusername
VPN_PASSWORD=vpnpassword
LOCAL_ADDRESS=`curl -s http://169.254.169.254/latest/meta-data/local-ipv4`
# for radiko.jp etc...
# curl -s http://169.254.169.254/latest/meta-data/public-ipv4 | grep ^175\. && echo OK || shutdown -h now