This file contains 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 | |
#set -x | |
APP_NAME=$(basename -- "$0") | |
if [ -z "$1" ]; then | |
echo -e "\n$APP_NAME [base dir (Default:.)] [base search dir (Default:".")] [search glob (Default:**/*.php.old)] [patches dir (Default:patches]" | |
echo -e "\tThe base search and patches dir are relative to basedir!" | |
echo -e "\tExpample: $APP_NAME: wordpress web/wp patches" | |
exit | |
fi |
This file contains 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
new Date().toLocaleString( 'sv', { timeZoneName: 'short' } ).replace(/(-|:| )/g,'').substr(0,12) | |
// uses 'sv' for Sweden as they use something similar to ISO format |
This file contains 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 | |
#set -x | |
EXCLUDEFOLDERNAME=${3:-"node_modules"} | |
get_realpath () | |
{ | |
echo "$(cd "$(dirname "$1")"; pwd)/$(basename "$1")" | |
} | |
SEARCHPATH="$(get_realpath ${2:-"${HOME}"})" |
This file contains 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
security find-generic-password -a $USER -C note -s name-of-a-note -w | xxd -r -p - | |
# when input includes new lines - content is returned as hex and needs to be converted with "xxd" |
This file contains 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
security add-generic-password -a $USER -s name-of-the-note -C note -w "$(cat file-to-include)" |
This file contains 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
<script> | |
if (featureText()) { | |
document.currentScript.insertAdjacentHTML( | |
"afterend",` | |
<script src="/polyfill.js" ><\/script> | |
`); // closing tag needs to use an escaped backslash | |
} | |
</script> |
This file contains 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 | |
# SETUP: add to local git config: | |
# git config --local credential.helper '!~/bin/awsCredentialHelperOSX AWS_PROFILE' | |
# replace AWS_PROFILE with the relevant profile name, replace "~/bin/" with path to this file | |
aws_profile="$1" | |
shift | |
# get aws_access_key_id for aws_profile | |
aws_access_key_id=$(sed -n '/^[ \t]*\[${aws_profile}\]/,/\[/s/^[ \t]*aws_access_key_id[ \t]*=[ \t]*//p' ~/.aws/credentials) | |
security -q delete-internet-password -a "${aws_access_key_id}" >/dev/null 2>&1 | |
/usr/local/bin/aws --profile "${aws_profile}" codecommit credential-helper $@ |
This file contains 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
const crypto = require("crypto"); | |
var ethUtils = require("ethereumjs-util"); | |
var getRandomWallet = function() { | |
var randbytes = crypto.randomBytes(32); | |
var address = "0x" + ethUtils.privateToAddress(randbytes).toString("hex"); | |
return { address: address, privKey: randbytes.toString("hex") }; | |
}; |
This file contains 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 | |
# Usage: ziptotar.sh <ZIP name> | |
if [ -z $1 ] || [ "$1" == "-h" ] || [ "$1" == "--help" ];then | |
echo "Convert a zip to a bzip2 compressed tar (.tbz)" | |
echo "ziptotar.sh <ZIP name>" | |
exit | |
fi | |
for file in "$@" | |
do | |
if [ ! -f "$file" ];then |
This file contains 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
<style> | |
@media screen and (max-width: 600px) { | |
table.responsive caption { background-image: none; } | |
table.responsive thead { display: none; } | |
table.responsive tbody td { display: block; padding: .6rem; } | |
table.responsive tbody tr td:first-child { background: #333; color: #fff; } | |
table.responsive tbody td:before { | |
content: attr(data-th); font-weight: bold; | |
display: inline-block; width: 6rem; | |
} |