Skip to content

Instantly share code, notes, and snippets.

View jadaradix's full-sized avatar
🙂
existing

James Garner jadaradix

🙂
existing
View GitHub Profile
@jadaradix
jadaradix / index.html
Last active August 19, 2023 13:51
Safari-esque HTML/CSS Browser frame for embedding an <iframe>
<html>
<head>
<title>Web Browser</title>
<style>
body {
margin: 24px;
}
.browser {
font-family: system, -apple-system, ".SFNSDisplay-Regular", "Helvetica Neue", "Lucida Grande", sans-serif;
font-size: 14px;
@jadaradix
jadaradix / yosemite-subl
Last active January 25, 2022 05:22
Fix Sublime's "subl" command on OS X Yosemite.
rm /usr/local/bin/subl;
sudo ln -s "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" /usr/local/bin/subl;
"use strict";
var fs = require("fs");
let getLines = function getLines (filename, lineCount, callback) {
let stream = fs.createReadStream(filename, {
flags: "r",
encoding: "utf-8",
fd: null,
mode: 438, // 0666 in Octal
@jadaradix
jadaradix / mkv.sh
Created June 30, 2017 13:06
Convert Blu-ray m2ts files to mkv with MKVToolNix/mkvmerge
# . mkv.sh "xyz/BDMV/STREAM" "~/fs";
cd "$1";
for i in *.m2ts; do
mkvmerge -o "$2/$i.mkv" $i;
done
cd -;
docker pull eu.gcr.io/euphoric-adventures/uk-train-boards_ukrsib:latest;
docker stop ukrsib;
docker rm ukrsib;
docker run --name ukrsib --net routing -v ~/uktb/app:/var/www/htdocs/ -d eu.gcr.io/euphoric-adventures/uk-train-boards_ukrsib;
docker stop uk-train-boards_nginx;
docker rm uk-train-boards_nginx;
docker run --name uk-train-boards_nginx -p 10080:10080 --net routing -v ~/uktb/app:/var/www/htdocs/ -v ~/uktb/docker/nginx.conf:/etc/nginx/conf.d/default.conf -d nginx;
# docker tag uk-train-boards_ukrsib eu.gcr.io/euphoric-adventures/uk-train-boards_ukrsib:latest;
@jadaradix
jadaradix / install-node.sh
Last active December 29, 2017 03:48
One step install of node.js 5.1.0 for Linux/Mac (OS X - use "darwin" for THIS_PLATFORM)
THIS_VERSION="9.3.0";
THIS_PLATFORM="linux";
echo "Downloading node.js tar...";
wget https://nodejs.org/dist/v$THIS_VERSION/node-v$THIS_VERSION-$THIS_PLATFORM-x64.tar.xz -O node;
echo "Untarring node.js tar 'node'...";
tar xf node;
echo "Deleting node.js tar 'node'...";
@jadaradix
jadaradix / git-print-current-branch.sh
Created July 3, 2017 13:22
git print current branch
git branch | grep \* | cut -d ' ' -f2
@jadaradix
jadaradix / black-screen-osx-vnc.sh
Created June 25, 2017 12:50
black-screen-osx-vnc.sh
sudo kill -9 $(ps auxwww | grep MacOS/loginwindow | grep james | head -1 | tr -s " " | cut -d " " -f 2)
@jadaradix
jadaradix / iMessage-sql.sh
Last active June 20, 2017 21:29
Create an SQL file (dump) of OS X iMessage messages.
echo ".dump" | sqlite3 ~/Library/Messages/chat.db > $(date +"%y-%m-%d").sql
@jadaradix
jadaradix / hapi-dynamic-cors.js
Created June 16, 2017 11:12
hapi-dynamic-cors.js
const Hapi = require('hapi');
const allowedOrigins = [];
const middleware = function addCorsHeaders (request, reply) {
// not cors
if (!request.headers.origin) {
return reply.continue()
}