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
| # add a new line to the end of each curl response | |
| -w "\n" |
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
| # create a USB installer | |
| # https://support.apple.com/en-au/HT201372 | |
| Download the OS X High Sierra installer via the App Store, it will be installed into the /Applications directory | |
| If it opens automatically, close it | |
| Insert a USB stick (8GB+) | |
| Run the following command where MyVolume is the name of the USB volume: | |
| sudo /Applications/Install\ macOS\ High\ Sierra.app/Contents/Resources/createinstallmedia --volume /Volumes/MyVolume | |
| # boot the USB installer |
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 | |
| ## | |
| # Create the directory skeleton for a new package and a Makefile to build it | |
| ## | |
| if [ "$#" -ne 1 ]; then | |
| echo "Usage: $0 \"package name\"" | |
| exit 1 | |
| fi |
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
| # ... | |
| [alias] | |
| cm = commit -m | |
| co = checkout | |
| cof = "!checkout_fzf() { \ | |
| local branches branch; \ | |
| branches=$(git --no-pager branch | grep -v HEAD | sed 's/.* //' | sed 's/release.*//' | grep -v '^$' | sort -u) && \ | |
| branch=$(echo \"$branches\" | fzf +m) && \ | |
| git checkout $branch; \ |
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
| var downloadButton = document.getElementById('downloadButton'); | |
| downloadButton.addEventListener('click', function () { | |
| var contents = document.getElementById('someDiv').innerHTML; | |
| if (contents.length = 0) { | |
| return; | |
| } | |
| var filename = 'some-filename.txt'; |
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/php | |
| <?php | |
| // create a resource | |
| $parsed = mailparse_msg_create(); | |
| // read the mime-encoded email file from stdin | |
| $email = file_get_contents('php://stdin'); | |
| // parse the mime-encoded email | |
| mailparse_msg_parse($parsed, $email); | |
| $structure = mailparse_msg_get_structure($parsed); |
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 /some/path -type f -exec grep 'find this text' -l {} \; -exec sed -i '' 's/find this text/replace with this text/g' {} \; |
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
| # format the output of stat and show the active user (as a string) | |
| stat -f "%Su" /dev/console |
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
| # remove each family of keys that match the specified pattern from the Asterisk database | |
| # 4 digits | |
| FAMILY_PATTERN="[0-9][0-9][0-9][0-9]" | |
| for FAMILY in `asterisk -rx "database show" | cut -d' ' -f1 | egrep -a "/${FAMILY_PATTERN}/" | cut -d'/' -f2 | uniq`; do | |
| asterisk -rx "database deltree ${FAMILY}"; | |
| 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
| # https://www.ssh.com/ssh/agent | |
| # https://developer.github.com/v3/guides/using-ssh-agent-forwarding/#setting-up-ssh-agent-forwarding | |
| # on the remote host | |
| # /etc/ssh/sshd_config must have 'AllowAgentForwarding yes' | |
| # on your local machine | |
| # /etc/ssh/ssh_config must have 'ForwardAgent yes' | |
| cat >> ~/.ssh/config <<EOF |
OlderNewer