Skip to content

Instantly share code, notes, and snippets.

@rmtsrc
rmtsrc / webhook_endpoint.js
Last active September 27, 2015 10:32
Node validate GitHub webhook SHA1 HMAC
var crypto = require('crypto'),
hmac = crypto.createHmac('sha1', 'GitHub Secret');
hmac.update(GitHub_POST_data);
console.log('sha1=' + hmac.digest('hex'));
@rmtsrc
rmtsrc / .bash_profile
Created September 27, 2015 10:31
Homebrew update brew and brew cask installs
alias brew-up='brew update && brew upgrade --all && brew-cask-upgrade && brew cask cleanup && brew cleanup'
@rmtsrc
rmtsrc / Ride with GPS GPX Route cuesheet to Garmin TCX.xsl
Created September 27, 2015 17:06
Converts a Ride with GPS GPX Route cuesheet into a format that can be used within a Garmin TCX file
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:gpx="http://www.topografix.com/GPX/1/1">
<xsl:template match="/">
<TrainingCenterDatabase xmlns="http://www.garmin.com/xmlschemas/TrainingCenterDatabase/v2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.garmin.com/xmlschemas/TrainingCenterDatabase/v2 http://www.garmin.com/xmlschemas/TrainingCenterDatabasev2.xsd">
<Courses>
<Course>
<xsl:for-each select="//gpx:rtept">
<CoursePoint>
<Name><xsl:value-of select="gpx:name"/></Name>
<Time>2000-01-01T00:00:00Z</Time>
@rmtsrc
rmtsrc / .bash_aliases
Last active July 22, 2016 13:19
Raspberry Pi alias for full system update
alias pi-up="sudo apt-get update && sudo apt-get upgrade && sudo apt-get dist-upgrade && sudo rpi-update && sudo apt-get autoremove && sudo apt-get autoclean && sudo apt-get clean"
@rmtsrc
rmtsrc / u2f-ssh.md
Created February 20, 2016 13:38
Enabling SSH U2F authentication

SSH authentication via U2F

Enabling SSH U2F authentication.

After some research online I've found a patch to the OpenSSH server that enables U2F authentication.

However there are 2 major caveats that would stop me from using this in a production environment:

  • Security - the patch for OpenSSH has not yet been accepted/merged and currently works on an older version of OpenSSH
  • Currently doesn't work on Mac OS, though maybe possible once Homebrew/legacy-homebrew#43676 is resolved
@rmtsrc
rmtsrc / postgres-json-cheatsheet.md
Last active October 22, 2023 12:16
Using JSON in Postgres by example

PostgreSQL JSON Cheatsheet

Using JSON in Postgres by example.

Quick setup via Docker

  1. Download and install: Docker Toolbox
  2. Open Docker Quickstart Terminal
  3. Start a new postgres container:
    docker run --name my-postgres -e POSTGRES_PASSWORD=mysecretpassword -d postgres
@rmtsrc
rmtsrc / mac-init.sh
Last active May 23, 2016 15:36
My Mac init bashings
# @TODO Try using: https://github.com/boxen/our-boxen/
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" \
&& brew tap caskroom/cask \
&& brew cask install google-chrome keepassx atom megasync \
&& apm install Sublime-Style-Column-Selection atom-beautify editorconfig expand-region highlight-line highlight-selected jshint language-docker language-patch minimap minimap-git-diff monokai react script seti-ui title-case \
&& brew install ack ansible tree android-platform-tools node vim bash-completion openssl wakeonlan wget git z \
&& brew cask install android-file-transfer firefox startninja appcleaner franz flycut mactracker macvim the-unarchiver mattr-slate vagrant virtualbox virtualbox-extension-pack rowanj-gitx vlc xquartz dockertoolbox imageoptim sourcetree iterm2 \
&& curl -sSL https://raw.githubusercontent.com/sebflipper/dotfiles/master/install | bash \
&& source ~/.bash_profile \
&& mac-up && brew-up
# Updates, Homebrew & Cask
alias update='mac-up && brew-up && apm update --confirm false'
alias mac-up='sudo softwareupdate --install --all'
alias brew-cask-upgrade='for c in `brew cask list | grep -v "(\!)"`; do ! brew cask info $c | grep -qF "Not installed" || brew cask install $c; done'
alias brew-up='brew update && brew upgrade && brew-cask-upgrade && brew cask cleanup && brew cleanup'
#!/bin/bash
set -e
FQDN[0]="test.example.com"
FQDN[1]="test2.example.com"
for hn in "${FQDN[@]}"
do
echo $hn
mkdir $hn.ssl
@rmtsrc
rmtsrc / index.js
Created January 23, 2017 17:21
Get a Browser Cookie
// @see http://stackoverflow.com/a/15724300
export default (cookieName) => {
const value = `; ${document.cookie}`;
const parts = value.split(`; ${cookieName}=`);
if (parts.length === 2) {
return parts.pop().split(';').shift();
}
};