Skip to content

Instantly share code, notes, and snippets.

View settermjd's full-sized avatar

Matthew Setter settermjd

View GitHub Profile
@settermjd
settermjd / backport-pr.sh
Created February 13, 2018 10:41
Script to backport a PR to branch (used mainly for working with the ownCloud documentation)
#!/bin/bash
set -e
# Script to backport a PR to branch
# ./backport-pr.sh backportTo backportFrom prId
# This script requires two other tools:
# - github-api-tools
# - git-backport
# add your GitHub credentials

Keybase proof

I hereby claim:

  • I am settermjd on github.
  • I am settermjd (https://keybase.io/settermjd) on keybase.
  • I have a public key ASAL6A3SHjLSE8X0cePFas3u7nE7xwlxHc4mxwkFNNj2ugo

To claim this, I am signing this object:

@settermjd
settermjd / git-delete-branches.sh
Created January 17, 2018 11:34
Delete branches matching the provided pattern
#!/bin/bash
if (( $# != 1 ))
then
echo "Not enough arguments supplied."
echo " usage: git-delete-branches <branch pattern to search on>"
exit
fi
BRANCH_PATTERN=$1
@settermjd
settermjd / custom.zsh
Created December 12, 2017 11:13
Custom ZSH functions for working with the ownCloud documentation
# Simple function to search the ownCloud docs for a text string
function search_docs() {
if (( $# == 0 )); then
echo "Not enough arguments supplied."
echo " usage: search_docs <string to find>"
return -1;
fi
echo "Searching ownCloud documentation for: '$1'"
grep -rin "$1" $DOCS_HOME/*_manual/ --include="*rst"
@settermjd
settermjd / filter-images-by-width.sh
Created November 30, 2017 13:52
Find images whose width is greater than X
#!/bin/bash
set -e
# Set the width from the first argument (could do this with getopts).
width=$1
# Filter the images using a combination of file and awk.
file images/* | awk -v width="$width" '{ if ($5 > width) print $1 }' | tr -d ':'
@settermjd
settermjd / retrieve-github-pr-commit-hashes.sh
Created November 28, 2017 15:56
Retrieve the commit hashes for a GitHub PR and output them on a single line. Suitable for use with git cherry-pick, etc.
#!/bin/bash
$username=<your username>
$password=<your password>
$owner=<repository owner>
$repo=<repository>
$pull_request_id=<pull request id to filter by>
curl --silent -u $username:$password https://api.github.com/repos/$owner/$repo/pulls/$pull_request_id/commits \
| jq --raw-output '.[].sha' | tr '\r\n' ' '
@settermjd
settermjd / vim-cheatsheet.md
Created November 24, 2017 10:28
VIM Cheatsheet

This is a cheatsheet with little bits and pieces that I've picked up along with way in VIM. I hope that you find it helpful.

Regexes

Split each sentences in a paragraph onto a newline. It only does a simplistic determination of a sentence, that being a full-stop, followed by a space and a capital letter.

:'&lt;,'&gt;s/\. \(\u\)/.\r\1/g
@settermjd
settermjd / generate-commit-range.sh
Created August 9, 2017 09:15
Generate a git commit frange
git log --format=%h stable10..master | (head -n1 && tail -n1) | xargs -n 2 | awk '{ print $1".."$2 }'
@settermjd
settermjd / phpinfo
Created September 16, 2016 17:05
phpinfo
phpinfo()
PHP Version => 7.0.8
System => Linux c179beb02e97 4.4.20-moby #1 SMP Thu Sep 15 12:10:20 UTC 2016 x86_64
Build Date => Jun 23 2016 23:50:23
Configure Command => './configure' '--with-config-file-path=/usr/local/etc/php' '--with-config-file-scan-dir=/usr/local/etc/php/conf.d' '--enable-fpm' '--with-fpm-user=www-data' '--with-fpm-group=www-data' '--disable-cgi' '--enable-mysqlnd' '--enable-mbstring' '--with-curl' '--with-libedit' '--with-openssl' '--with-zlib'
Server API => Command Line Interface
Virtual Directory Support => disabled
Configuration File (php.ini) Path => /usr/local/etc/php
Loaded Configuration File => /usr/local/etc/php/php.ini
@settermjd
settermjd / Dockerfile
Last active September 16, 2016 17:15
Docker Compose configuration
FROM interactivesolutions/zf-php-fpm:7.0
ENV PHP_MODULES /usr/local/lib/php/extensions/no-debug-non-zts-20151012/
ENV XDEBUG_CONFIG /usr/local/etc/php/conf.d/xdebug.ini
ENV XDEBUG_IDE_KEY PhpStorm
ENV XDEBUG_REMOTE_CONNECT_BACK 1
ENV XDEBUG_REMOTE_ENABLE true
ENV XDEBUG_REMOTE_HANDLER dbgp
ENV XDEBUG_REMOTE_PORT 9000