Skip to content

Instantly share code, notes, and snippets.

Matt Sephton gingerbeardman

View GitHub Profile
View macos-cycle-wireless.sh
DEVICE=$(networksetup -listallhardwareports | grep -A 2 -E "AirPort|Wi-Fi" | grep -m 1 -o -e en[0-9]);
# turn them off...
networksetup -setairportpower $DEVICE Off
./blueutil off
# ...and on again
networksetup -setairportpower $DEVICE On
./blueutil on
View keybase.proof
### Keybase proof
I hereby claim:
* I am gingerbeardman on github.
* I am gingerbeardman (https://keybase.io/gingerbeardman) on keybase.
* I have a public key whose fingerprint is 876C A4D0 3068 5B7F 50C1 96DB A399 461C 25D7 0E39
To claim this, I am signing this object:
@gingerbeardman
gingerbeardman / 0x0.sh
Last active Apr 2, 2019
Simple cli tool to use https://0x0.st for ephemeral file uploads. Install: curl https://gist.githubusercontent.com/gingerbeardman/5398a5feee9fa1e157b827d245678ae3/raw/9ea5c714b41bdef77a8984bc91ff5d248c48d048/0x0.sh | sudo tee /usr/local/bin/0x0.sh && sudo chmod +x /usr/local/bin/0x0.sh
View 0x0.sh
#!/bin/sh
URL="https://0x0.st"
if [ $# -eq 0 ]; then
echo "Usage: 0x0.st FILE\n"
exit 1
fi
FILE=$1
@gingerbeardman
gingerbeardman / file.io.sh
Last active Apr 18, 2019 — forked from devster/file.io.sh
Simple cli tool to use file.io https://www.file.io/#one Install: curl https://gist.githubusercontent.com/gingerbeardman/a7737e4c89fccab8605f8538ddaeec0d/raw/a78f5253b0fcdbd7b893f91627a29498690356ea/file.io.sh | sudo tee /usr/local/bin/file.io && sudo chmod +x /usr/local/bin/file.io
View file.io.sh
#!/bin/sh
URL="https://file.io"
DEFAULT_EXPIRE="14d" # Default to 14 days
if [ $# -eq 0 ]; then
echo "Usage: file.io FILE [DURATION]\n"
echo "Example: file.io path/to/my/file 1w\n"
exit 1
fi
@gingerbeardman
gingerbeardman / scansnap-creator.md
Last active Apr 30, 2018
How to make Fujitsu's ScanSnap software recognise a PDF that you haven't scanned
View scansnap-creator.md
  1. Instal ExifTool: brew install exiftool
  2. Replace the Creator metadata: exiftool -Creator="ScanSnap Manager #S1300i" *.pdf
@gingerbeardman
gingerbeardman / macOS-Preview-Crop-PDF.md
Created Jan 1, 2018
Cropping the whole of a multi-page PDF using Preview on macOS X
View macOS-Preview-Crop-PDF.md
  1. Open multi-page PDF
  2. Select all pages (Cmd+A with focus in thumbnail sidebar)
  3. Tools > Rectangular Selection
  4. On single page drag to select area to crop
  5. Tools > Crop (or Cmd+K)

All pages are cropped identically!

@gingerbeardman
gingerbeardman / _generate.php
Created Dec 7, 2017
Normalise the size of fonts using the inverse of the Asc+Desc metric
View _generate.php
#!/usr/bin/env php
<?php
$dirs = glob("*", GLOB_ONLYDIR);
foreach ($dirs as $folder) {
echo $folder."\n";
$files = glob("$folder/*");
View package.sh
#!/bin/bash
DATE=`date +%Y%m%d%H%M%S`
defaults write "/Users/matt/Projects/Wire Hang/Info.plist" CFBundleVersion -string "$DATE"
cp "Info.plist" "Wire Hang Redux.app/Contents/"
cp "icons/Wire Hang Redux.icns" "Wire Hang Redux.app/Contents/Resources/"
touch "Wire Hang Redux.app"
xattr -cr "Wire Hang Redux.app"
codesign -f -s "3rd Party Mac Developer Application: Matt Sephton (A1B234CD5E)" "Wire Hang Redux.app"
productbuild --component "Wire Hang Redux.app" /Applications --sign "3rd Party Mac Developer Installer: Matt Sephton (A1B234CD5E)" "Wire Hang Redux.pkg"
spctl -a -v --type install "Wire Hang Redux.pkg"
@gingerbeardman
gingerbeardman / circle-to-circle-collision.phaser.js
Last active Jun 8, 2016
Circle-to-Circle collision test using Phaser JS framework
View circle-to-circle-collision.phaser.js
circleToCircle: function(obj1, obj2) {
return game.physics.arcade.distanceBetween(obj1, obj2) < (obj1.body.width/2 + obj2.body.width/2);
}
View embedded-tags.php
<?php
echo "<pre>";
$subject = "This is a test {pause}3{/pause} for embedded tags. {shake}1.5{/shake} Tada! {wait}keySpace{/wait}\n";
$pattern = "#{([\w]+)}(.*?){/\\1}\s#";
preg_match_all($pattern, $subject, $matches);
$split = preg_split($pattern, $subject);
print_r($subject);
You can’t perform that action at this time.