Skip to content

Instantly share code, notes, and snippets.

View jhyland87's full-sized avatar

J jhyland87

View GitHub Profile
@jhyland87
jhyland87 / encrypted-compressed-archive.sh
Created July 3, 2018 19:37
Generate a GZIP compressed TAR archive thats AES-256 encrypted and password protected
# Create encrypted folder with password specified in the command (CHANGEME)
tar cz -P -C ./data ./ | openssl enc -aes-256-cbc -salt -pass "pass:CHANGEME" -a -A -e -out encrypted-compressed-archive.tar.gz.enc
# Decrypt above file
openssl enc -aes-256-cbc -a -A -d -pass "pass:CHANGEME" -in ./encrypted-compressed-archive.tar.gz.enc | tar xz -C ./data
# Same thing as the above, but password isn't specified (which means the password will be requested)
tar cz -P -C ./data ./ | openssl enc -aes-256-cbc -salt -a -A -e -out encrypted-compressed-archive.tar.gz.enc
openssl enc -aes-256-cbc -a -A -d -in ./encrypted-compressed-archive.tar.gz.enc | tar xz -C ./data
[
[
[
null,
null,
null,
null,
{},
{},
{}
[
[
[
null,
null,
null,
null,
{},
{},
{}
@jhyland87
jhyland87 / color-scale.png
Last active June 26, 2018 17:25
Color Scale
color-scale.png
@jhyland87
jhyland87 / stfu.sh
Last active July 6, 2018 16:28
Command to launch a cputhrottle command for specific app
function stfu {
if [[ ${BASH_VERSINFO} -lt 4 ]]; then
echo "[ERROR] You're running Bash v${BASH_VERSINFO}?? Grow some balls and upgrade to v4" 1>&2
return 1
fi
declare -A font
font['rst']=$(echo -en "\e[0m")
font['bld']=$(echo -en "\e[1m")
@jhyland87
jhyland87 / mime2ext.sh
Last active June 25, 2018 19:05
Assoc array associating a mime type to the appropriate file extension
# Assoc array associating a mime type to the appropriate file extension
# source: https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Complete_list_of_MIME_types
#
# JS To gather data from source:
# $('table.standard-table > tbody > tr').each(function(a,b){
# console.log('mime2ext["%s"]="%s"',
# $(b).find("td:eq(2) > code").text(),
# $(b).find("td:eq(0) > code").text().replace(/^\./, ''))
# })
@jhyland87
jhyland87 / ext2mime.sh
Last active June 25, 2018 19:04
Assoc array associating a file extension type to the appropriate mime type
# Assoc array associating a file extension type to the appropriate mime type
# source: https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Complete_list_of_MIME_types
#
# JS To gather data from source:
# $('table.standard-table > tbody > tr').each(function(a,b){
# console.log('ext2mime["%s"]="%s"',
# $(b).find("td:eq(0) > code").text().replace(/^\./, ''),
# $(b).find("td:eq(2) > code").text())
# })
(3)[Tue May 22 05:21:28| 0:006]{1}root@localhost:/var/log(✓)#
| | | | | | | | | |
| | | | | | | | | \ Account type indicator
| | | | | | | | |
| | | | | | | | \ Last return code
| | | | | | | |
| | | | | | | \ Current working directory
| | | | | | |
| | | | | | \ Local hostname
| | | | | |
@jhyland87
jhyland87 / ps1.sh
Created May 22, 2018 21:36
Prompt script function - Should be saved to /etc/profile.d/ps1.sh
#!/bin/bash
# Create /etc/profile.d/prompt.sh and add the content of this gist to it.
#
# Prompt example:
# (2)[Fri May 06 10:00:30| 0:003]{4}root@ip-172-31-1-226:~(0)#
# Format is:
# (sessions on server)[date time| Last command exec time]{sessions on server}username@hostname:working_directory(exit code of last cmd)#
#
# Example Output (of $[prompt[0]}): http://d.pr/i/19B87
#
@jhyland87
jhyland87 / VirtualBox-Miscellaneous_Commands.md
Last active May 22, 2018 21:47
[VirtualBox] Miscellaneous Commands

Miscellaneous VboxManage Commands


Delete Storage Medium

1. Detach it from the storage controller

$ vboxmanage storageattach d2c7e68e-fc6d-4ae1-b601-61ab2a4b7c0b --storagectl "SATA" --port 1 --medium none

2. Delete the storage medium