Skip to content

Instantly share code, notes, and snippets.

Dave Wongillies davewongillies

Block or report user

Report or block davewongillies

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@davewongillies
davewongillies / wakelock.service
Last active Feb 2, 2019 — forked from victorhaggqvist/wakelock.service
Lock screen after suspend with i3lock and systemd
View wakelock.service
# /etc/systemd/system/wakelock.service
[Unit]
Description=Lock the screen on resume from suspend
Before=sleep.target suspend.target
[Service]
User=daveg
Type=forking
Environment=DISPLAY=:0
@davewongillies
davewongillies / Instructions.md
Last active Mar 22, 2018
Disable whitespace in Github Pull Requests bookmarklet
View Instructions.md

Create a bookmark with the following code for the URL:

javascript:function ghnwsp()%7Bwindow.location%3Dwindow.location%2B%27%3Fw%3D1%27%3B%7Dghnwsp()%3Bvoid(0)

And then click it whenever you're looking at diffs to disable whitespace lines.

View Terraform_functions.md

Supported built-in functions

  • abs(float) - Returns the absolute value of a given float. Example: abs(1) returns 1, and abs(-1) would also return 1, whereas abs(-3.14) would return 3.14. See also the signum function.

  • basename(path) - Returns the last element of a path.

  • base64decode(string) - Given a base64-encoded string, decodes it and returns the original string.

@davewongillies
davewongillies / aws_config.fish
Last active Aug 31, 2017 — forked from mbainter/aws_config.fish
Fish shell function to set your AWS credentials with MFA
View aws_config.fish
function aws_config
if not fgrep -q "[$argv]" ~/.aws/credentials
echo "Please specify a valid profile."
else
set token_expired false
if test $AWS_SESSION_EXPIRY
set now (date +%s)
# WARNING: this date command only works with GNU date
@davewongillies
davewongillies / aws_config.fish
Created Aug 30, 2017 — forked from mbainter/aws_config.fish
Fish shell function to set your AWS credentials with MFA for use with Terraform
View aws_config.fish
function aws_config
if not fgrep -q "[$argv]" ~/.aws/credentials
echo "Please specify a valid profile."
else
set -e AWS_ACCESS_KEY
set -e AWS_SECRET_KEY
set -g -x ATLAS_TOKEN (awk "/\[$argv\]/,/^\$/ { if (\$1 == \"atlas_token\") { print \$3 }}" ~/.aws/credentials)
set account (awk "/\[$argv\]/,/^\$/ { if (\$1 == \"account_id\") { print \$3 }}" ~/.aws/credentials)
set username (awk "/\[$argv\]/,/^\$/ { if (\$1 == \"username\") { print \$3 }}" ~/.aws/credentials)
set mfarn "arn:aws:iam::$account:mfa/$username"
@davewongillies
davewongillies / 00-README.md
Created Jul 9, 2017
udev rule to make TOMMO NEOGEOX Arcade Stick work with Linux
View 00-README.md

To make a TOMMO NEOGEOX Arcard Stick work with Linux, copy 10-tommo-neogeox.rules to /etc/udev/rules.d

@davewongillies
davewongillies / .ctags
Last active May 18, 2017 — forked from trlinkin/ctags
Ctags and vim-tagbar matching for Puppet Manifests - Based on http://comments.gmane.org/gmane.comp.sysutils.puppet.user/6152
View .ctags
# In your ~/.ctags
-h pp
--langdef=puppet
--langmap=puppet:.pp
--regex-puppet=/^[[:space:]]*class[[:space:]]*([a-z][a-zA-Z0-9_:\-]+)/\1/c,class/
--regex-puppet=/^[[:space:]]*stage[[:space:]]*([a-zA-Z0-9_:\-]+)/\1/t,stage/
--regex-puppet=/^[[:space:]]*site[[:space:]]*([a-zA-Z0-9_\-]+)/\1/s,site/
--regex-puppet=/^[[:space:]]*node[[:space:]]*[\'|\"]*([a-zA-Z0-9_\.\-]+)[\'|\"]*/\1/n,node/
--regex-puppet=/^[[:space:]]*define[[:space]]*([a-z][a-zA-Z0-9_:\-]+)/\1/d,definition/
@davewongillies
davewongillies / recipe.rb
Created Apr 22, 2016 — forked from mlafeldt/recipe.rb
Package Go tools with fpm-cookery (automatically uses godep dependencies if present)
View recipe.rb
class ChefRunner < FPM::Cookery::Recipe
GOPACKAGE = "github.com/mlafeldt/chef-runner"
name "chef-runner"
version "0.8.0"
revision 1
source "https://#{GOPACKAGE}/archive/v#{version}.tar.gz"
sha256 "a7de23f989f8353ecf838b551a8ceff09b83c8aeff2553b2c31d57615f8fcc53"
description "The fastest way to run Chef cookbooks"
@davewongillies
davewongillies / tmux.md
Created Apr 22, 2016 — forked from andreyvit/tmux.md
tmux cheatsheet
View tmux.md

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

# remap prefix to Control + a
View collectd-rabbitmq.xml
<!-- note that this requires the rabbitmq management plugin -->
<!-- also requires collectd 5.1 with curl_json plugin support -->
<Plugin curl_json>
<URL "http://localhost:55672/api/overview">
Instance "rabbitmq_overview"
User "guest"
Password "guest"
<Key "message_stats/publish">
Type "counter"
</Key>
You can’t perform that action at this time.