Skip to content

Instantly share code, notes, and snippets.

@brson
brson / gist:9dec4195a88066fa42e6
Last active April 19, 2024 00:34
A Rust Syntax Guide

A Guide to Rust Syntax

A very brief guide to Rust syntax. It assumes you are already familiar with programming concepts.

This was written in 2014. It is not a good reference for Rust today, though the content is still correct.

cheats.rs looks like a good alternative.

Assert macro

@kaleb
kaleb / aliases
Created October 15, 2011 15:51
Gmail on Mutt
#~/.mutt/aliases
alias nick Nicholas Levandoski <nick.levandoski@auglug.org>
alias tim Timothy Pitt <timothy.pitt@auglug.org>
alias steven Steven Jackson <sjackson@auglug.org>
alias kaleb Kaleb Hornsby <kaleb.hornsby@auglug.org>
alias alug-admin nick, tim, steven
@TooTallNate
TooTallNate / endianness.js
Created February 10, 2013 20:32
Get host machine endianness using JavaScript Typed Arrays (polyfill for `os.endianness()` in node.js)
function endianness () {
var b = new ArrayBuffer(4);
var a = new Uint32Array(b);
var c = new Uint8Array(b);
a[0] = 0xdeadbeef;
if (c[0] == 0xef) return 'LE';
if (c[0] == 0xde) return 'BE';
throw new Error('unknown endianness');
}
@justinbmeyer
justinbmeyer / jsmem.md
Last active August 19, 2022 04:50
JS Memory

JavaScript Code

var str = "hi";

Memory allocation:

Address Value Description
...... ...
@kujohn
kujohn / portforwarding.md
Last active January 21, 2022 02:36
Port forwarding in Mavericks

Port Forwarding in Mavericks


Since Mavericks stopped using the deprecated ipfw (as of Mountain Lion), we'll be using pf to allow port forwarding.

####1. anchor file Create an anchor file under /etc/pf.anchors/<anchor file> with your redirection rule like:

@artnez
artnez / monkey-patch
Created May 6, 2013 04:15
Monkey patching a function in bash.
#! /usr/bin/env bash
#
# Monkey patching a function in bash. Why.
patch() {
new_guy=$(declare -f $1)
new_guy=${new_guy##$1*\{}
new_guy=${new_guy/\}/}
old_guy=$(declare -f $2)
old_guy=${old_guy/$2*{/}
@eendeego
eendeego / texy-1.8.sh
Last active June 30, 2019 16:04
Install adafruit lcd drivers on texy's 1.8 tft display (raspberry pi)
## Install kernel modules
mkdir -p ~/work/share/lcd/adafruit-pitft-2.8
cd ~/work/share/lcd/adafruit-pitft-2.8
wget http://adafruit-download.s3.amazonaws.com/libraspberrypi-bin-adafruit.deb
wget http://adafruit-download.s3.amazonaws.com/libraspberrypi-dev-adafruit.deb
wget http://adafruit-download.s3.amazonaws.com/libraspberrypi-doc-adafruit.deb
wget http://adafruit-download.s3.amazonaws.com/libraspberrypi0-adafruit.deb
wget http://adafruit-download.s3.amazonaws.com/raspberrypi-bootloader-adafruit-20140724-1.deb
@adammw
adammw / README.md
Created August 3, 2012 06:30
Node.js for Raspberry Pi

Node.js for Raspberry Pi

Pre-built binaries

Recent releases have been pre-built using cross-compilers and this script and are downloadable below.

If you have found these packages useful, give me a shout out on twitter: @adammw

Recipe for customizing a SmartoOS image and cloning it

1. Create base image

1.1. Download and install the base image:

[root@00-0c-29-aa-24-ba ~]# imgadm list
UUID                                  NAME             VERSION  OS       PUBLISHED
9eac5c0c-a941-11e2-a7dc-57a6b041988f  base64           13.1.0   smartos  2013-04-26T15:17:57Z
@trodrigues
trodrigues / diacriticsmap
Last active March 29, 2016 19:43
Diacritics in the OSX British/US keyboard (for Portuguese users or any other users of languages with diacritics)http://en.wikipedia.org/wiki/Diacritic
Mac OSX keyboard layout switching is a pain.
Using a keyboard layout different than the one actually printed on
your keys is also weird. The following keyboard shortcuts allow you
to create the various diacritics used in languages like Portuguese
on the British/US layout of a Mac keyboard.
Alt+e -> ´ Examples: é ó á
Alt+i -> ^ Examples: â ê
Alt+c -> ç