Skip to content

Instantly share code, notes, and snippets.

View akhiljalagam's full-sized avatar
🎯
Focusing

Akhil Jalagam akhiljalagam

🎯
Focusing
View GitHub Profile
@akhiljalagam
akhiljalagam / encrypt_decrypt.sh
Created August 20, 2020 17:59 — forked from pmarreck/encrypt_decrypt.sh
Some easy bash scripts to encrypt/decrypt data, for anyone who wants to go all cloak&dagger. (bitcoin private keys, etc.)
# Encryption functions. Requires the GNUpg "gpg" commandline tool. On OS X, "brew install gnupg"
# Explanation of options here:
# --symmetric - Don't public-key encrypt, just symmetrically encrypt in-place with a passphrase.
# -z 9 - Compression level
# --require-secmem - Require use of secured memory for operations. Bails otherwise.
# cipher-algo, s2k-cipher-algo - The algorithm used for the secret key
# digest-algo - The algorithm used to mangle the secret key
# s2k-mode 3 - Enables multiple rounds of mangling to thwart brute-force attacks
# s2k-count 65000000 - Mangles the passphrase this number of times. Takes over a second on modern hardware.
# compress-algo BZIP2- Uses a high quality compression algorithm before encryption. BZIP2 is good but not compatible with PGP proper, FYI.

Keybase proof

I hereby claim:

  • I am akhiljalagam on github.
  • I am akhiljalagam (https://keybase.io/akhiljalagam) on keybase.
  • I have a public key ASA2eZrK4wVipx-wpBWXaW3fj8tcfpT5d9OAnR6igb9qcAo

To claim this, I am signing this object:

@akhiljalagam
akhiljalagam / do-bulk-ip-add-firewall.sh
Last active July 15, 2020 11:54
How to bulk add IP addresses to DigitalOcean firewall?
#!/bin/bash
# Author: Akhil Jalagam
# update TOKEN, FIREWALL NAME, IP addresses and then run the script
TOKEN=dfjvbidvbasb4l5tu45hvu46vgl45h6vl
FIREWALL_NAME=internalaccess
curl -X POST -H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d \
@akhiljalagam
akhiljalagam / WindowsTerminal-Settings.json
Last active July 4, 2020 18:35
My Windows Terminal Settings with Solarized Dark scheme
// This file was initially generated by Windows Terminal 1.0.1811.0
// It should still be usable in newer versions, but newer versions might have additional
// settings, help text, or changes that you will not see unless you clear this file
// and let us generate a new one for you.
// To view the default settings, hold "alt" while clicking on the "Settings" button.
// For documentation on these settings, see: https://aka.ms/terminal-documentation
{
"$schema": "https://aka.ms/terminal-profiles-schema",
function calc1(form) {
a = form.a.value;
b = Math.round(Math.pow(Math.pow(a, 2)/1.31640624208984, .5)/2.97869411418791);
c = Math.round(Math.pow(Math.pow(a, 2)/1.31640624208984, .5)/4.46804291661112);
d = Math.round(Math.pow(Math.pow(a, 2)/1.31640624208984, .5)/6.70206437491669);
e = Math.round(Math.pow(Math.pow(a, 2)/1.31640624208984, .5)/13.9626341144098);
f = Math.round(Math.pow(Math.pow(a, 2)/1.31640624208984, .5)/27.9252682288196);
form.total1.value = b;
form.total2.value = c;
form.total3.value = d;
@akhiljalagam
akhiljalagam / create-mysql.bash
Created April 10, 2020 15:45 — forked from omeinusch/create-mysql.bash
Simple bash script to create mysql db, user with generated password
#!/bin/bash
PASS=`pwgen -s 40 1`
mysql -uroot <<MYSQL_SCRIPT
CREATE DATABASE $1;
CREATE USER '$1'@'localhost' IDENTIFIED BY '$PASS';
GRANT ALL PRIVILEGES ON $1.* TO '$1'@'localhost';
FLUSH PRIVILEGES;
MYSQL_SCRIPT
@akhiljalagam
akhiljalagam / import-rds-certs.sh
Created January 25, 2020 18:01 — forked from shareefhiasat/import-rds-certs.sh
import RDS certificates to java keystore on alpine / osx
#!/usr/bin/env sh
#i tried it and working like charm just have to note make the file .sh chmod +x and you may need sudo to run with permission but be carefull with sudo
#be sure the $JAVA_HOME is configure correctly or make it static as commentedline 7 below
OLDDIR="$PWD"
if [ -z "$CACERTS_FILE" ]; then
# you should have java home configure to point for example /usr/lib/jvm/default-java/jre/lib/security/cacerts
CACERTS_FILE=$JAVA_HOME/jre/lib/security/cacerts
fi
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCej5+ZVYorX/XUrRJGCtqEWvEcv/tAsxrwCzeJDQmINfoeDcHz5oumnT6hYs3izMaGCc0UKi8ibsktmKYeECvWFNJeHHclM+NEgsF85E9eq/E07BetuD6JefA8FetgkuvtAjhB+Rir9fF4a4YPnVshEh7e0dwaw7bG4WcJ1rrSbWePWoPjCEEISNUHKUmAW7KlN53WXIGlw7G1cPbGUG9372cfgWEW37DYCgeTCd7/mdXqFZe5xGui6phafzHh68fitmdRsEAlOlJkGKrT1hDJnj5oa5mNtZ1qJipkQT4EU1m4xi9SzgisBaKJEP+/xC5N2wu7+KFIF+jhYU5ZOMm1 akhil
@akhiljalagam
akhiljalagam / net-speed-and-brightness.sh
Created November 26, 2019 08:08
display brightness and net speed on i3 status bar
#!/bin/sh
# Authors:
# - Moritz Warning <moritzwarning@web.de> (2016)
# - Zhong Jianxin <azuwis@gmail.com> (2014)
# - Akhil Jalagam <contact@akhil.io> (2019)
#
# See file LICENSE at the project root directory for license information.
#
# i3status.conf should contain:
@akhiljalagam
akhiljalagam / NC-MySQLDUMP.sh
Last active October 31, 2019 10:39 — forked from vanjos/NC-MySQLDUMP.sh
Easy way to do a mysqldump and restore using netcat... with and without encryption
#!/bin/bash
#####
# You'll be needing two machines, the target machine and source one (makes sense, right)?
# without encryption
#####
# On the target machine
nc -l 55555 | gzip -d -c | mysql <database name> -u<user> -p<password> [ | <decrypt> ]