Skip to content

Instantly share code, notes, and snippets.

View jeffrade's full-sized avatar

Jeff Rade jeffrade

View GitHub Profile
jeffrade /
Last active March 4, 2021 20:13
Securing Native Mobile connecting to a GraphQL API

Certificate Pinning is highly recommended. OWASP has outlined the Who, What, Why and How.

Static keys (as opposed to user generated keys with randomness) need to be, at a minimum, obfuscated away. There are many ways (and in complexity) to do this (e.g. at a minimum, Proguard for Android) and Carve Systems has a good write-up on this.

It should go without saying, but all APIs (not just GraphQL) should only be served over HTTPS and every request authenticated (e.g. HMAC and many libraries in all languages already implement this).

Common attacks on a GraphQL API with best practices and recommendations outlined here by OWASP.

A good GraphQL security audit tool [here](

jeffrade /
Last active August 17, 2020 22:06
Bash script that checks for IP change and updates Route53
# Usage: Launch in the background and pass RECORD_SET_NAME (e.g.
# as a first argument for the Route53 record. Log file can be found at /var/tmp/r53-record.log
jeffrade /
Created September 11, 2019 19:06
Install Kafka on CentOS 7
echo "Starting..."
cd ~/
tar -xzvf openjdk-12.0.1_linux-x64_bin.tar.gz
echo "PATH=$PATH:$HOME/jdk-12.0.1/bin" >> ~/.bash_profile
echo "export PATH" >> ~/.bash_profile
echo "export JAVA_HOME=$HOME/jdk-12.0.1" >> ~/.bash_profile
jeffrade /
Last active October 21, 2023 05:59
bitcoind systemd service and start script.
# Just a simple wrapper to start bitcoind.
# If using systemd, simply create a file (e.g. /etc/systemd/system/bitcoind.service)
# from example file below and add this script in ExecStart.
# Then run following to always start:
# systemctl enable bitcoind
jeffrade /
Last active February 6, 2020 13:47
Running a Bitcoin Core Full Node - Additional Installation Notes

Addtional Setup and Installation Notes for Running a Full Node (Linux)

  • Install fail2ban
  • (Optional) Block data is getting larger (although at a slower pace), so you might be mounting an external drive to .bitcoin dir. If so follow these steps:
   # You want this to auto mount on reboot (or else you'll have to manually mount every time):
 - `sudo blkid` # Make note of the UUID of your drive
 - `sudo vim /etc/fstab` # Append additional entry and your mount directory (easy to default to `$HOME/.bitcoin`)
    e.g. `UUID=<hexadecimal-dashed-uuid> /home/<your-user-name>/.bitcoin/ ext4 defaults 0 0` 
 - `sudo mount -a` # Test this, you'll get errors if any
jeffrade /
Created June 30, 2019 14:41
Install fail2ban on Debian Linux
#!/bin/sh -x
echo "Starting..."
apt-get install -y fail2ban
systemctl start fail2ban
systemctl enable fail2ban
> /etc/fail2ban/jail.local
jeffrade / list_fun.ex
Created June 24, 2019 15:54
Tail recursive implementaion of doubling every other number in a list.
View list_fun.ex
defmodule ListFun do
def double_every_other([], acc), do: acc
def double_every_other([head | nil], acc) do
new_acc = [head * 2 | acc]
double_every_other([], new_acc)
def double_every_other([head | tail], acc) when length(tail) == 0 do
jeffrade / recursion.ex
Created June 11, 2019 14:11
Tail recursion is optimized way to do recursion in Elixir
View recursion.ex
defmodule Recursion do
@moduledoc """
Showing how tail recursion is optimized way to do recursion (i.e. no memory loss since function calls not kept on stack).
def correct_tail_recursion_adding([head | tail], accumalator) do
correct_tail_recursion_adding(tail, accumalator + head)
def correct_tail_recursion_adding([], accumulator) do
jeffrade /
Last active February 19, 2019 22:46
Bash script that will pop a line item for a file and pass it to a command.
echo "Starting..."
param=`sed -e 1$'{w/dev/stdout\n;d}' -i~ params.out`
while [[ -n $param ]]; do
echo "Starting process for $param..."
<some-command> $param &
curr_pid=`echo $!`
jeffrade /
Last active August 17, 2020 22:07
Bash Script (infinite loop) to Upload Files to AWS S3 Glacier
echo "Running..."
while :; do
echo "Finding oldest file..."