Skip to content

Instantly share code, notes, and snippets.

import java.util.*;
class Person {
private String firstname;
private String secondname;
Person() {
//default constructor
}
/**
* Read in N integers and counts the number of triples
* that sum to exactly 0
*
* @author Ian Duffy
* @version 0.0.1
*
*/
import java.util.*;
#!/bin/bash
# Set up Samba4 as Domain Controller
# To be run on a fresh install of Ubuntu Server 12.04 with no optional packages selected save SSH
# architecture is x86_64, but only 1 place in this script does it matter.
@imduffy15
imduffy15 / gist:4377342
Created December 26, 2012 02:21
Extract mobile numbers
foreach($vCard as $vCardPart) {
if(isset($vCardPart->n[0]['FirstName']) && isset($vCardPart->tel[0]['Value'])) {
$number = $vCardPart->tel[0]['Value'];
$number = str_replace("-","",$number);
$number = str_replace("00353","0",$number);
$number = str_replace("+353","0",$number);
if(
substr($number,0,3) == "086" ||
substr($number,0,3) == "087" ||
substr($number,0,3) == "083" ||
twitter:card
twitter:url
twitter:title
twitter:description
twitter:image
og:title
og:description
og:image
itemprop name
itemprop description
class HashSet<T> {
private LinkedSet<T>[] hashTable;
@SuppressWarnings("unchecked")
HashSet() {
hashTable = (LinkedSet<T>[])(new LinkedSet[1000]);
for(int i=0;i<hashTable.length;i++) {
hashTable[i] = new LinkedSet<T>();
}
}
class LinkedSet<T> {
private class Node<T> {
private T item;
private Node<T> next;
Node(T item0, Node<T> next0) {
item = item0;
next = next0;
}
}
@imduffy15
imduffy15 / Treeset.java
Created January 11, 2013 12:51
TreeSet methods
import java.util.*;
class TreeSet<T extends Comparable<T>> {
private static class Node<T> {
private T item;
private Node<T> left, right;
Node(T item0, Node<T> left0, Node<T> right0) {
item = item0;
left = left0;
for(int rows=1; rows<(width+width); rows++) {
int numSpaces=Math.abs(width-rows);
if(numSpaces!=0) System.out.printf("%"+numSpaces+"s","");
for(int stars=0;stars<width-numSpaces;stars++) System.out.print("* ");
System.out.println();
}
#include <iostream>
using namespace std;
int main() {
string blackSquare = "\033[0;37;40m \033[0m";
string whiteSquare = "\033[0;37;47m \033[0m";
string currentColor = blackSquare;
for(int rows=0;rows<8;rows++) {
for(int cols=0;cols<8;cols++) {