Skip to content

Instantly share code, notes, and snippets.

View moogzy's full-sized avatar

Adrian Arumugam moogzy

View GitHub Profile
@moogzy
moogzy / crack.py outputs
Last active April 27, 2017 17:32
Password Cracking Tool in Python - outputs from cracking 4 character passwords hashed via DES(using C crypt lib).
~/workspace/pset6/ (master) $ python ./crack.py 50WUNAFdX/yjA
Yale
~/workspace/pset6/ (master) $ python ./crack.py 50.jPgLzVirkc
hi
~/workspace/pset6/ (master) $ python ./crack.py 50YHuxoCN9Jkc
JH
~/workspace/pset6/ (master) $ python ./crack.py 50QvlJWn2qJGE
NOPE
~/workspace/pset6/ (master) $ python ./crack.py 50CPlMDLT06yY
ha
@moogzy
moogzy / jpegrecovery.c
Created January 14, 2017 02:59
JPEG recovery software in Clang - expects .raw src image file.
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
typedef uint8_t BYTE; // rename to BYTE for clarity.
int main(int argc, char *argv[])
{
unsigned char *buffer; // Initialize buffer ptr for later malloc.
char *newimgfile; // Initialize filename ptr for later malloc.
@moogzy
moogzy / resize.c
Created January 12, 2017 14:00
Bitmap image resizer - clang
/*
*
* Resize a BMP by given 'resize val'.
*
* Arugments:
* resize_val: An integer to resize the BMP by. (Must be between 0 - 100)
* infile: BMP File to read.
* outfile: File to create as the resized BMP.
*
* Usage: ./resize resizevalue infile outfile
@moogzy
moogzy / dateofeaster.py
Created January 11, 2017 06:28
Calculate date of easter for years 1900 - 2099
#!/usr/bin/python
def calcEasterDate(year):
"""
Use easter date algorithm to calculate the day of
easter for a given year.
If the year given is in a special range(special_years)
then subtract 7 from the final date.
@moogzy
moogzy / montecarlopi.py
Last active January 10, 2017 10:50
Pi Approximation in Python (Turtle Dartboard Monte Carlo Simulation)
#!/usr/bin/python
"""
How to think like a computer scientist
Exercise: Approximating the value of Pi with Turtles!
Author: Adrian Arumugam
Date: 2016-01-10
@moogzy
moogzy / fifteen.c
Created December 13, 2016 12:54
Implementation of the "Game of Fifteen" for CS50x
/**
* fifteen.c
*
* Computer Science 50
* Problem Set 3
*
* Author: Adrian Arumugam([email protected])
* Date: 2016-12-13
*
* Implements Game of Fifteen (generalized to d x d).
package main
import "fmt"
// fibonacci is a function that returns
// a function that returns an int.
//
// (aru): I don't believe this is a true closure either?
// or if it is...that it is more complex than it needs to be.
func fibonacci_naive() func(int) int {
package main
import "fmt"
import "math"
// fibonacci is a function that returns
// a function that returns an int.
func fibonacci() func(int) int {
return func(x int) int {
// Use the Golden ratio formula to calculate the fibonacci value given an integer
@moogzy
moogzy / gist:7f2f71dea3d5eba261b85c899ee7c97e
Created November 3, 2016 12:39
Exercise: Maps (Word count) - tour.golang.org/moretypes/23
package main
import (
"golang.org/x/tour/wc"
"strings"
)
// Implement WordCount. It should return a map of the counts of each “word” in the string s.
// The wc.Test function runs a test suite against the provided function and prints success or failure.
func WordCount(s string) map[string]int {
@moogzy
moogzy / caesar.c
Created September 23, 2016 08:07
Implementation of caesar cipher in C.
/*
CS50x: Implementation of Caesar Cipher.
Usage:
./caesar <key-value>
Args:
key-value: A positive integer