Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env bash
# set -x
PRIMARY_BRANCH='master'
if [ -n "$(git branch -l main)" ]; then
PRIMARY_BRANCH=main
fi
BRANCH=$(git symbolic-ref --short HEAD)
BASEBRANCH=${1:-$PRIMARY_BRANCH}
@DanCech
DanCech / git-backport
Created June 25, 2018 18:06
git-backport
#!/bin/bash
set -e
# set -x
TOKEN=$(git config --get github.token)
if [ -z "$TOKEN" ]; then
echo 'Please create a personal github token and add it to your git config with git config --global github.token <token>'
echo 'https://github.com/settings/tokens'
exit 1
fi
location / {
if ($request_method = 'OPTIONS' ) {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'Content-Type, Origin, Accept, User-Agent, Cache-Control, Keep-Alive';
add_header 'Content-Length' 0;
add_header 'Content-Type' 'text/plain charset=UTF-8';
return 204;
}
@DanCech
DanCech / git-cleanup
Last active May 24, 2016 15:02
Git branch cleanup script
#!/bin/sh
git remote prune origin
git branch --merged | grep -v master | grep -v '[*]' | xargs -r git branch -d

Keybase proof

I hereby claim:

  • I am dancech on github.
  • I am aussiedan (https://keybase.io/aussiedan) on keybase.
  • I have a public key whose fingerprint is 17BD CF72 184C D7E8 6D23 314B FE70 C70F AD1A 568C

To claim this, I am signing this object:

@DanCech
DanCech / ddns.php
Last active November 3, 2016 19:05
NSONE Dynamic DNS update helper
<?php
/*
* NSONE Dynamic DNS update helper
* Dan Cech <dan@aussiedan.com>
*/
// check a password was provided
if (empty($_SERVER['PHP_AUTH_PW'])) {
header('WWW-Authenticate: Basic realm="DDNS"');