Skip to content

Instantly share code, notes, and snippets.

View borestad's full-sized avatar

Johan Borestad borestad

View GitHub Profile
@borestad
borestad / yosemite-to-iso.sh
Last active October 8, 2015 09:42
Yosemite to ISO
#!/bin/bash
# Mount the installer image
hdiutil attach /Applications/Install\ OS\ X\ Yosemite.app/Contents/SharedSupport/InstallESD.dmg -noverify -nobrowse -mountpoint /Volumes/install_app
# Convert the boot image to a sparse bundle
hdiutil convert /Volumes/install_app/BaseSystem.dmg -format UDSP -o /tmp/Yosemite
# Increase the sparse bundle capacity to accommodate the packages
hdiutil resize -size 8g /tmp/Yosemite.sparseimage
###
# This script assumes 2 things
# 1. One have already downloaded the yosemite installer through Appstore or at leaast put "Install OS X Yosemite.app" into the /Apps folder
# 2. A fresh 8 GB+ USB Memory is inserted and have the volume name "Untitled"
#
###
sudo /Applications/Install\ OS\ X\ Yosemite.app/Contents/Resources/createinstallmedia --volume /Volumes/Untitled --applicationpath /Applications/Install\ OS\ X\ Yosemite.app --nointeraction
@borestad
borestad / elcapitan-bootable-usb.sh
Last active January 13, 2016 06:22
Bootable USB Drive for OS X El Capitan
###
# This script assumes 2 things
# 1. One have already downloaded the El Capitan ( /Applications/Install OSX El Capitan.app) installer through Appstore or at leaast put "Install OSX El Capitan.app" into the /Apps folder
# 2. A fresh 8 GB+ USB Memory is inserted and have the name "Untitled"
#
# Installation instructions:
# 1. Insert a USB stick into your computer (it will be totally erased - make sure you backup your important files on that USB)
# 2. Open up a terminal (Terminal.app, iTerm etc)
# 3. Fire up Disk utilities
# - I.e `open /Applications/Utilities/Disk\ Utility.app`
(function() {
var s = document.createElement('script');
s.src = 'http://localhost:8000/player.js'
document.body.appendChild(s);
})()
###
# This script assumes 2 things
# 1. One have already downloaded the El Capitan ( /Applications/Install OSX El Capitan.app) installer through Appstore or at leaast put "Install OSX El Capitan.app" into the /Apps folder
# 2. A fresh 8 GB+ USB Memory is inserted and have the name "Untitled"
#
# Installation instructions:
# 1. Insert a USB stick into your computer (it will be totally erased - make sure you backup your important files on that USB)
# 2. Open up a terminal (Terminal.app, iTerm etc)
# 3. Fire up Disk utilities
# - I.e `open /Applications/Utilities/Disk\ Utility.app`
@borestad
borestad / h.ts
Created October 10, 2017 07:11
JSX/TSX without React
/*
* Custom jsx parser
* See: tsconfig.json
*
* {
* "jsx": "react",
* "jsxFactory": "h"
* }
*
*/
#!/usr/bin/env bash
GITROOT=$(git rev-parse --show-toplevel)
ROOT=$GITROOT/packages/www
INPUT=$ROOT/public
OUTPUT=$ROOT/public
minifier=$ROOT/node_modules/.bin/html-minifier
# See: html-minifier --help
<!DOCTYPE html>
<html>
<head>
<title>Akamai | Hello world</title>
<meta name="viewport" content="width=device-width" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<meta name="format-detection" content="telephone=no" />
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
#!/bin/bash
echo "Cleaning Linux Headers"
#echo $(dpkg --list | grep linux-image | awk '{ print $2 }' | sort -V | sed -n '/'`uname -r`'/q;p') $(dpkg --list | grep linux-headers | awk '{ print $2 }' | sort -V | sed -n '/'"$(uname -r | sed "s/\([0-9.-]*\)-\([^0-9]\+\)/\1/")"'/q;p') | xargs sudo apt-get -y purge
#dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d' | xargs sudo apt-get -y purge
echo ""
echo "Cleaning orphan .deb packages"
deborphan | xargs sudo apt-get -y remove --purge
echo ""
@borestad
borestad / sponge
Last active October 13, 2022 09:07
sponge - soak up standard input and write to a file (poor mans version)
#!/usr/bin/env bash
set -euo pipefail
#
# sponge - soak up standard input and write to a file
#
# NOTE: Poor mans versions of sponge
# ... to avoid having to 'apt-get install moreutils' and perl dependencies) in CI pipeline
# Example Usage: