Skip to content

Instantly share code, notes, and snippets.

View shoffing's full-sized avatar
🛒
get it? it's a "shoffing cart"

shoffing

🛒
get it? it's a "shoffing cart"
View GitHub Profile
@shoffing
shoffing / L3G4200D.ino
Created February 19, 2014 01:40
Source code for working with the L3G4200D using Arduino and Processing
#include <Wire.h>
#define CTRL_REG1 0x20
#define CTRL_REG2 0x21
#define CTRL_REG3 0x22
#define CTRL_REG4 0x23
#define CTRL_REG5 0x24
// I2C address of the L3G4200D.
// Use I2C scanner to find this value!
<head>
<title>PropSlam Mumble Counter</title>
<link href='http://fonts.googleapis.com/css?family=Inconsolata' rel='stylesheet' type='text/css'>
<script src="http://code.jquery.com/jquery-1.10.2.min.js"></script>
<style>
body {
font-family: 'Inconsolata', sans-serif;
{
"name": "(TODO) Simple Ship Mk I",
"parts": [
{
"type": "brain",
"pos": [0,0]
},
{
"type": "hull",
"pos": [-1,0],
local turnLeft = false
function Update()
-- Store our angular velocity in a variable to make it easier to use
local angVel = gyro:AngVel()
if ranger:Range() > 0 then
-- We see another ship, stop spinning, start ramming,
-- and remember which way to turn if we lose it again
@shoffing
shoffing / testing.py
Created September 9, 2015 19:36
17x17 9/9/15
import random
import time
import copy
# Parameters
NUM_COLORS = 4
NUM_ROWS = 17
NUM_COLS = 17
NUM SOLS PER GEN,% SELECTION,% CHILDREN,% RANDOM,MUTATION,CROSSOVER BUFFER,PRESERVE,AVERAGE T2S
10,0.2,0.8,-2.22E-16,0.05,0,0,0.023999989
10,0.2,0.6,0.2,0.05,0.1,1,0.024999976
10,0.2,0.7,0.1,0.05,0,0,0.024999976
10,0.2,0.8,-2.22E-16,0.05,0.15,1,0.025250137
10,0.3,0.6,0.1,0.05,0.15,2,0.0255
15,0.2,0.8,-2.22E-16,0.05,0.05,2,0.025500059
10,0.2,0.6,0.2,0.05,0.05,1,0.025749981
10,0.2,0.7,0.1,0.05,0.1,0,0.025750041
10,0.2,0.8,-2.22E-16,0.05,0.05,0,0.026250064
@shoffing
shoffing / MinMaxByExtensions.cs
Last active May 29, 2018 03:21
Adds the functional extension methods MinBy and MaxBy to IEnumerables.
using System;
namespace System.Collections.Generic
{
public static class MinMaxBy
{
public static T MinBy<T>(this IEnumerable<T> list, Func<T, IComparable> selector)
{
IComparable lowest = null;
T result = default(T);
@shoffing
shoffing / read_demo.js
Created September 19, 2018 21:27
reads csgo demos and extracts initial spawns, bomb plants, and attacks
const demofile = require('demofile');
const fs = require('fs');
const _ = require('lodash');
const DEMO_FILE = 'astralis-vs-liquid-inferno.dem';
let distance3 = (p1, p2) => {
return Math.sqrt( Math.pow(p2.x - p1.x, 2) + Math.pow(p2.y - p1.y, 2) + Math.pow(p2.z - p1.z, 2) );
};
const fs = require('fs');
const _ = require('lodash');
const D3Node = require('d3-node');
const ATTACKS_FILE = 'inferno.json';
const DAMAGE_ALPHA_SCALE = 0.9;
const BORDER = 2048;
const data = JSON.parse(fs.readFileSync(ATTACKS_FILE));
const attacks = data.attacks;
@shoffing
shoffing / inferno_damage_faceit_2018.json
Created September 20, 2018 01:58
JSON file containing all instances of damage dealt (that I found) during FACEIT major 2018. Also includes bomb plants.
This file has been truncated, but you can view the full file.
{"attacks":[{"time":56.8203125,"attacker":{"pos":{"x":2595.98779296875,"y":-120.5957260131836,"z":84.03125},"team":"CT","name":"fer"},"victim":{"pos":{"x":1990.938232421875,"y":146.4513397216797,"z":173.1717071533203},"team":"T","name":"shox"},"amount":19,"weapon":"weapon_usp_silencer"},{"time":57.1796875,"attacker":{"pos":{"x":2595.98779296875,"y":-120.5957260131836,"z":84.03125},"team":"CT","name":"fer"},"victim":{"pos":{"x":1967.9163818359375,"y":175.4272918701172,"z":196.3261260986328},"team":"T","name":"shox"},"amount":15,"weapon":"weapon_usp_silencer"},{"time":57.890625,"attacker":{"pos":{"x":1986.9085693359375,"y":237.31130981445312,"z":160.03125},"team":"T","name":"shox"},"victim":{"pos":{"x":2590.4619140625,"y":-130.273681640625,"z":84.03125},"team":"CT","name":"fer"},"amount":95,"weapon":"weapon_glock"},{"time":60.6875,"attacker":{"pos":{"x":2541.727294921875,"y":-81.61331939697266,"z":84.03125},"team":"CT","name":"fer"},"victim":{"pos":{"x":2033.9188232421875,"y":112.19583129882812,"z":180.52557373