Skip to content

Instantly share code, notes, and snippets.

@vyder
vyder / alternative.md
Last active October 6, 2016 07:08
Writing a disk image to a flash drive/SD card from OSX

Or, just install hypriot/flash and run:

$ flash /path/to/img

It also prints a pretty progress bar for dd, which is incredibly useful.

@vyder
vyder / spec.md
Last active September 3, 2016 05:25
Mars Rover Coding Question

MARS ROVERS SPEC

A squad of robotic rovers are to be landed by NASA on a plateau on Mars. This plateau, which is curiously rectangular, must be navigated by the rovers so that their on-board cameras can get a complete view of the surrounding terrain to send back to Earth.

A rover's position and location is represented by a combination of x and y co-ordinates and a letter representing one of the four cardinal compass points. The plateau is divided up into a grid to simplify navigation. An

@vyder
vyder / GAME_MASTER_v0_1.protobuf
Created July 17, 2016 09:55 — forked from anonymous/GAME_MASTER_v0_1.protobuf
Pokemon Go decoded GAME_MASTER protobuf file v0.1
Result: 1
Items {
TemplateId: "BADGE_BATTLE_ATTACK_WON"
Badge {
BadgeType: BADGE_BATTLE_ATTACK_WON
BadgeRanks: 4
Targets: "\nd\350\007"
}
}
Items {
@vyder
vyder / activate-window
Last active April 16, 2016 05:46
Shell script to activate an open window using 'wmctrl'
#!/bin/bash
# First check if wmctrl is installed
type wmctrl > /dev/null
if [ "$?" != "0" ]; then
cat <<EOF
Please install 'wmctrl' before running this script:
sudo apt-get install wmctrl
@vyder
vyder / iterm
Last active March 24, 2024 21:59
iterm.bash - Launch iTerm from command line
#!/bin/bash
#
# Open new iTerm window from the command line
#
# Usage:
# iterm Opens the current directory in a new iTerm window
# iterm [PATH] Open PATH in a new iTerm window
# iterm [CMD] Open a new iTerm window and execute CMD
# iterm [PATH] [CMD] ... You can prob'ly guess
#
@vyder
vyder / commands.sh
Last active December 1, 2015 05:48
Install RBenv + Ruby
VERSION_TO_INSTALL='2.2.2'
git clone git://github.com/sstephenson/rbenv.git .rbenv
echo 'export RBENV_ROOT='${HOME}/.rbenv"' >> ~/.bash_profile
echo 'if [ -d "${RBENV_ROOT}" ]; then' >> ~/.bash_profile
echo ' export PATH="${RBENV_ROOT}/bin:${PATH}"' >> ~/.bash_profile
echo ' eval "$(rbenv init -)"' >> ~/.bash_profile
echo 'fi' >> ~/.bash_profile
source ~/.bash_profile
@vyder
vyder / gravatar
Created June 9, 2015 05:11
Quick script to find Gravatar profiles
echo "=> http://www.gravatar.com/$(md5 -s $1 | cut -d' ' -f 4).json"
@vyder
vyder / javascript.nanorc
Created February 22, 2015 10:03
JS Nano Syntax Highlighting
## Author: Vidur Murali
## Date : 02/21/2015
##
## Based on Spacegray Eighties Palette
## Link: https://github.com/vyder/color-palettes/blob/master/Spacegray%20Eighties.clr
##
## Notes for future me:
## > Word demarkers like - "[[:<:]]", "[[:>:]]", "\b" - don't work
## in OSX. Use "[[:<:]]", etc instead.
## [Source: http://stackoverflow.com/a/19805937/834459]
@vyder
vyder / script
Last active August 29, 2015 14:12
OSX - Disk image to USB drive
# Convert iso to img
hdiutil convert -format UDRW -o ~/Desktop/target.img ~/Desktop/ubuntu.iso
# Find the USB drive
diskutil list
# Unmount the drive
diskutil unmountDisk /dev/disk<N>
# Write the file
@vyder
vyder / latency.txt
Last active August 29, 2015 14:09 — forked from jboner/latency.txt
Latency Comparison Numbers
--------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns
Send 1K bytes over 1 Gbps network 10,000 ns 0.01 ms
Read 4K randomly from SSD* 150,000 ns 0.15 ms