Skip to content

Instantly share code, notes, and snippets.


Andreas Heissenberger aheissenberger

View GitHub Profile
aheissenberger / html-table-resposive
Created Feb 18, 2015
HTML Table responsive - flip Tableheader to first column
View html-table-resposive
@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;
aheissenberger /
Created Jun 26, 2017
Convert a zip to a bzip2 compressed tar (.tbz)
# Usage: <ZIP name>
if [ -z $1 ] || [ "$1" == "-h" ] || [ "$1" == "--help" ];then
echo "Convert a zip to a bzip2 compressed tar (.tbz)"
echo " <ZIP name>"
for file in "$@"
if [ ! -f "$file" ];then
aheissenberger / create-wallet.js
Created Mar 2, 2019
create a wallet address (ethereum)
View create-wallet.js
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") };
aheissenberger /
Created May 4, 2019
Wrapper for AWS CodeCommit git credential helper to fix problem with MacOS keystore
# 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
# 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 $@
aheissenberger / polyfill-loader.html
Created Sep 15, 2019
Insert Script Tag to load polyfill
View polyfill-loader.html
if (featureText()) {
<script src="/polyfill.js" ><\/script>
`); // closing tag needs to use an escaped backslash
aheissenberger /
Created Sep 23, 2019
Mac OS / retrieve key chain note
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"
aheissenberger /
Created Sep 23, 2019
Mac OS / add text file to key chain as Note
security add-generic-password -a $USER -s name-of-the-note -C note -w "$(cat file-to-include)"
aheissenberger / localeDateTimeString.js
Last active Feb 18, 2021
locale time Date time string for file names
View localeDateTimeString.js
new Date().toLocaleString( 'sv', { timeZoneName: 'short' } ).replace(/(-|:| )/g,'').substr(0,12)
// uses 'sv' for Sweden as they use something similar to ISO format
aheissenberger /
Last active Sep 8, 2022
Exclude package folder e.g. node_modules from being backuped by MacOS Time Machine
#set -x
get_realpath ()
echo "$(cd "$(dirname "$1")"; pwd)/$(basename "$1")"
SEARCHPATH="$(get_realpath ${2:-"${HOME}"})"