Skip to content

Instantly share code, notes, and snippets.

Avatar

Nic Haynes nicinabox

View GitHub Profile
@nicinabox
nicinabox / lets split build guide.md
Last active Jan 28, 2023
This guide covers building a Let's Split v2.
View lets split build guide.md

This guide has moved

To improve collaboration this guide is now available on GitHub.

Continue reading

@nicinabox
nicinabox / flash.sh
Last active Nov 13, 2022
Find the Pro Micro serial port automatically and flash it
View flash.sh
#!/bin/bash
# Usage
# ./flash.sh path/to/your.hex
TARGET=$1
ls /dev/tty* > /tmp/1
echo "Reset your Pro Micro now"
View anduril.md
@nicinabox
nicinabox / env.sh
Created May 1, 2012
Pack Chrome extensions from the command line
View env.sh
# $ crx `pwd`
function crx() {
~/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --pack-extension=$@ --pack-extension-key=$@/key.pem
}
@nicinabox
nicinabox / device.js
Created Sep 14, 2012
Basic device properties for use when checking screen size or mobile.
View device.js
/*
Author: Nic Aitch - @nicinabox
Version: 1.1
Description: Basic device properties for use when checking screen size or mobile.
License: MIT
*/
(function(window, document, undefined) {
var device = {};
@nicinabox
nicinabox / favicon.sh
Last active Oct 24, 2019
Convert favicon.png to an .ico with multiple sizes
View favicon.sh
convert favicon.png -bordercolor white -border 0 \
\( -clone 0 -resize 16x16 \) \
\( -clone 0 -resize 32x32 \) \
\( -clone 0 -resize 48x48 \) \
\( -clone 0 -resize 64x64 \) \
-delete 0 -alpha off -colors 256 favicon.ico
View archlinux-install.sh
# confirm you can access the internet
if [[ ! $(curl -Is http://www.google.com/ | head -n 1) =~ "200 OK" ]]; then
echo "Your Internet seems broken. Press Ctrl-C to abort or enter to continue."
read
fi
# make 2 partitions on the disk.
parted -s /dev/sda mktable msdos
parted -s /dev/sda mkpart primary 0% 100m
parted -s /dev/sda mkpart primary 100m 100%
View terminal notes.md

screen shot 2018-01-26 at 13 59 43

iTerm

I can't remember exactly why I started using this over the built in Terminal, but it's very customizable and feature rich.

zsh

Originally I switched to zsh to try something different from bash. Now I rely on features like hook functions and syntax highlighting.

View auto_workon.sh
function auto_workon() {
CURPWD=`pwd`
if [[ $CURPWD = "$ACTIVE_CURPWD"* ]] && [ -n "${ACTIVE_ENV+1}" ]; then
return
fi
if [[ -f .venv ]]; then
NEXT_ACTIVE_ENV=`cat .venv`
@nicinabox
nicinabox / http.js
Created May 8, 2017
React Native common parts
View http.js
const toJSON = r => r.json()
const checkStatus = (r) => {
if (r.ok) return r
return toJSON(r)
.then((body) => {
let error = new Error(r.statusText)
error.body = body
error.response = r