Skip to content

Instantly share code, notes, and snippets.

View nomisoft's full-sized avatar

Simon nomisoft

View GitHub Profile
// Vary crf value, higher value = smaller file size / less quality
ffmpeg -i input.mp4 -preset veryslow -crf 20 output.mp4
// Resize to 720px width, scale height and avoid "height not divisible by 2" errors
ffmpeg -i input.mp4 -filter:v scale="trunc(oh*a/2)*2:720" -c:a copy output.mp4
@nomisoft
nomisoft / gist:81a87c7eeff2282e4e5fb47e1bc1b12f
Created February 16, 2018 16:43
Git - List branches not yet merged into master
git branch --no-merged master --sort=-committerdate
@nomisoft
nomisoft / gist:d053252a451c6878b6dae87fead94874
Created February 16, 2018 16:41
Git - List branches sorted by latest commit
git for-each-ref --sort=-committerdate refs/heads/ --format='%(HEAD) %(color:yellow)%(refname:short)%(color:reset) - %(color:red)%(objectname:short)%(color:reset) - %(contents:subject) - %(authorname) (%(color:green)%(committerdate:relative)%(color:reset))'
find . -name 'version.php' -path '*wp-includes/*' -print -exec grep '$wp_version =' {} \; -exec echo '' \;
# Alias shortcut for php command line debugging, useful for debugging command line apps in PhpStorm
# Usage: phpdebug app/console mycommand
alias phpdebug="php -dxdebug.remote_enable=1 -dxdebug.remote_mode=req -dxdebug.remote_port=9000 -dxdebug.remote_host=127.0.0.1 -dxdebug.remote_connect_back=0"
@nomisoft
nomisoft / .bashrc
Last active August 29, 2015 14:07
Git Colourized Status in Terminal
# Add the branch name to the end of the path in the terminal and colour code it depending on git status
# Add the following to the end of .bashrc in your home directory
parse_git_colour() {
if [[ $(git status 2> /dev/null) =~ "nothing to commit" ]]; then
echo -ne "\033[0;33m"
else
echo -ne "\033[0;31m"
fi
}
@nomisoft
nomisoft / addon_wordpressversions.cgi
Created April 29, 2014 15:16
WHM WordPress Versions Plugin
#!/usr/bin/php -q
<?
#WHMADDON:wordpressversions:WordPress Versions
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>WordPress Versions</title>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<link rel='stylesheet' type='text/css' href='/cPanel_magic_revision_0/combined_optimized.css' /><link rel='stylesheet' type='text/css' href='/cPanel_magic_revision_0/themes/x/style_optimized.css' /><link rel='stylesheet' type='text/css' href='/cPanel_magic_revision_0/yui/datatable/assets/skins/sam/datatable.css' /><style>.sortable th, .sortable td { padding: 5px; }</style>
@nomisoft
nomisoft / SimpleImage.php
Created April 29, 2014 15:13
PHP Image Resizing Script
<?php
/*
* File: SimpleImage.php
* Author: Simon Jarvis
* Copyright: 2006 Simon Jarvis
* Date: 08/11/06
* Link: http://www.white-hat-web-design.co.uk/articles/php-image-resizing.php
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@nomisoft
nomisoft / CurrencyConverter.php
Created April 29, 2014 15:13
PHP Currency Conversion Script
<?php
/*
* File: CurrencyConverter.php
* Author: Simon Jarvis
* Copyright: 2005 Simon Jarvis
* Date: 10/12/05
* Link: http://www.white-hat-web-design.co.uk/articles/php-currency-conversion.php
*
* This program is free software; you can redistribute it and/or