Skip to content

Instantly share code, notes, and snippets.

@rvdlee
Last active May 30, 2018 17:33
Show Gist options
  • Save rvdlee/27890012e18712be960da4778a1df607 to your computer and use it in GitHub Desktop.
Save rvdlee/27890012e18712be960da4778a1df607 to your computer and use it in GitHub Desktop.
# Encoding piped string
cat myexamplefile.txt | base64
# Decoding piped string
cat mybase64encodedfile.txt | base64 -d
# date +%s displays the current date in POSIX time format
# sha256 gets the checksum of this string
# base64 converts this to a base64 string
# head -c 64 gets the first 64 bytes of the piped content
# echo displays the manipulated string
date +%s | sha256sum | base64 | head -c 64 ; echo
# Login with SSH with an alternative port number
ssh user@domain.tld -p {port-number}
# Add a quoted commando to login, run the command and close the session
ssh user@domain.tld -p {port-number} 'ls -al'
# Copy a local file to the remote server with scp, this will copy to the home folder of user
scp -P {port-number} {local-file} user@domain.tld:~/{destination-file}
# Copy a remote file to local with scp, yet again home folder as target
scp -P {port-number} user@domain.tld:~/{remote-file} {local-directory}
# tr -cd will act as a filter for what characters we want to allow
# < /dev/urandom will echo the contents of the file to stdin
# head -c 64 gets the first 64 bytes of the piped content
# echo displays the manipulated string
tr -cd [:graph:] < /dev/urandom | head -c 64 ; echo
# Create a simple QR Code
qrencode -o qr-anything.png '#spreaditlikebutter'
# Create a "Setup my network QR Code"
# This will prompt for the SSID and WPA password
qrencode -s 7 -o qr-wifi.png "WIFI:S:$(zenity --entry --text="Network name (SSID)" --title="Create WiFi QR");T:WPA;P:$(zenity --password --title="Wifi Password");;"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment