Skip to content

Instantly share code, notes, and snippets.

View louiszuckerman's full-sized avatar

Louis Zuckerman louiszuckerman

View GitHub Profile
@louiszuckerman
louiszuckerman / dedupe.sh
Created March 25, 2022 14:03
Bash script to prune duplicate files
#!/bin/bash
# Delete files from src_folder that are present in target_folder
# USAGE: dedupe.sh <src_folder> <target_folder>
# Uncomment for Linux
SHA_CMD=sha1sum
# Uncomment for Mac
# SHA_CMD=shasum
@louiszuckerman
louiszuckerman / aws-ipv4.py
Created June 24, 2019 22:03
list all of the IPv4 addresses in an AWS region and provide a summary count
"""
List & count all IPv4 addresses in an AWS region
"""
import requests
REGION = 'us-east-1'
rsp = requests.get('https://ip-ranges.amazonaws.com/ip-ranges.json')
rj = rsp.json()
@louiszuckerman
louiszuckerman / AuthyToOtherAuthenticator.md
Created August 30, 2018 16:06 — forked from gboudreau/AuthyToOtherAuthenticator.md
Export TOTP tokens from Authy

Generating Authy passwords on other authenticators


There is an increasing count of applications which use Authy for two-factor authentication. However many users who aren't using Authy, have their own authenticator setup up already and do not wish to use two applications for generating passwords.

Since I use 1Password for all of my password storing/generating needs, I was looking for a solution to use Authy passwords on that. I couldn't find any completely working solutions, however I stumbled upon a gist by Brian Hartvigsen. His post had a neat code with it to generate QR codes (beware, through Google) for you to use on your favorite authenticator.

His method is to extract the secret keys using Authy's Google Chrome app via Developer Tools. If this was not possible, I guess people would be reverse engineering the Android app or something like that. But when I tried that code, nothing appeared on the screen. My gues

@louiszuckerman
louiszuckerman / string-split.lua
Last active July 20, 2016 22:51
recursive & iterative string split functions in Lua
-- example:
-- split("a", "/") --=> {"a"}
-- split("a/b/", "/") --=> {"a", "b", ""}
-- 3rd argument in split_r should be omitted by caller
function split_r(str, delim, parts)
if not parts then
parts = {}
end
local pos = str:find(delim)
if not pos then
@louiszuckerman
louiszuckerman / keybase.md
Created August 10, 2015 16:40
keybase.md

Keybase proof

I hereby claim:

  • I am semiosis on github.
  • I am louiszuckerman (https://keybase.io/louiszuckerman) on keybase.
  • I have a public key whose fingerprint is 5EC3 E841 A3DD D2D8 89D4 F7F3 0615 EEA7 4272 006F

To claim this, I am signing this object:

@louiszuckerman
louiszuckerman / essh
Last active August 29, 2015 14:26
SSH to EC2 host by Instance ID
#!/bin/bash
# Usage: essh { instance id } [ subcommand ]
ssh -X $(aws ec2 describe-instances --instance-ids $1 --query "Reservations[0].Instances[0].PublicIpAddress" --output text) $2
@louiszuckerman
louiszuckerman / fjp-du.java
Last active August 29, 2015 14:07
Multithreaded (forkjoinpool) du in java
package com.peircean.glustest;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.nio.file.*;
import java.util.LinkedList;
import java.util.List;
import java.util.concurrent.*;
@louiszuckerman
louiszuckerman / du.java
Last active August 29, 2015 14:06
A naive implementation of du -s in Java using NIO.2
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.nio.file.*;
public class Du {
public static final String PREFIX =
"gluster://172.31.31.31:foo/usr";
public static long total = 0;
@louiszuckerman
louiszuckerman / gist:ad9908cff91a80bf825d
Created June 11, 2014 17:31
TreeSet with lower & upper bounds
import java.util.Collection;
import java.util.Comparator;
import java.util.TreeSet;
public class BoundedTreeSet<T> extends TreeSet<T> {
private T min, max;
public BoundedTreeSet(Comparator<T> comparator, T min, T max) {
super(comparator);
this.min = min;
@louiszuckerman
louiszuckerman / multithread-printer
Last active August 29, 2015 13:57
Uses four threads to read four files and print chars to the console.
package com.peircean.glustest;
import java.io.BufferedReader;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.nio.charset.Charset;
import java.nio.file.Files;
import java.nio.file.Paths;