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 | |
# SOURCE: https://eligiblestore.com/blog/2017/05/02/how-to-install-mosh-on-centos/ | |
# ensure running as root | |
if [[ "$(id -u)" != "0" ]]; then | |
exec sudo "$0" "$@" | |
fi | |
# install mosh | |
yum install -y epel-release |
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/sh | |
# Requires OpenSCAD on $PATH | |
# Automatically re-exports all changed .scad files pre-commit | |
git diff --cached --name-only | grep ".scad$" | while read -r file; do | |
basename="${file%.*}" | |
echo "Exporting $file to $basename.stl..." | |
openscad -o "$basename.stl" "$file" | |
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
# Get SHA256 of a text | |
# Usage: sha256 password | |
# output: 5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8 | |
function sha256() { | |
echo -n $1 | shasum -a 256 | |
# Source: http://albertech.blogspot.fr/2015/02/generate-sha-256-hash-from-command-line.html | |
} |
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
BasedOnStyle: Chromium | |
AlignTrailingComments: true | |
BreakBeforeBraces: Attach | |
ColumnLimit: 0 | |
IndentWidth: 4 | |
KeepEmptyLinesAtTheStartOfBlocks: false | |
ObjCBlockIndentWidth: 4 | |
ObjCSpaceAfterProperty: true | |
ObjCSpaceBeforeProtocolList: true | |
PointerBindsToType: false |
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
Check if remote port is open with bash: | |
echo >/dev/tcp/8.8.8.8/53 && echo "open" | |
Suspend process: | |
Ctrl + z | |
Move process to foreground: | |
fg | |
Generate random hex number where n is number of characters: |
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/sh | |
head -n 4096 /dev/urandom | openssl sha1 |
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 | |
# bash generate random alphanumeric string | |
# | |
# bash generate random 32 character alphanumeric string (upper and lowercase) and | |
NEW_UUID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1) | |
# bash generate random 32 character alphanumeric string (lowercase only) | |
cat /dev/urandom | tr -dc 'a-z0-9' | fold -w 32 | head -n 1 |