Skip to content

Instantly share code, notes, and snippets.

View frodera's full-sized avatar

frodera frodera

  • 03:55 (UTC +10:00)
View GitHub Profile
figlet -c -f ~/.local/share/fonts/figlet-fonts/3d.flf $argv | lolcat
@martinky
martinky / Makefile
Last active March 18, 2022 03:28
Makefile used to run complete Ansible playbooks in parallel on individual hosts using make -jN with added timeout constraint.
HOSTS=host_a host_b
INVENTORY=../data/inventory.inv
PLAYBOOK=../playbooks/test.yml
TIMEOUT=600
deploy: all_hosts
all_hosts: $(HOSTS)
$(HOSTS):
@nmarley
nmarley / dec.py
Last active May 29, 2024 06:01
AWS KMS encryption/decryption using Python/Boto3
import boto3
import base64
if __name__ == '__main__':
session = boto3.session.Session()
kms = session.client('kms')
encrypted_password = 'AQECAHjgTiiE7TYRGp5Irf8jQ3HzlaQaHGYgsUJDaavnHcFm0gAAAGswaQYJKoZIhvcNAQcGoFwwWgIBADBVBgkqhkiG9w0BBwEwHgYJYIZIAWUDBAEuMBEEDDwxVQuG0oVwpkU7nQIBEIAoVGk1/wpserb+GVUOzE7PiL/Nr9fTDFKZfpKpF0ip2ct4B2q0Wn6ZZw=='
binary_data = base64.b64decode(encrypted_password)
@AdamOssenford
AdamOssenford / ansible-summary.md
Created January 18, 2016 00:50
This is an ANSIBLE Cheat Sheet from Jon Warbrick

An Ansible summary

Jon Warbrick, July 2014, V3.2 (for Ansible 1.7)

Configuration file

intro_configuration.html

First one found from of

@CMCDragonkai
CMCDragonkai / http_streaming.md
Last active May 27, 2024 22:57
HTTP Streaming (or Chunked vs Store & Forward)

HTTP Streaming (or Chunked vs Store & Forward)

The standard way of understanding the HTTP protocol is via the request reply pattern. Each HTTP transaction consists of a finitely bounded HTTP request and a finitely bounded HTTP response.

However it's also possible for both parts of an HTTP 1.1 transaction to stream their possibly infinitely bounded data. The advantages is that the sender can send data that is beyond the sender's memory limit, and the receiver can act on

@brendanhay
brendanhay / tmux-copy-mode-osx.md
Created February 8, 2012 14:15
Tmux, copy-mode, and OSX shenanigans.

Copy, with line wrapping!

If you've been trying to copy/paste text from a multi-pane tmux session with the mouse, you've probably been pretty pissed at the blissful ignorance a terminal application has of the rodent in your hand.

The alternative, which is quote-unqoute native copy/pasting using copy-mode takes a bit to get used to. So this is one solution for copying and pasting lines from a session with correct line wrapping behaviour, albeit keyboard only.

Disclaimer

Since copy-mode has similar concepts of marks, regions, and temp buffers to Emacs .. you'll probably find it straight forward if you're familar with Emacsen. For people using vi-mode in tmux, the same still applies but obviously the default key bindings will differ alot from what I show below.

@jawnb
jawnb / populate_dns.py
Created August 12, 2011 03:35
Script to populate route53 DNS records from ec2 instance id and instance names.
#!/usr/bin/env python
import boto
from boto.route53.record import ResourceRecordSets
import logging
conn = boto.connect_ec2()
DNS_EXCLUSION_TAG = 'ExcludeFromDNS' # If this tag exists on an instance, no DNS values will be populated
DNS_TAGS = ['ShortName', 'Name'] # This is the list of instance tags we want to populate DNS entries from
DNS_SUFFIX = 'YOUR_SUBDOMAIN_HERE' # Suffix under which to create DNS records
ROUTE53_ZONE_ID = 'YOUR_ZONE_ID_HERE' # The zone id from route53 of the zone we will be adding these entries under
@tommyh
tommyh / json_matcher.rb
Created May 18, 2011 02:01
Rspec Matcher: Valid Json
#in controller test
# response.body.should be_valid_json
RSpec::Matchers.define :be_valid_json do
match do |actual|
JSON.parse(actual)
end
end
@lusis
lusis / dba-user.json
Created January 7, 2011 11:24
Managing MySQL user accounts with Chef
{
"id":"dbauser",
"uid":506,
"comment":"DBA User",
"shell":"/bin/bash",
"groups": [
"sysadm",
"dba"
],
"ssh_key": "XXXXXXXXXX"
@jordansissel
jordansissel / Makefile
Created January 3, 2011 11:11
Building .debs without debian policy/code infections
DEBDIR=deb-build
create-package-deb: pre-create-package VERSION xdo_version.h
[ -d $(DEBDIR) ] && rm -r $(DEBDIR)
$(MAKE) install DESTDIR=$(DEBDIR) PREFIX=/usr INSTALLMAN=/usr/share/man
$(MAKE) create-package-deb-xdotool
# Package 'xdotool*.deb'
create-package-deb-xdotool: $(DEBDIR)/usr $(DEBDIR)/xdotool
$(MAKE) $(DEBDIR)/xdotool/data.tar.gz $(DEBDIR)/xdotool/control.tar.gz \
$(DEBDIR)/xdotool/debian-binary