Skip to content

Instantly share code, notes, and snippets.

View aybabtme's full-sized avatar
👶
I may be slow to respond. Newborn in the house.

Antoine Grondin aybabtme

👶
I may be slow to respond. Newborn in the house.
View GitHub Profile
@aybabtme
aybabtme / gist:4040710
Last active October 12, 2015 14:28
Elective preferences
Course Description Own score Adjusted
CSI 3104 Introduction aux langages formels . 4 5 // Max: +1, Manuel +1
CSI 3120 Concepts des langages de programmation 5 5 // Max: -1, Manuel +1
CSI 3130 Databases II 3 2 // Dan: it's 'meh' -0.5, Max : -0.5
CSI 3140 WWW Structures 4 2 // Dan: it's complete bullshit -1, Max : -1
CSI 4103 Topics in Computer Science I . ??? ???
CSI 4105 Design and Analysis of Algorithms II. 3 4 // Max: +1
CSI 4106 Introduction to Artificial Intelligence 5 5 // Chris: it sucks dick through a hose -1. anon: it's okay +1, max +1
CSI 4107 Information Retrieval and the Internet 5 4 // Dan: it's 'meh' -1
CSI 4108 Cryptography 4 5.5 // Dan recommends +1, Max: -0.5, Manuel +1
@aybabtme
aybabtme / gist:4052500
Created November 10, 2012 21:08
CSI2110 Sorting
public class Sort {
private final static boolean D = true;
public static void main(String[] args) {
int[] array = {5,2,1,9,12,32,8,6};
SortAlgo[] algos = {
@aybabtme
aybabtme / DoubleHash.java
Created November 10, 2012 21:10
CSI 2110 Hashing
public class DoubleHash {
public static void main(String[] args) {
DoubleHash map = new DoubleHash(17);
map.insert( 17 );
map.insert( 2 );
map.insert( 8 );
map.insert( 19 );
map.insert( 15 );
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
package textEditor.core.algorithms;
import static org.junit.Assert.*;
import java.util.ArrayList;
import java.util.Arrays;
import org.junit.Before;
import org.junit.Test;
@aybabtme
aybabtme / gist:4237807
Created December 8, 2012 00:29
Regex for valid emails (RFC 2322) + minimum 2 char for top-level domain
var email_validator = new RegExp("^[\w!#$%&'*+/=?`{|}~^-]+(?:\.[!#$%&'*+/=?`{|}~^-]+)*@(?:[A-Z0-9-]+\.)+[A-Z]{2,6}$");
@aybabtme
aybabtme / gist:5165927
Last active December 14, 2015 23:29
Attempt at #14, CSI2501 devoir 2.
// Give a recursive algorithm for finding a mode of a list of integers.
// (A mode is an element in the list that occurs at least as often as
// every other element.)
func mode(l list<integer>) integer {
if null(l) { return NaN }
else { return aux_mode(l, new map<int,0>) }
}
func aux_mode(l list<integer>, count map<int,int>) integer {
func ones(s bitstring) integer {
if null(s) { return 0 }
else if size(s) == 1 { return s[0] }
else { return s[0] + ones( s[1,end] ) }
}
@aybabtme
aybabtme / Vertex.java
Created March 30, 2013 18:37
that = this in Java
private Comparator<Vertex<Value>> getComparator(){
final Vertex<Value> that = this;
return new Comparator<Vertex<Value>>() {
@Override
public int compare(Vertex<Value> v1, Vertex<Value> v2) {
double h1 = heuristic.getCost(that, v1);
double h2 = heuristic.getCost(that, v2);
double d1 = that.distanceTo(v1);
public class Test {
public static void main(String[] args) {
byte first = 0x0F;
byte second = 0x0B;
byte concat = 0x00;
System.out.printf("Before, first=%s, second=%s, concat=%s.\n",
printBinary(first),
printBinary(second),
printBinary(concat));