Skip to content

Instantly share code, notes, and snippets.

View fijimunkii's full-sized avatar
🦁
𐂃͠

Harrison Powers fijimunkii

🦁
𐂃͠
View GitHub Profile
@fijimunkii
fijimunkii / crypto-iv.js
Created January 22, 2019 16:42
encrypt and decrypt with initialization vector
// encrypt and decrypt with initialization vector
// http://vancelucas.com/blog/stronger-encryption-and-decryption-in-node-js/
const crypto = require('crypto');
const ENCRYPTION_KEY = process.env.ENCRYPTION_KEY; // Must be 256 bits (32 characters)
const IV_LENGTH = 16; // For AES, this is always 16
function encrypt(text) {
let iv = crypto.randomBytes(IV_LENGTH);
let cipher = crypto.createCipheriv('aes-256-cbc', new Buffer.from(ENCRYPTION_KEY), iv);
let encrypted = cipher.update(text);
@fijimunkii
fijimunkii / https-get-gzbomb-safe.js
Last active December 7, 2018 15:34
node native https gz promise with gzbomb protection
const https = require('https');
const zlib = require('zlib');
return new Promise((resolve, reject) => {
const options = {
hostname: 'fullstory.com',
port: 443,
path: '/s/fs.js',
method: 'GET'
};
const req = https.request(options, async (res) => {
@fijimunkii
fijimunkii / dark-mode-slack-mac-osx.sh
Last active October 31, 2018 15:03
dark mode for slack mac osx app
echo "
document.addEventListener('DOMContentLoaded', function() {
\$.ajax({
url: 'https://raw.githubusercontent.com/fijimunkii/slack-night-mode/master/css/raw/black.css',
success: function(css) {
\$(\"<style></style>\").appendTo('head').html(css);
}
});
});
" >> /Applications/Slack.app/Contents/Resources/app.asar.unpacked/src/static/ssb-interop.js
@fijimunkii
fijimunkii / gist:211e96e24598c2c041f0238b0c6ae151
Created August 10, 2018 03:58 — forked from khakimov/gist:3558086
Matrix Effect in you terminal
echo -e "\e[1;40m" ; clear ; while :; do echo $LINES $COLUMNS $(( $RANDOM % $COLUMNS)) $(( $RANDOM % 72 )) ;sleep 0.05; done|awk '{ letters="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#$%^&*()"; c=$4; letter=substr(letters,c,1);a[$3]=0;for (x in a) {o=a[x];a[x]=a[x]+1; printf "\033[%s;%sH\033[2;32m%s",o,x,letter; printf "\033[%s;%sH\033[1;37m%s\033[0;0H",a[x],x,letter;if (a[x] >= $1) { a[x]=0; } }}'
@fijimunkii
fijimunkii / aws_whoami.sh
Created August 9, 2018 16:07
aws whoami
aws sts get-caller-identity
@fijimunkii
fijimunkii / find_networks.sh
Created July 16, 2018 14:30 — forked from afresh1/find_networks.sh
A script to find and connect to known wifi networks on OpenBSD. Works for me on my iwn card in my laptop
#!/bin/sh
# find_network.sh - An OpenBSD Wireless Network configurator
# Looks for available networks listed at the end of the script
# Use this by adding "!/path/to/find_network.sh \$if" to your wlan hostname.if
if=$1
if [ -z "$if" ]; then
echo "Usage: $0 interface" >&2
exit 2;
fi
@fijimunkii
fijimunkii / openbsd_caps_lock_ctrl.sh
Created July 14, 2018 20:23
openbsd caps_lock to ctrl
setxkbmap -option ctrl:nocaps
@fijimunkii
fijimunkii / gist:8521658fffa912c7ff85a6de51c3d00b
Last active February 11, 2019 19:28
websites for making emojis
Cut out background
https://online.photoscissors.com
https://www.remove.bg
Edit - brighten - crop - resize (128px)
https://www.befunky.com/create/
replace color in image
https://viliusle.github.io/miniPaint/
@fijimunkii
fijimunkii / uid_awk.sh
Created June 22, 2018 19:06 — forked from staaldraad/uid_awk.sh
Get the uid, gid and user groups without touching /etc/passwd or running the `id` command
awk -F: 'END {print "uid:"u" gid:"g" groups:"gg}{if($1=="Uid"){split($2,a," ");u=a[1]}if($1=="Gid"){split($2,a," ");g=a[1]}if($1=="Groups"){gg=$2}}' /proc/self/status
@fijimunkii
fijimunkii / awk_netstat.sh
Created June 22, 2018 19:06 — forked from staaldraad/awk_netstat.sh
AWK to get details from /proc/net/tcp and /proc/net/udp when netstat and lsof are not available
# Gawk version
# Remote
grep -v "rem_address" /proc/net/tcp | awk '{x=strtonum("0x"substr($3,index($3,":")-2,2)); for (i=5; i>0; i-=2) x = x"."strtonum("0x"substr($3,i,2))}{print x":"strtonum("0x"substr($3,index($3,":")+1,4))}'
# Local
grep -v "rem_address" /proc/net/tcp | awk '{x=strtonum("0x"substr($2,index($2,":")-2,2)); for (i=5; i>0; i-=2) x = x"."strtonum("0x"substr($2,i,2))}{print x":"strtonum("0x"substr($2,index($2,":")+1,4))}'
# No Gawk
# Local
grep -v "rem_address" /proc/net/tcp | awk 'function hextodec(str,ret,n,i,k,c){