Skip to content

Instantly share code, notes, and snippets.

@mikechau
mikechau / ecs-run
Created October 29, 2017 08:19 — forked from vcastellm/ecs-run
Run task and wait for result in AWS ECS
#!/usr/bin/env bash
set -e
function usage() {
set -e
cat <<EOM
##### ecs-run #####
Simple script for running tasks on Amazon Elastic Container Service
One of the following is required:
Required arguments:
@mikechau
mikechau / circle-lock.sh
Created August 21, 2017 09:07 — forked from acmcelwee/circle-lock.sh
Workflows-friendly adaptation of CircleCI's build locking https://github.com/bellkev/circle-lock-test
#!/usr/bin/env bash
set -o xtrace -o errexit -o pipefail -o nounset
########################################################################################
# CircleCI's current recommendation for roughly serializing a subset
# of build commands for a given branch
#
# circle discussion thread - https://discuss.circleci.com/t/serializing-deployments/153
# Code from - https://github.com/bellkev/circle-lock-test
@mikechau
mikechau / iptables_rules.sh
Created December 5, 2016 20:34 — forked from virtualstaticvoid/iptables_rules.sh
25 Most Frequently Used Linux IPTables Rules Examples
# Modify this file accordingly for your specific requirement.
# http://www.thegeekstuff.com
# 1. Delete all existing rules
iptables -F
# 2. Set default chain policies
iptables -P INPUT DROP
iptables -P FORWARD DROP
iptables -P OUTPUT DROP
@mikechau
mikechau / arch-linux-encrypted-kernel-downgrade
Created November 27, 2016 18:19 — forked from sieste/arch-linux-encrypted-kernel-downgrade
Minimal instructions for kernel downgrade on arch linux with full system encryption using dm-crypt and luks
# Kernel downgrade on ARCH Linux with encrypted file-system
#
# assumes you followed https://gist.github.com/mattiaslundberg/8620837 to set up your system
#
# Credits:
# https://stephentanner.com/restoring-grub-for-an-encrypted-lvm.html
# https://wiki.archlinux.org/index.php/Kernel_Panics
# Boot into archiso live USB
@mikechau
mikechau / arch-linux-install
Created November 27, 2016 18:19 — forked from mattiaslundberg/arch-linux-install
Minimal instructions for installing arch linux on an UEFI system with full system encryption using dm-crypt and luks
# Install ARCH Linux with encrypted file-system and UEFI
# The official installation guide (https://wiki.archlinux.org/index.php/Installation_Guide) contains a more verbose description.
# Download the archiso image from https://www.archlinux.org/
# Copy to a usb-drive
dd if=archlinux.img of=/dev/sdX bs=16M && sync # on linux
# Boot from the usb. If the usb fails to boot, make sure that secure boot is disabled in the BIOS configuration.
# Set swedish keymap
@mikechau
mikechau / pulseaudio-audinst-hudmx2.md
Created November 19, 2016 05:28 — forked from puleglot/pulseaudio-audinst-hudmx2.md
Audinst HUD-mx2 workaround for pulseaudio

Intro

The first alternate setting reported by Audinst HUD-mx2 is an AC-3 setting (see lsusb -v output). It seems that pulseaudio always picks the first alternate setting by default, so we need to manually point it to the right PCM device.

pulseaudio profile

/etc/pulse/profile-HUDmx2.conf contents:

# http://mailman.alsa-project.org/pipermail/alsa-devel/2013-July/063676.html

[General]
auto-profiles = yes
@mikechau
mikechau / taskdef.json
Created November 19, 2016 05:22 — forked from corentone/taskdef.json
Logentries ECS definition
{
"containerDefinitions": [
{
"volumesFrom": [],
"portMappings": [],
"command": [
"-t <TOKEN>",
"-j",
"--skipByName ecs-agent"
],
Get the Heroku db as detailed here:
http://devcenter.heroku.com/articles/pgbackups#exporting_via_a_backup
1. heroku pgbackups:capture --expire
2. heroku pgbackups:url <backup_num> #=>backup_url
- get backup_num with cmd "heroku pgbackups"
3. curl -o latest.dump <backup_url>
Then locally do:
$ pg_restore --verbose --clean --no-acl --no-owner -h localhost -U myuser -d mydb latest.dump