Skip to content

Instantly share code, notes, and snippets.

@Equinox-
Equinox- / StringMasks.py
Last active Oct 6, 2015
Added support for back conversion.
View StringMasks.py
#!/usr/bin/python
def stringToInt(name):
name=name[::-1]
val=0
offset=0
for char in name:
val = val + ((ord(char) & 0xff) << offset)
offset = offset + 8
return val
@Equinox-
Equinox- / SMF Newsreel
Created Jul 3, 2012
Fetches all the topics in the given forum.
View SMF Newsreel
<?php
$mysql_host = "";
$mysql_database = "devoxstu_smf391";
$mysql_user = "";
$mysql_password = "";
$forum = 1;
mysql_connect($mysql_host, $mysql_user, $mysql_password)or die("cannot connect");
mysql_select_db($mysql_database)or die("cannot select DB");
//Grab the topics
@Equinox-
Equinox- / JavaConventions2.xml
Created Jul 3, 2012
Westin's java conventions
View JavaConventions2.xml
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<profiles version="12">
<profile kind="CodeFormatterProfile" name="Java Conventions 2" version="12">
<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.disabling_tag" value="@formatter:off"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration" value="end_of_line"/>
View 1983Defines2012.h
#ifndef __1983DEFINES_H
#define __1983DEFINES_H
#define PRACTICE_BOT 1
#define PRACTICE_OI 0
#define REGULAR_OI 0
#define JOYSTICK_CONTROL 1
//PewPew Start
#define DEADBAND 0.04
View gist:4010095
#!/bin/bash
while :
do
read line
if [ "$line" ]; then
echo $line
fi
done < $1
View injector.js
var fileList = {
"mp_res":"media/icons_context-0.png",
"mp_attack":"media/icons_context-1.png",
"mp_lock":"media/icons_context-2.png",
"mp_star":"media/icons_context-3.png",
"mp_message":"media/icons_context-4.png",
"mp_profile":"media/icons_context-5.png",
"mp_village":"media/icons_context-6.png",
"mp_recruit":"media/icons_context-7.png",
"mp_winadd":"media/icons_context-8.png",
@Equinox-
Equinox- / gist:5127232
Last active Dec 14, 2015
Object cloning in javascript
View gist:5127232
Object.prototype.clone = function () {
var obj = {};
for (key in this) {
obj[key] = this[key];
}
return obj;
}
Object.prototype.deepClone = function () {
var obj = {};
@Equinox-
Equinox- / gist:5127682
Created Mar 10, 2013
Basic structure of a time based termination command.
View gist:5127682
class CommandThing ... {
private:
long startTime;
//classy stuff
}
void CommandThing::Initialize() {
startTime = GetFPGATime(); // Get a reference point
}
@Equinox-
Equinox- / KittensBookmarklet.js
Last active Dec 30, 2015
Floating kittens bookmarklet.
View KittensBookmarklet.js
javascript:(function(){if ((typeof spawnKitten) === "function") {spawnKitten();} else {var element = document.createElement("script");element.type = "text/javascript";element.src = "https://gist.github.com/Equinox-/7783216/raw/TheScript.js";document.head.appendChild(element);}})();
@Equinox-
Equinox- / Simulation.java
Created Dec 10, 2013
Java implementation of an N-Body simulation; main loop code.
View Simulation.java
// Lets go
for (int i = 0; i < bodies.size(); i++) {
Body b = bodies.get(i);
for (int w = i + 1; w < bodies.size(); w++) {
Body with = bodies.get(w);
double dist2 = // The distance between the two bodies
with.getPosition().dist(
b.getPosition());
double mag = // The force between the two bodies
Constants.GRAVITATIONAL_CONSTANT