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
| sudo dd if=/dev/zero of=/dev/sda count=1 bs=512 |
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
| # Find all files and directories in the current director older than <days> and remove them. | |
| function remove_older_than () { | |
| if [[ "$#" -eq 0 || ! "$1" =~ ^[0-9]+$ ]]; then | |
| echo "usage: remove_older_than <days>" | |
| return | |
| fi | |
| find . -ctime +${1} -type f -exec rm -f {} \; | |
| find . -ctime +${1} -type d -exec rm -rf {} \; | |
| } |
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
| function getcert() | |
| { | |
| local host=${1:-} | |
| local port=${2:-443} | |
| if [ -z ${host} ]; then | |
| echo "usage: getcert <server> [<port>]" | |
| echo " <port> will default to 443 if not given." | |
| return | |
| fi | |
| echo | openssl s_client -servername ${host} -connect ${host}:${port} | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > ${host}.crt |
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/env bash | |
| # Simple script to print out some colour codes to the terminal to show | |
| # what's available. This can be expanded to included more codes easily | |
| # by editing the for loops. | |
| echo | |
| echo "Prepend code with \\e[" | |
| for attr in {0..5} 7 | |
| do | |
| for fgcl in {30..37} |
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 | |
| # File: git-refs | |
| printf "\e[1;34m${PWD}\e[0m" | |
| fmt=' | |
| %(color:bold cyan)%(refname:short)%(color:reset): | |
| Commit: %(color:yellow)%(objectname)%(color:reset) | |
| Date: %(committerdate:format:%Y-%m-%d %H:%M:%S) | |
| Committer: %(committername) %(committeremail)' |