Add [toc] to md file to generate table of contents
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # A bash script to create a time machine disk image suitable for | |
| # backups with OS X 10.6 (Snow Leopard) | |
| # This script probably only works for me, so try it at your own peril! | |
| # Use, distribute, and modify as you see fit but leave this header intact. | |
| # (R) sunkid - September 5, 2009 | |
| # | |
| # This will create a time machine ready disk image named with your | |
| # computer's name with a maximum size of 600GB and copy it to | |
| # /Volumes/backup. The image "file" (it's a directory, really) will |
Add to .bashrc or .bash_profile
function git_undelete_file () {
if [ $# -eq 0 ]; then
echo "Usage: git_undelete_file <filepath>";
exit 1;
fi
git checkout $(git rev-list -n 1 HEAD -- "$1")^ -- "$1"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/sh | |
| # Requires OpenSCAD on $PATH | |
| # Automatically re-exports all changed .scad files pre-commit | |
| git diff --cached --name-only | grep ".scad$" | while read -r file; do | |
| basename="${file%.*}" | |
| echo "Exporting $file to $basename.stl..." | |
| openscad -o "$basename.stl" "$file" | |
| done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Get SHA256 of a text | |
| # Usage: sha256 password | |
| # output: 5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8 | |
| function sha256() { | |
| echo -n $1 | shasum -a 256 | |
| # Source: http://albertech.blogspot.fr/2015/02/generate-sha-256-hash-from-command-line.html | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| head -n 4096 /dev/urandom | openssl sha1 |
OlderNewer