Skip to content

Instantly share code, notes, and snippets.

View davidlowry's full-sized avatar

David Lowry davidlowry

View GitHub Profile
@davidlowry
davidlowry / gist:53812a983392b7d8dc8453ba317ac80d
Created December 7, 2023 17:06
Installing MySQL gem for Rails bundler on Mac Silicon
# Install rails, mysql, etc by homebrew using this guide https://gorails.com/setup/macos/10.14-mojave - but if you require mysql and can't upgrade to Trilogy, this is required (and not in the guide at time of writing)
# With credit to Chris Oliver @excid3 at Go Rails
mysql_version=$(brew list --versions mysql | tr ' ' '\n' | tail -1)
mysql_path=$(brew --cellar mysql)/$mysql_version
gem install mysql2 -- \
--with-mysql-lib=$mysql_path/lib \
--with-mysql-dir=$mysql_path \
@davidlowry
davidlowry / ffmpeg-minimalist-build-nvenc-static.md
Last active February 17, 2017 09:07
This gist will show you how to build a minimalist, statically-linked ffmpeg binary under the ~/bin subdirectory on your home on Ubuntu 16.04LTS.

Minimalist static FFmpeg build on Ubuntu 16.04 with Nvidia NVENC enabled.

Original guide with a standard build is here.

With this guide, I'm adding more instructions to enable support for NVIDIA CUVID and NVIDIA NPP for enhanced encode and decode performance.

First, prepare for the build and create the work space directory:

cd ~/

@davidlowry
davidlowry / gist:7175788
Created October 26, 2013 23:22
Odd behaviour from 'brew install postgres' instead of '... postgresql' Expected?
mbp:register.something david$ brew install postgres
==> Installing postgresql dependency: ossp-uuid
==> Downloading ftp://ftp.ossp.org/pkg/lib/uuid/uuid-1.6.2.tar.gz
^C
mbp:register.something david$ brew install postgres
==> Installing postgresql dependency: ossp-uuid
==> Downloading ftp://ftp.ossp.org/pkg/lib/uuid/uuid-1.6.2.tar.gz
^C
mbp:register.something david$ brew install postgres --verbose
==> Installing postgresql dependency: ossp-uuid
@davidlowry
davidlowry / ezpdf-example-with-links
Created October 21, 2013 08:44
Simplest ezPDF sample including links.
@davidlowry
davidlowry / gist:6932623
Created October 11, 2013 10:26
Add a link to a PHP ezPDF output
$text = "To insert a link, you <c:alink:http://infinity21.net>use the <c:slink:http://infinity21.net>link text</c:slink >format";
$pdf->ezText($text,18,array('justification'=>'centre'));
@davidlowry
davidlowry / gist:4225665
Created December 6, 2012 16:11
Rails 3 Scopes - Show Posts With Children Only
# this gets the last five "bookings"
scope :recent, lambda {|quantity| limit(5).order('id DESC')}
# I want to only fetch bookings that are valid for purchase, i.e. they have "festival tickets" reserved for campers.
# how do I get the five latest "bookings" _that have camper tickets_?
# ref - http://stackoverflow.com/questions/8250451/rails3-scope-for-count-of-children-in-has-many-relationship
scope :with_children, joins(:campers).
@davidlowry
davidlowry / gist:3804436
Created September 29, 2012 15:54
VirginMedia is broken
twentyfour:g11 dave$ traceroute www.virginmedia.com
traceroute to www.virginmedia.com (212.250.162.12), 64 hops max, 52 byte packets
1 192.168.1.1 (192.168.1.1) 1.151 ms 0.877 ms 0.781 ms
2 10.5.128.1 (10.5.128.1) 9.196 ms 9.534 ms 7.991 ms
3 belf-core-1b-ae2-2468.network.virginmedia.net (213.105.207.141) 12.069 ms 14.172 ms 9.615 ms
4 dubl-bb-1b-ae0-0.network.virginmedia.net (212.43.163.205) 12.367 ms 12.247 ms 11.926 ms
5 manc-bb-1b-as10-0.network.virginmedia.net (213.105.159.126) 15.737 ms 14.388 ms 13.897 ms
6 winn-bb-1a-as3-0.network.virginmedia.net (212.43.163.190) 22.198 ms 21.469 ms 20.106 ms
7 winn-dcore-1a-tenge100.network.virginmedia.net (212.43.163.134) 21.245 ms 21.111 ms 22.468 ms
8 * * *
.regular_body p img { position: relative; left: -50%; }
@davidlowry
davidlowry / Snow Leopard bug
Created February 25, 2011 23:32
BBC Sport Flash Player crashes in Safari Snow Leopard. URL http://news.bbc.co.uk/sport1/hi/football/football_focus/9407763.stm has plugin crash. In Chrome first play was 1.5x speed (pause, refresh, worked correctly)
Process: WebKitPluginHost [7726]
Path: /System/Library/Frameworks/WebKit.framework/WebKitPluginHost.app/Contents/MacOS/WebKitPluginHost
Identifier: com.apple.WebKit.PluginHost
Version: 6533 (6533.13)
Build Info: WebKitPluginHost-75331300~12
Code Type: X86 (Native)
Parent Process: WebKitPluginAgent [459]
PlugIn Path: /Library/Internet Plug-Ins/Flash Player.plugin/Contents/PlugIns/FlashPlayer-10.6.plugin/Contents/MacOS/FlashPlayer-10.6
PlugIn Identifier: com.macromedia.FlashPlayer-10.6.plugin
#giantslive.tv
def its_saturday_night
true
end
def its_gamenight
true
end