Skip to content

Instantly share code, notes, and snippets.

View korydraughn's full-sized avatar

Kory Draughn korydraughn

  • RENCI
  • Raleigh, NC
View GitHub Profile
@korydraughn
korydraughn / readme.md
Created January 25, 2024 13:47 — forked from thomasdarimont/readme.md
Example for decoding a JWT Payload with your Shell (bash, zsh...)

Setup

Add this to your .profile, .bashrc, .zshrc...

decode_base64_url() {
  local len=$((${#1} % 4))
  local result="$1"
  if [ $len -eq 2 ]; then result="$1"'=='
  elif [ $len -eq 3 ]; then result="$1"'=' 
  fi
 echo "$result" | tr '_-' '/+' | openssl enc -d -base64

1. Create a dedicated project to host your Maven repository on Github

For example, you can have a mvn-repo project created.

2. Clone the remote mvn-repo into your local folder

For example, into ~/workspace/mvn-repo folder

3. Build your project and deploy it into your local folder.

In order to do this, you will need to have the following snippet in your pom.xml file

@korydraughn
korydraughn / TestMemoryAllocator.cpp
Created November 23, 2021 15:04 — forked from IvanIvanoff/TestMemoryAllocator.cpp
Unit tests for the memory allocator using the Microsoft Unit Test Framework for C++
#include "stdafx.h"
#include "CppUnitTest.h"
#include "../MemoryAllocator/MemoryAllocator.h"
#include "../MemoryAllocator/MemoryAllocator.cpp"
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
BEGIN_TEST_MODULE_ATTRIBUTE()
TEST_MODULE_ATTRIBUTE(L"Project", L"UnitTests")
TEST_MODULE_ATTRIBUTE(L"Date", L"24/01/2016")
END_TEST_MODULE_ATTRIBUTE()
@korydraughn
korydraughn / SQL Cheat Sheet.md
Created May 26, 2021 13:50 — forked from janikvonrotz/SQL Cheat Sheet.md
SQL Cheat Sheet#SQL#Markdown

SQL languages

DDL is short name of Data Definition Language, which deals with database schemas and descriptions, of how the data should reside in the database.

DML is short name of Data Manipulation Language which deals with data manipulation, and includes most common SQL statements such SELECT, INSERT, UPDATE, DELETE etc, and it is used to store, modify, retrieve, delete and update data in database.

DCL is short name of Data Control Language which includes commands such as GRANT, and mostly concerned with rights, permissions and other controls of the database system.

Datatypes

Text types

@korydraughn
korydraughn / gist:64d7df11a007ecdcc3a545a7513fb88a
Created August 17, 2019 15:22 — forked from trongthanh/gist:1196596
Emulate slow Internet connection speed on localhost with netem (Ubuntu)
#Refer: http://www.linuxfoundation.org/collaborate/workgroups/networking/netem#Delaying_only_some_traffic
#Refer: http://www.bomisofmab.com/blog/?p=100
#Refer: http://drija.com/linux/41983/simulating-a-low-bandwidth-high-latency-network-connection-on-linux/
#Setup the rate control and delay
sudo tc qdisc add dev lo root handle 1: htb default 12
sudo tc class add dev lo parent 1:1 classid 1:12 htb rate 56kbps ceil 128kbps
sudo tc qdisc add dev lo parent 1:12 netem delay 200ms
#Remove the rate control/delay
sudo tc qdisc del dev lo root
@korydraughn
korydraughn / docker-cleanup-resources.md
Created July 12, 2019 23:42 — forked from bastman/docker-cleanup-resources.md
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm