Skip to content

Instantly share code, notes, and snippets.

@vancluever
vancluever / verify-sums.txt
Last active November 8, 2015 17:30
Verify files (sums, GPG, etc)
# Verify GPG signature - see https://www.gnupg.org/gph/en/manual/x135.html
gpg --verify doc.sig doc
# Verify SHA1 sum (if you have file)
shasum -c SIGFILE
# Verify SHA1 sum (you don't have file)
echo "SUM FILE" | shasum -c
# possible bash function for the above
shaverify() {
echo "$1 $2" | shasum -c
}
@vancluever
vancluever / gpg-import-keys.txt
Last active November 8, 2015 17:31
GPG key stuff and trust
# GPG requires signature verification for a number of reasons.
# These all require you to have the public key of the signatory,
# which are generally distributed a couple of ways:
# * Via the web (ie: public key block directly on a web page)
# * Thru GPG's public keyserver
#
# The following page has some info on public keyservers:
# https://en.wikipedia.org/wiki/Key_server_(cryptographic)
#
# So this basically leaves you with two ways to import a GPG
@vancluever
vancluever / arrayindex_rubocop_gotcha.rb
Last active November 8, 2015 17:31
Array#index - better (and rubocop detectable) single-line conditional block structuring
# Rubocop (https://github.com/bbatsov/rubocop) is pretty awesome, and
# should be a part of every rubyist's toolkit. Not only do you get basic
# syntax checking so that you know that your code actually runs, you get a
# ton of linting and style rules that will make your code more readable and
# help you avoid ambigutity issues that may lead you to do things that you
# didn't intend to do.
#
# One such useful lint rule is Lint::AssignmentInCondition, which allows one
# to avoid the classical "=" in a conditional when you meant "==", as this is
# valid ruby and will result in an assignment, which is probably not what you
@vancluever
vancluever / gnome-tweaks.txt
Last active December 28, 2015 06:36
GNOME 3 post-install tweaks
I'm using the following tweaks on GNOME 3 to try and get things a bit sane.
I've always hated the bloat, but it can be a good DE with a bit of elbow
grease. Honestly, Ubuntu looks better, and I might go back to it.
Anyway:
* Font improvments: https://ask.fedoraproject.org/en/question/64130/how-to-improve-font-rendering-in-gnome-shell/
* Ensure you tweak your mouse (see http://www.x.org/wiki/Development/Documentation/PointerAcceleration/ and https://wiki.archlinux.org/index.php/Mouse_acceleration)
* Turn on the dark theme (should be pre-installed)
* Disable workspaces (use tweak tool to select manual workspaces and set count to 1)
2016/05/16 13:52:05 [INFO] Terraform version: 0.7.0 dev 6bcd95547632044042761123dbfa2d88b85591c9
2016/05/16 13:52:05 [DEBUG] Detected home directory from env var: **REDACTED**
2016/05/16 13:52:05 [DEBUG] Detected home directory from env var: **REDACTED**
2016/05/16 13:52:05 [DEBUG] Attempting to open CLI config file: **REDACTED**/.terraformrc
2016/05/16 13:52:05 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2016/05/16 13:52:05 [DEBUG] Detected home directory from env var: **REDACTED**
2016/05/16 13:52:05 [WARN] Ignoring AWS metadata API endpoint at default location as it doesn't return any instance-id
2016/05/16 13:52:05 [DEBUG] plugin: waiting for all plugin processes to complete...
Failed to read state: Unknown refresh result: Local and remote state conflict, manual resolution required
2016/05/16 19:25:58 [ERROR] root.example_asg_module: eval: *terraform.EvalInterpolate, err: 1:3: unknown variable accessed: var.public_network_addresses in:
${var.public_network_addresses}
--
2016/05/16 19:25:58 [ERROR] root.example_asg_module: eval: *terraform.EvalSequence, err: 1:3: unknown variable accessed: var.public_network_addresses in:
${var.public_network_addresses}
--
2016/05/16 19:25:58 [ERROR] root.example_asg_module: eval: *terraform.EvalInterpolate, err: 1:3: unknown variable accessed: var.listener_port in:
2016/05/17 11:16:06 [DEBUG] Checking variable noop: var.vpc_id
2016/05/17 11:16:06 [DEBUG] hasDestroyEdgeInPath: Looking for destroy edge: module.example_autoscaling_module.module.autoscaling_instance_security_group.var.vpc_id - *terraform.GraphNodeConfigVariableFlat
2016/05/17 11:16:06 [DEBUG] hasDestroyEdgeInPath: Looking for destroy edge: module.example_autoscaling_module.module.autoscaling_instance_security_group.aws_security_group.security_group - *terraform.GraphNodeConfigResourceFlat
2016/05/17 11:16:06 [DEBUG] hasDestroyEdgeInPath: Looking for destroy edge: module.example_autoscaling_module.output.instance_security_group_id - *terraform.GraphNodeConfigOutputFlat
2016/05/17 11:16:06 [DEBUG] hasDestroyEdgeInPath: Looking for destroy edge: module.example_autoscaling_module.module.autoscaling_instance_security_group.output.security_group_id - *terraform.GraphNodeConfigOutputFlat
2016/05/17 11:16:06 [DEBUG] hasDestroyEdgeInPath: Looking for destroy edge: module.example_autoscaling_module.output.instance_se
AWS generated: "{\"Statement\":[{\"Action\":[\"s3:PutObject\",\"s3:GetObject\",\"s3:DeleteObject\"],\"Effect\":\"Allow\",\"Principal\":{\"AWS\":\"arn:aws:iam::123456789012:role/FooAdmins\"},\"Resource\":\"arn:aws:s3:::s3.lab.vcts.local/*\",\"Sid\":\"\"},{\"Action\":\"s3:ListBucket\",\"Effect\":\"Allow\",\"Principal\":{\"AWS\":\"arn:aws:iam::123456789012:role/FooAdmins\"},\"Resource\":\"arn:aws:s3:::s3.lab.vcts.local\",\"Sid\":\"\"}],\"Version\":\"2012-10-17\"}"
Data source generated: "{\"Statement\":[{\"Action\":[\"s3:GetObject\",\"s3:DeleteObject\",\"s3:PutObject\"],\"Effect\":\"Allow\",\"Principal\":{\"AWS\":[\"arn:aws:iam::123456789012:role/FooAdmins\"]},\"Resource\":[\"arn:aws:s3:::s3.lab.vcts.local/*\"]},{\"Action\":[\"s3:ListBucket\"],\"Effect\":\"Allow\",\"Principal\":{\"AWS\":[\"arn:aws:iam::123456789012:role/FooAdmins\"]},\"Resource\":[\"arn:aws:s3:::s3.lab.vcts.local\"]}],\"Version\":\"2012-10-17\"}"
@vancluever
vancluever / multiarraysort.go
Created December 10, 2015 21:48
Go: Sort an array of interfaces so that strings are on top
// This is a very basic demonstration of how to implement sort.Interface
// to do some custom sorting. Here, a slice of interfaces
// (ints and strings) are sorted so that the strings are on top.
// There is no other sorting of the elements, but the example
// provides a layout that can be used to implement more complex sorting.
package main
import "fmt"
import "sort"
@vancluever
vancluever / test.txt
Last active October 2, 2016 20:51
Terraform - schema_test.go - failing test for TestSchemaMap_Diff
"Complex structure with list of computed string should mark root set as computed": {
Schema: map[string]*Schema{
"outer": &Schema{
Type: TypeSet,
Optional: true,
Elem: &Resource{
Schema: map[string]*Schema{
"outer_str": &Schema{
Type: TypeString,
Optional: true,