Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env bash
# crypto lock your own files with no way of recovering them but leaves the encrypted file behind.
# to give you 'hope'
# the file is sequentially encrypted 10 times with a different 100 length hexcode every time
# the original file is then overwritten 20 times
help() {
echo "$0:"
echo " usage:"
echo " $0 /path/to/the/file/to-make-go-away.txt"
echo " $0 "
#!/bin/sh
# NOTE: This script uses tabs for indentation
errcho() {
echo "$@" >&2
}
USAGE="Usage: $0 [keyboard[:keymap[:target]]]"
# Check preconditions
Python:
import os
print(os.environ['USERNAME'])
print(os.environ['PASSWORD'])
Docker:
docker run --env USERNAME=$USERNAME --env PASSWORD=$PASSWORD -- name docker-nginx -p 8080:80 -d nginx
ap42:secrets user$ cat test
USERNAME=zerocool
PASSWORD=crash_override
ap42:secrets user$ ./secret.sh test
enter aes-256-cbc encryption password:
Verifying - enter aes-256-cbc encryption password:
ap42:secrets user$ ls
secret.sh test.enc
@ridingintraffic
ridingintraffic / 01 - hidden.ovpn
Last active January 13, 2019 02:55
openvpn as a systemd service with PS1 alerting
.....
.....
auth-user-pass /home/linuxuser/pass.txt
<begin python script>
# test.py
def chunks(l, n):
"""Yield successive n-sized chunks from l."""
for i in range(0, len(l), n):
yield l[i:i + n]
all_ids = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]
chunked_list_ids=chunks(all_ids,5)
@ridingintraffic
ridingintraffic / python set
Created January 8, 2019 02:51
quick and dirty one line to dedup a list
>>> all_ids = [1,2,3,4,5,1,2,7,8,3,4,5]
>>> print all_ids
[1, 2, 3, 4, 5, 1, 2, 7, 8, 3, 4, 5]
## create a set passing in the list and then returning a list
>>> deduped_ids = list(set(all_ids))
>>> print deduped_ids
[1, 2, 3, 4, 5, 7, 8]
`:mic_drop:`
@ridingintraffic
ridingintraffic / FIRE
Created December 23, 2018 03:50
in case of fire
function FIRE()
{
find ~/git/github/$(whoami) -maxdepth 1 -mindepth 1 -type d -exec cd {} \; -exec git pull {} \; -exec git add --all {} \; -exec git commit -a -m "firesale" {} \; -exec git push origin `git rev-parse --abbrev-ref HEAD` {} \;
}
@ridingintraffic
ridingintraffic / setMeUp.sh
Created December 23, 2018 03:33
symlink creation
#!/bin/bash
function linkwork()
{
linkTocheck="$1"
sourceLink="$2"
if [ -f "$linkTocheck" ]; then
echo "$linkTocheck is a file - backing it up"
mv "$linkTocheck" "$sourceLink.bak"
fi
if [ ! -h "$linkTocheck" ]; then