Skip to content

Instantly share code, notes, and snippets.

View ivanrad's full-sized avatar

ivanrad

  • Dublin, Ireland
View GitHub Profile
@ivanrad
ivanrad / pbcopy
Last active March 17, 2020 20:32
cygwin-style pbcopy/pbpaste
#!/bin/sh
exec cat > /dev/clipboard
@ivanrad
ivanrad / maketmpfs
Created October 8, 2015 15:05
maketmpfs (OS X)
#!/bin/bash
set -e
tmpfs_size=1024
tmpfs_target=$HOME/tmpfs
tmpfs_size_sectors=$(($tmpfs_size * 1024 * 1024 / 512))
tmpfs_dev=$(hdid -nomount ram://$tmpfs_size_sectors)
@ivanrad
ivanrad / good-news-everyone.txt
Last active November 12, 2015 15:27
good news everyone!
Bender: 001100010010011110100001101101110011
Bender: A woman like that you gotta romance first!
Bender: Ah crap, I'm some sort of robot!
Bender: Ah, computer dating. It's like pimping, but you rarely have to use the phrase 'upside your head'.
Bender: Ahhh, functional.
Bender: Alright! Closure!
Bender: An upgrade? I thought we all agreed I was perfect.
Bender: And I bet it's gonna get a lot more confusing.
Bender: And the awkward meter goes up another notch. Ding-ding-ding-ding.
Bender: Are all the tests gonna involve drinking?
@ivanrad
ivanrad / vimx
Created March 29, 2017 14:19
run vim w/ sudo if necessary
#!/bin/bash
for i; do
[ -e "$i" -a ! -w "$i" ] && exec sudo vim "$@"
done
exec vim "$@"
#!/bin/sh
host=$1
port=$2
retries=600
for i in `seq $retries`; do
nc -z $host $port >/dev/null && exit 0
sleep 0.1
done
@ivanrad
ivanrad / go
Created May 4, 2017 10:28
go runner
#!/usr/bin/env bash
: ${go_version:=1.8.1}
GOROOT=~/sdk/go$go_version exec ~/sdk/go$go_version/bin/go "$@"
@ivanrad
ivanrad / msi_schedule_reboot.js
Created June 30, 2017 14:32
MSI schedule reboot (wsh)
// @(#) msi_schedule_reboot.js
//
// Update an MSI so that a reboot action will be required after an install sequence completes.
//
// (c) Ivan Radanovic, <ivan.radanovic at gmail>
//
var msi_action = "ScheduleReboot"
var msi_condition = "NOT Installed"
var msi_sequence = 7000
@ivanrad
ivanrad / xslt_transform.js
Created June 30, 2017 14:33
XSLT transform (wsh)
// @(#) xslt_transform.js
//
// (c) Ivan Radanovic <ivan.radanovic at gmail>
//
// usage: cscript /nologo xslt_transform.js <xslt_file> < <xml_file>
//
var xml, xslt;
function die(msg) {
@ivanrad
ivanrad / latest-cloc
Created August 3, 2018 09:53
fetch latest cloc
#!/bin/sh
exec wget https://raw.githubusercontent.com/AlDanial/cloc/master/cloc
@ivanrad
ivanrad / fix_font_smoothing.sh
Created September 28, 2018 21:36
Enable macOS Mojave font smoothing
#!/usr/bin/env bash
defaults write -g CGFontRenderingFontSmoothingDisabled -bool NO