Skip to content

Instantly share code, notes, and snippets.

View WillDignazio's full-sized avatar

William Ziener-Dignazio WillDignazio

View GitHub Profile
@WillDignazio
WillDignazio / emojify.py
Created September 5, 2019 18:59
Emojify a string
import random
import sys
strings = {
"2": [":battlefield-2:", ":bf2:"],
"99": [":99:"],
"a": [":amazon:", ":amd:", ":anarchy:", ":angular:", ":ansible:", ":arch:", ":atlassian:", ":azure:"],
"actually": [":actually:"],
"ati": [":ati:"],
"app": [":app:"],
#include <stdio.h>
int main(int argc, char *argv[]) {
char *test_string;
test_string = "foobar";
printf("%s\n", test_string);
return 0;
}
@WillDignazio
WillDignazio / ClosureTest.java
Created November 15, 2015 22:54
Parallel Order Java
import java.util.List;
import java.util.ArrayList;
import java.util.stream.Collectors;
import java.util.concurrent.ConcurrentLinkedQueue;
public class ClosureTest {
public static void main(String[] args) {
List<String> lst = new ArrayList<>();
lst.add("Alice");
lst.add("Will");
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
public class Trie {
private String val;
private Trie parent;
private final Map<String, Trie> trie = new HashMap<>();
private int _count = 0;
@WillDignazio
WillDignazio / GenericArray.java
Created October 26, 2015 18:25
Generic Array Wishful Thinking
public class GenericArray {
public static void main(String[] args) {
Pair<String, String> arr[] = new Pair<String, String>[10]; // BOOM!
}
}
@WillDignazio
WillDignazio / Fib.java
Last active September 29, 2015 18:06
Fibonacci Generator with both recursive algorithm (fibn) and closed form solution (fiba)
import java.util.Date;
public class Fib {
public static int fibn(int n) {
if (n == 0 || n == 1)
return n;
### Keybase proof
I hereby claim:
* I am WillDignazio on github.
* I am slackwill (https://keybase.io/slackwill) on keybase.
* I have a public key whose fingerprint is A7C5 85BC CED2 8189 4892 DDF1 BCBA 9484 916C 52F5
To claim this, I am signing this object:
#!/bin/python
import requests
import multiprocessing
import uuid
import time
def worker():
while True:
req = requests.post("http://uvb.csh.rit.edu/register/rhubarb_%s" % uuid.uuid4())
time.sleep(1)
@WillDignazio
WillDignazio / algoe.c
Last active December 22, 2015 01:29
Algorithm E Implementation
/*
* Algorithe E -- verbose
*/
#include <stdio.h>
#include <stdlib.h>
/*
* Given two positive integers m and n, we may computer their greatest common
* divisor d, and we also compute two not-necessarily positive integers a and b
@WillDignazio
WillDignazio / ext2trace.c
Created July 28, 2013 11:44
ext2 tracer, just a quick little demo that rips the superblock information out of an ext2 filesystem. I'm going to extend this later, but this is just the... gist of what I will be doing. Not sure of the implication of specifying uint[8,16,32] as the le and u types, this was tested on x86_64 architecture, might have an awful time on architecture…
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <unistd.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <fcntl.h>
typedef uint8_t __u8;
typedef uint16_t __u16;