Skip to content

Instantly share code, notes, and snippets.

@richard-scott
richard-scott / ec2-fingerprint-key
Created Dec 7, 2016 — forked from jtriley/ec2-fingerprint-key
Simple Python script that computes both public and private RSA key fingerprints as used by Amazon EC2
View ec2-fingerprint-key
#!/usr/bin/env python
import hashlib
import optparse
import paramiko
from Crypto.PublicKey import RSA
def insert_char_every_n_chars(string, char='\n', every=64):
return char.join(
View lambdaAMIBackups.py
# Automated AMI Backups
#
# @author Robert Kozora <bobby@kozora.me>
#
# This script will search for all instances having a tag with "Backup" or "backup"
# on it. As soon as we have the instances list, we loop through each instance
# and create an AMI of it. Also, it will look for a "Retention" tag key which
# will be used as a retention policy number in days. If there is no tag with
# that name, it will use a 7 days default value for each AMI.
#
@richard-scott
richard-scott / disable_troublesom_scaling_processes.py
Created Mar 2, 2017 — forked from simon-weber/disable_troublesom_scaling_processes.py
disable ASG scaling processes during CodeDeploy deploys
View disable_troublesom_scaling_processes.py
"""
Suspend an auto scaling group's scaling processes that can interfere with CodeDeploy deploys.
It assumes a single ASG per deployment group.
To use this:
* create a lambda function with this code, then hook up it up to an SNS topic that receives all deployment events (but not host events).
* attach that topic as a trigger in your deployment groups.
Unlike AWS's in-appspec approach, this supports arbitrary deploy concurrency.
View debian-vps-configuration.md

Debian

Locale

Annoying message?

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
	LANGUAGE = (unset),
@richard-scott
richard-scott / mk-eph.sh
Created Apr 24, 2017 — forked from taavituisk/mk-eph.sh
Make ephemeral swap and tmp.
View mk-eph.sh
#!/bin/bash
# mk-eph.sh
# Creates a lvm volume over all ephemeral devices.
# Swap related operations
function SwapEnabler() {
local swapdev='/dev/ephemeral/swap'
local swapon="$(swapon -s | wc -l)"
# See if some swap is enabled already.
@richard-scott
richard-scott / extract-123-reg-zonefile.js
Created Jan 24, 2018 — forked from biinari/extract-123-reg-zonefile.js
Script to extract the DNS entries from 123-reg advanced dns page
View extract-123-reg-zonefile.js
var table = document.getElementsByClassName('advanced_dns')[0];
var rows = table.getElementsByTagName('tr');
var i, len, row;
var hostname, type, priority, ttl, destination;
var output = '';
output += '$TTL 600\n'; // start with default TTL
// skip header and last two rows (add new entry, delete all entries)
for (i = 1, len = rows.length - 2; i < len; i++) {
@richard-scott
richard-scott / nodejs_installer.ps1
Created Apr 20, 2018 — forked from noelmace/nodejs_installer.ps1
Powershell script installing nodejs (with git) and some npm packages
View nodejs_installer.ps1
write-host "`n ## NODEJS INSTALLER ## `n"
### CONFIGURATION
# nodejs
$version = "4.4.7-x64"
$url = "https://nodejs.org/dist/latest-v4.x/node-v$version.msi"
# git
$git_version = "2.9.2"
@richard-scott
richard-scott / results.txt
Created May 17, 2018 — forked from dropwhile/results.txt
python compression comparison
View results.txt
Data Size:
Input: 2074
LZ4: 758 (0.37)
Snappy: 676 (0.33)
LZF: 697 (0.34)
ZLIB: 510 (0.25)
LZ4 / Snappy: 1.121302
LZ4 / LZF: 1.087518
LZ4 / ZLIB: 1.486275
Benchmark: 50000 calls
@richard-scott
richard-scott / time-function.ps1
Created Jun 14, 2018 — forked from bender-the-greatest/time-function.ps1
Alternative implementation of Measure-Command, works similarly to Linux `time` command
View time-function.ps1
# Alternative (improved?) implementation of Measure-Command
# Works similarly to the Linux/Unix `time` command
#
# Function which times how long a command takes to completion
# Note that this function outputs to Write-Host so as to
# protect the proper return value. Note that a time will be
# returned even if the command fails.
#
# Unless `-quiet` is specified, command output is sent directly
# to `Write-Host` to allow for the simultaneous return of the
@richard-scott
richard-scott / hack.sh
Created Jun 25, 2018 — forked from garethrees/hack.sh
OSX For Hackers
View hack.sh
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2470157/hack.sh | sh
#