Skip to content

Instantly share code, notes, and snippets.

View andrewhodel's full-sized avatar

Andrew Hodel andrewhodel

View GitHub Profile
@andrewhodel
andrewhodel / linediff.js
Created June 24, 2021 17:54
diff two files by line with any type line character
var fs = require('fs');
var o = fs.readFileSync('./file1.txt').toString();
var oo = fs.readFileSync('./file2.txt').toString();
var get_lines_array = function(str) {
if (typeof(str) != 'string') {
console.log('must pass string to get_lines_array()');
process.exit(1);
@andrewhodel
andrewhodel / iptables-rate-limit
Last active July 31, 2023 02:29
iptables-rate-limit
sudo iptables -F
sudo ip6tables -F
# limit traffic with destination port 443 to 80 NEW CONNECTIONS per minute
# --hashlimit-burst is when the rate limiting starts counting, at the first new connection
# --hashlimit-htable-expire is in milliseconds and is required to be at least as long as the --hashlimit-above interval
# use a different --hashlimit-name with each service
# accept port traffic
@andrewhodel
andrewhodel / aws.js
Last active October 13, 2020 17:59
aws.js AWS library for Node.JS
var https = require('https');
var crypto = require('crypto');
var get_signature = function(secret_key, auth_date, region, service) {
// return the AWS version 4 signature
// by chaining through 4 different strings and creating a sha256 hash for each
// to generate a 256 bit key
//console.log('get_signature():', secret_key, auth_date, region, service);
/*
Copyright 2016 Andrew Hodel
[email protected]
LICENSE
This program, design, source code, document or sequence of bits is licensed and the terms issued below must be followed. By using or reading or including this content you are automatically a licensee granted permission by the licensor (Andrew Hodel) under the following terms.
Usage - You may use this content under the following conditions: