Skip to content

Instantly share code, notes, and snippets.

View JakobR's full-sized avatar

Jakob Rath JakobR

View GitHub Profile
@JakobR
JakobR / gist:484e5834527af3cfc678
Created July 13, 2014 12:04
Link to sites without sending referrer
  1. HTML5: rel="noreferrer" attribute on the link.

     <a href="http://www.example.com/" rel="noreferrer">blah</a>
    
  2. Serve site over https. Browsers don't send the referrer when going from https to http urls.

  3. Use a data uri in the link. The data uri contains a redirect to the actual destination. See this answer.

     <a href='data:text/html;charset=utf-8, <html><script>window.location = "http://google.ca";</script></html>'>Link</a>
    
@JakobR
JakobR / disable-mac-startup-sound.md
Last active December 24, 2015 16:09
Disable Mac startup sound

Disable Mac startup sound

The startup sound doesn't play if the audio output was muted at shutdown.

  1. Copy login.sh and logout.sh to /Library/Scripts. Make sure they're executable and owned by root.

  2. Check if there are any existing login/logout hooks (they will be overwritten):

#!/usr/bin/python
#
# by Nathan Grigg http://nb.nathanamy.org
#
import sys
import argparse
import os.path
from subprocess import Popen,PIPE
@JakobR
JakobR / backtrack.markdown
Created May 14, 2013 16:25
Run Backtrack Linux from a USB thumb drive on a Mac

Running Backtrack from a USB thumb drive on a MacBook Air

  1. Download Backtrack Linux. I used BT5R3-GNOME-64.iso.

  2. Format the thumb drive with Disk Utility (FAT, MBR).

  3. Use UNetbootin to copy the image to the thumb drive.

  4. Use fdisk to mark the partition as active:

  • Run diskutil list to check the device path for the thumb drive. On my system, it was /dev/disk2.
@JakobR
JakobR / gist:4121614
Created November 20, 2012 22:14
Convert text files from SJIS to UTF-8 recursively
#!/bin/bash
# Unarchive the zip with "The Unarchiver" (it allows to select the file name encoding)
# Code inspired by http://stackoverflow.com/questions/1182037/osx-change-file-encoding-iconv-recursive
find /path/to/unarchived/folder -name \*.txt -type f | \
(while read file; do
echo "convert $file";
mv "$file" "$file.original"