Skip to content

Instantly share code, notes, and snippets.

View marcaddeo's full-sized avatar
🦀

Marc Addeo marcaddeo

🦀
View GitHub Profile
@marcaddeo
marcaddeo / db-migrate.coffee
Created January 23, 2012 23:37
DB Migration tool to migrate from a JSON datastore to postgres
pg = require 'pg'
fs = require 'fs'
conString = "tcp://user:password@localhost/tv";
client = new pg.Client(conString);
client.connect();
mediaList = JSON.parse(fs.readFileSync('media-list/media.json'))
numbers =
@marcaddeo
marcaddeo / Crypto.cpp
Created January 23, 2012 23:17
Encryption methods
#include "Crypto.h"
#include "keys.h"
Crypto::Crypto( void ) :
m_useNewKeys(false)
, m_localCounter()
, m_remoteCounter()
{}
@marcaddeo
marcaddeo / Crypto.java
Created January 23, 2012 23:11
Encryption methods
package crypto;
public class Crypto {
private char[] Key1 = {
// Omitted
};
private char[] Key2 = {
// Omitted
@marcaddeo
marcaddeo / class.db.php
Created January 23, 2012 21:44
A wrapper for PHP's MySqli class.
<?php
/*
** MySQL Abstraction Class
** Allows object creation for DB interaction on more advanced level.
** Objective of this class: Bring exceptions into MySQL errors to provide
** Better error verification and diagnosis.
**
** REQUIREMENTS:
** PHP5 with MySQLi support compiled and configured
@marcaddeo
marcaddeo / EventHandler.java
Created January 23, 2012 21:35
Event Handler for event based client server application.
package mamclient;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import csocket.Packet;