Skip to content

Instantly share code, notes, and snippets.

View jamesmacfie's full-sized avatar

James Macfie jamesmacfie

  • Featherston, New Zealand
View GitHub Profile
jamesmacfie / index.js
Created October 25, 2019 03:15
Rubbish wee scraper for getting recent Drone build details
// Required to `view more`. Let this run for a while.
window.setInterval(() => {
var b = document.querySelector('.more-button');
if (b);
// Now grab the details
var builds = document.querySelector('.builds >.build');
var result = Array.from(document.querySelectorAll('.builds > .build')).map((b) => {
jamesmacfie /
Created October 22, 2019 02:53
iTerm 2 - script to change theme depending on Mac OS dark mode

How to use

In iTerm2, in the menu bar go to Scripts > Manage > New Python Script

Select Basic. Select Long-Running Daemon

Give the script a decent name (I chose

Save and open the script in your editor of choice.

jamesmacfie /
Last active April 30, 2020 04:42
🙌 Drone

Drone prettier

What this does

  • makes the console full width by default
  • makes the left column wider
  • auto clicks the "view more" button
  • adds in CSS classes for colour
  • adds the correct CSS to display build logs in a more sane way
jamesmacfie / index.js
Created July 26, 2018 21:46
Only display refurbished Apple laptops with 16GB RAM and 512GB HDD
// Post this in your console
[]'.box-content').querySelectorAll('table'), (n) => {
if (n.innerText.indexOf('16GB') === -1 || n.innerText.indexOf('512GB') === -1) { = 'none';
jamesmacfie / script.applescript
Created June 21, 2018 00:51
Use iTerm as terminal in Alfred
on alfred_script(q)
if application "iTerm2" is running or application "iTerm" is running then
run script "
on run {q}
tell application \"\"
select first window
set onlywindow to true
on error
jamesmacfie / urghStuff.js
Created June 15, 2018 00:09
Find the most negative comment on articles
const findTheMostNegativeComment = () => {
const voteVals = [];
const votes = document.querySelectorAll('.gig-comment-vote-total');
[], (v) => {
const val = v.innerHTML;
if (val.charAt(0) === '-') {
text: val,
total: parseInt(val.slice(1)),
el: v
jamesmacfie /
Last active March 2, 2017 01:13
How to publish a new version of the recorder

How to publish a new version of the recorder

Open the PointGrayRecorder solution in Chimera

It lives at Lol.

Alter the server app post build step

I've never got the post build steps to run. When I first got the recorder setup on my machine with Bob's help we simply deleted the code in here as it wasn't needed for the ServerApp project. So you should just do this too. Only thing to remember here is to not commit this change.

Keybase proof

I hereby claim:

  • I am jamesmacfie on github.
  • I am jamesmacfie ( on keybase.
  • I have a public key whose fingerprint is 3DBC CE0A 6225 4904 FD17 7148 57BF 3CF5 BE37 BAA6

To claim this, I am signing this object:

jamesmacfie / regex.js
Created December 21, 2014 18:54
A small .js regex to get a string between two characterse
// Example usage
"This is my {string}".match(/{(.*)}/).pop(); // string
// Example function
function extractString(string, startChar, endChar) {
var re = new RegExp([startChar, '(.*)', endChar].join(''));
return string.match(re);
jamesmacfie / gist:612aa74421fad6545989
Created December 9, 2014 08:29
Fix OSX copy paste issue
# Simply restart the pboard daemon
launchctl stop
launchctl start
# Followed by restarting whichever app is being a dick