Skip to content

Instantly share code, notes, and snippets.

@nathansmith
nathansmith / this-is-madness.css
Last active October 6, 2015 10:36
Examples of CSS selector strength.
* {}
tag {}
[attribute] {}
[attribute="value"] {}
.class {}
@ericelliott
ericelliott / essential-javascript-links.md
Last active March 22, 2025 17:28
Essential JavaScript Links
@espeed
espeed / png-to-ico.sh
Created November 2, 2014 20:13
ImageMagick command to convert PNG file to transparent favicon.ico
convert app-icon.png
\( -clone 0 -resize 16x16 \)
\( -clone 0 -resize 32x32 \)
\( -clone 0 -resize 48x48 \)
\( -clone 0 -resize 64x64 \)
-delete 0 -alpha on -background transparent favicon.ico

Remote Virtual Interface

Taken directly from: https://developer.apple.com/library/mac/qa/qa1176/_index.html#//apple_ref/doc/uid/DTS10001707-CH1-SECRVI

iOS 5 added a remote virtual interface (RVI) facility that lets you use OS X packet trace programs to capture traces from an iOS device. The basic strategy is:

  1. Connect your iOS device to your Mac via USB.
  2. Set up an RVI for that device. This creates a virtual network interface on your Mac that represents the iOS device's networking stack.
  3. Run your OS X packet trace program, and point it at the RVI created in the previous step.
  4. To set up an RVI, you should run the rvictl tool as shown below.
@rrosiek
rrosiek / install_mysql.sh
Last active February 28, 2025 18:55
Vagrant provision script for php, Apache, MySQL, phpMyAdmin, Laravel, and javascript helpers. Tested with Ubuntu 16.04.
#! /usr/bin/env bash
###
#
# install_mysql.sh
#
# This script assumes your Vagrantfile has been configured to map the root of
# your application to /vagrant and that your web root is the "public" folder
# (Laravel standard). Standard and error output is sent to
# /vagrant/vm_build.log during provisioning.
@maxtaco
maxtaco / gist:5207740
Last active December 15, 2015 05:19
A simple DB backup script that keeps weeklies, monthlies, and yearlies, and ages.
#!/bin/sh
#
# A very simple database backup and rotation script, in four stages:
#
# 1. dump
# 2. compress
# 3. link
# 4. age
#
# MAC manipulators
alias random_mac='sudo ifconfig en0 ether `openssl rand -hex 6 | sed "s/\(..\)/\1:/g; s/.$//"`'
alias restore_mac='sudo ifconfig en0 ether YOUR_ORIGINAL_MAC_ADDRESS_GOES_HERE'
@maxtaco
maxtaco / gist:5080023
Last active December 14, 2015 11:38
Access hashed ssh known_hosts with paramiko.
import os.path
import paramiko
from hashlib import sha1
from hmac import HMAC
class KnownHostsRegistry (object):
"""
Read in the user's SSH known_hosts file, and perform lookups,
on either plaintext hostnames, or those that have been obscured
with known_hosts hashing (see here: http://nms.csail.mit.edu/projects/ssh/)
@wm
wm / Powerline.md
Last active September 6, 2022 00:55
Installing powerline on Mac OSX. The following was done in version Version 10.8.2

Install dependencies

brew install cmake
brew install python
sudo easy_install pip

Add powerline bin to your path. In your zshrc file (or the paths files sourced in zshrc) add the following line

PATH="/usr/local/share/python/:$PATH"

Reinstall MacVim with brew

@media only screen and (min-width: 320px) {
/* Small screen, non-retina */
}
@media
only screen and (-webkit-min-device-pixel-ratio: 2) and (min-width: 320px),
only screen and ( min--moz-device-pixel-ratio: 2) and (min-width: 320px),
only screen and ( -o-min-device-pixel-ratio: 2/1) and (min-width: 320px),