certbotlets encryptsslhttps
shell
#!/bin/bash

# check for null arguments
if [ -z "$1" ] || [ -z "$2" ]; then
   echo "Usage: ./certbox-generator mysite.com [email protected]"
   exit 0
fi

domain="$1"
mail="$2"
certbot certonly --standalone -d "$domain" --rsa-key-size 4096 --must-staple --email "$mail" --agree-tos
applemacosrichtexttextEdit
javascript
  1. Export your richtext document to html.
  2. Run the following code inside your browser.
  3. Copy paste the whole html tag from devtools or just select all text with Command+A.
document.querySelectorAll("a").forEach(e=>e.innerText = e.href)
node.jstypescriptvscode
json
{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "node",
            "request": "launch",
            "name": "Debug Node.js",
            "program": "${workspaceFolder}/__MYAPP__.ts",
            "outFiles": [
                "${workspaceFolder}/__MYDIST_FOLDER__/**/*.js"
            ],
            "sourceMaps": true,
            "port": 9229,
            "runtimeArgs": [
                "--inspect-brk=9229"
            ],
            "console": "integratedTerminal"
        }
    ]
}
mysqlwaitwait_timeoutinteractive_timeout
shell
#!/bin/bash

# Needed variables: host and username
if [ -z "$1" ] || [ -z "$2" ] ; then
    echo "Usage: ./mysql-noTimeout.sh 127.0.0.1 myDatabaseUsername"
else
    mysql -h "$1" -u "$2" -e '
        SET wait_timeout=31536000;
        SET interactive_timeout=31536000;
        SET GLOBAL wait_timeout=31536000;
        SET GLOBAL  interactive_timeout=31536000;
        show variables like "%timeout%";
    ' -p
fi
jquerydevtoolschrome
javascript
var script = document.createElement("script");
script.src = "https://code.jquery.com/jquery-<VERSION_HERE>.min.js";
document.body.appendChild(script);
typescriptdelay
typescript
export function delay(timeout: number): Promise<void> {
    return new Promise((resolve) => {
        setTimeout(resolve, timeout);
    });
}
javascripttypescriptmap
typescript
function sortMapBasedOnValue(m:Map<number,number>):Map<number,number>{
   return new Map([...m].sort((k,v)=>k[1]-v[1]))
}
cpu-stresslinuxshellbenchmark
shell
[start]
for i in 1 2 3 4; do while : ; do : ; done & done

[stop]
for i in 1 2 3 4; do kill %$i; done
unziplinuxtartar.gz
shell
#!/bin/bash

if [ -z "$1" ] ; then
    echo "Usage: ./unzip.sh myfile.tar.gz"
    echo -n "Supported Files: tar.gz, bz2 rar"
    echo "gz, tar, tbz2, tgz, zip, Z, 7z"
else
    if [ -f $1 ] ; then
            case $1 in
                *.tar.bz2)   tar xvjf $1     ;;
                *.tar.gz)    tar xvzf $1     ;;
                *.tar.xz)    tar xf $1       ;;
                *.bz2)       bunzip2 $1      ;;
                *.rar)       unrar x $1      ;;
                *.gz)        gunzip $1       ;;
                *.tar)       tar xvf $1      ;;
                *.tbz2)      tar xvjf $1     ;;
                *.tgz)       tar xvzf $1     ;;
                *.zip)       unzip $1        ;;
                *.Z)         uncompress $1   ;;
                *.7z)        7z x $1         ;;
                *)           echo "Cannot extract file named: '$1'" ;;
            esac
    else
            echo "'$1' is not a valid archive file."
    fi
fi