Skip to content

Instantly share code, notes, and snippets.

View stephnr's full-sized avatar
🌊
Chilling

Stephen Rodriguez stephnr

🌊
Chilling
View GitHub Profile
@stephnr
stephnr / tailKinesis
Created February 2, 2018 15:11
Tail a kinesis stream for decrypted records
#!/bin/bash
red=$'\e[1;31m'
green=$'\e[1;32m'
yellow=$'\e[1;33m'
blue=$'\e[1;34m'
magenta=$'\e[1;35m'
cyan=$'\e[1;36m'
dim=$'\e[2m'
end=$'\e[0m'
@stephnr
stephnr / fuzzy.filter.js
Last active April 15, 2016 20:45
Custom Fuzzy Filter AngularJS Pipe against ambiguous iterable types (i.e. List of Objects of Arrays of Objects of ... [etc.])
(function () {
'use strict';
angular.module('app')
.filter('fuzzyFilter', FuzzyFilter);
/**
* Flattens an array<any> into an array of elements
* where the elements contain only literals (i.e. Strings, Numbers, Booleans)
* @param {Array<any>} arr an iterable to flatten
// Built from https://github.com/zhiyelee/node-leetcode
/**
* Converts an array into a Linked List
* @param {Array<Number>} arr the array to convert
* @return {Object} the linked list object
*/
var createList = arr => {
var head = { val: null, next: null };
var current = head;
@stephnr
stephnr / crypto.py
Last active August 29, 2015 14:05
Python Password Encryption using Passlib -- https://pythonhosted.org/passlib/index.html
from passlib.hash import sha256_crypt
# Create Encrypted Password
hash = sha256_crypt.encrypt("super_secret_password")
# Verify Encrypted Password
sha256_crypt.verify("super_secret_password", hash)
@stephnr
stephnr / domReady.js
Created June 30, 2014 14:28
Custom DomReady Script
// Custom Dom Ready Function Script
function f() {
// Do Something
}
function r(f){/in/.test(document.readyState)?setTimeout('r('+f+')',9):f()}
// Credit: http://www.dustindiaz.com/smallest-domready-ever
@stephnr
stephnr / Generate_PrimeTable.java
Last active January 2, 2016 04:48
Prime number generators written in Java. Both Eratosthenes and Atkins Sieves are implemented within as functions. Feel free to use as is. Average run time: 1.5 seconds. * I advise not running the complex values "abnormally" higher than 50,000. Complexity is exponential.
import java.util.*;
public class Generate_PrimeTable {
public static void main(String args[]) {
int erato_complex = 50000;
ArrayList<Integer> erato_primes = eratosthenes_Sieve(erato_complex);
System.out.println("Eratosthenes Sieve:");
System.out.println("Complexity: " + erato_complex);
System.out.println("# of Primes in Prime Chart: " + erato_primes.size());
System.out.println("Largest Prime: " + erato_primes.get(erato_primes.size() - 1));
@stephnr
stephnr / RSA.java
Last active January 2, 2016 04:48
RSA key generator written in Java. Implements the eratosthenes sieve for computing prime numbers. Keys are based from a selection of 5000 prime numbers. Estimated run time efficiency: [ Roughly ~ 0.8 seconds ]
import java.util.Random;
import java.util.ArrayList;
import java.util.StringTokenizer;
import java.math.BigInteger;
class RSA {
private int[] public_Key = new int[2];
private int[] privat_Key = new int[2];
public static void main(String[] args) {