Skip to content

Instantly share code, notes, and snippets.

View jdh747's full-sized avatar

Joshua Hayes jdh747

View GitHub Profile
@jdh747
jdh747 / emoji.sh
Created May 18, 2019 01:25
Dmenu-based emoji search and copy tool
#!/bin/bash
# Requires fonts-symbola to generate glyphs: https://packages.ubuntu.com/disco/fonts-symbola
sed '0,/^__EMOJI__$/d;/^#/d' $0 \
| dmenu -i -l 30 -fn 'Symbola:pixelsize=11' \
| awk '{printf $1}' \
| xclip -selection clipboard \
&& notify-send "Copied!" "$(xclip -selection clipboard -out)"
exit 0
@jdh747
jdh747 / mac-spoof.sh
Created April 12, 2019 23:53
Utility for modifying MAC addresses on Mac ;)
#!/bin/sh
set -e
get_mac_address() {
echo $(ifconfig en0 ether | grep ether | rev | cut -d' ' -f2 | rev)
}
get_ip_address() {
echo $(ifconfig en0 inet | grep inet | cut -d' ' -f2)
@jdh747
jdh747 / Google IO 2012.md
Last active September 15, 2023 02:24
Go Concurrency Patterns: Google IO 2012

Concurrency Patterns in Go

Notes taken from Rob Pike's presentation 'Google I/O 2012 - Go Concurrency Patterns'.

1. Generator: function that returns a channel

The code is as follows:

c := boring("boring!")  // function returning a channel

for i := 0; i < 5; i++ {
### Keybase proof
I hereby claim:
* I am jdh747 on github.
* I am joshhayes747 (https://keybase.io/joshhayes747) on keybase.
* I have a public key ASBQnBewiwqzDupMlLLdVxU7A2k_VsgiarMihOwFdwYoIwo
To claim this, I am signing this object:
@jdh747
jdh747 / random_mac.sh
Created March 9, 2017 01:04
Randomise MAC Address
openssl rand -hex 6 | sed 's/\(..\)/\1:/g; s/.$//' | xargs sudo ifconfig en0 ether
@jdh747
jdh747 / tmux.cheat
Created January 11, 2017 03:15 — forked from afair/tmux.cheat
Tmux Quick Reference & Cheat sheet - 2 column format for less scrolling!
========================================== ==========================================
TMUX COMMAND WINDOW (TAB)
========================================== ==========================================
List tmux ls List ^b w
New -s <session> Create ^b c
Attach att -t <session> Rename ^b , <name>
Rename rename-session -t <old> <new> Last ^b l (lower-L)
Kill kill-session -t <session> Close ^b &