Skip to content

Instantly share code, notes, and snippets.

View rhulha's full-sized avatar

Raymond Hulha rhulha

View GitHub Profile
void printBitsI(unsigned int num)
{
for (int bit = 0; bit<(sizeof(unsigned int) * 8); bit++) {
printf("%i ", num & 0x01);
num = num >> 1;
}
}
void printBitsC(unsigned char num)
{
@rhulha
rhulha / Q3BSP.bt
Last active September 14, 2018 08:37
010 Editor Binary Template for Quake3 BSP files
//--------------------------------------
//--- 010 Editor v5.0.2 Binary Template
//
// Author: rhulha
// Purpose: 010 Editor Binary Template for Quake3 BSP files
//--------------------------------------
LittleEndian();
char signature[4];
@rhulha
rhulha / SpeechClient.java
Created October 2, 2016 22:32
A small example Google Natural Language Analyzer demo client with microphone recording.
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import javax.sound.sampled.*;
import net.raysforge.commons.Codecs;
import net.raysforge.commons.Json;
import FairCom.CtreeDb.*;
import FairCom.CtreeDb.Types.*;
import java.util.Calendar;
/**
* Java + JTDB Hello world Example
*
*/
public class App {
public static void main(String[] args) {
package srt2vtt;
import java.io.*;
public class Srt2Vtt {
enum State { Number, TimeStamp, Text };
public void convert(Reader srt, Writer vtt) throws IOException {
BufferedReader br = new BufferedReader(srt);
String line;
import com.marklogic.client.*;
import com.marklogic.client.document.*;
import com.marklogic.client.io.*;
import com.marklogic.client.query.*;
public class TestMarkLogic {
public static void main(String[] args) {
DatabaseClient client = DatabaseClientFactory.newClient("localhost", 8000, "Admin", "Admin", DatabaseClientFactory.Authentication.DIGEST);
package net.raysforge.visual.demo;
import java.awt.Color;
import java.awt.Font;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
@rhulha
rhulha / TicTacToeOld.java
Last active November 6, 2015 21:23
Original starting code base from www3.ntu.edu.sg/home/ehchua/programming/java/javagame_tictactoe_ai.html
package net.raysforge.visual.demo;
import java.awt.Color;
import java.awt.Container;
import java.awt.Font;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.List;
package net.raysforge.visual.demo;
import java.awt.Color;
import java.awt.Container;
import java.awt.Font;
import java.awt.GridLayout;
import java.awt.Point;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
@rhulha
rhulha / deepCompare.java
Created October 5, 2015 18:26
Java deepCompare
public static boolean deepCompare(Object o1, Object o2) {
try {
ByteArrayOutputStream baos1 = new ByteArrayOutputStream();
ObjectOutputStream oos1 = new ObjectOutputStream(baos1);
oos1.writeObject(o1);
oos1.close();
ByteArrayOutputStream baos2 = new ByteArrayOutputStream();
ObjectOutputStream oos2 = new ObjectOutputStream(baos2);
oos2.writeObject(o2);