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 / make_h265.py
Last active August 23, 2022 18:37
Converts all video files to H265, deleting the sources as well.
import pathlib
import subprocess
import re
VIDEO_TYPES = [
'.mp4',
'.avi',
'.mkv',
'.mov',
'.webm',
import pygame
import random
class Node:
def __init__(self, x, y, air=0.0, wall=False):
self.x = x
self.y = y
self.air = air
self.wall = wall
@shoffing
shoffing / agent.py
Last active January 6, 2019 00:46
Bot to play codenames as an agent
import numpy as np
# Distance function
dist = lambda a, b: np.linalg.norm(a - b)
# Load word2vec data file (gl0ve)
w2v = {}
with open("glove/glove.6B.50d.txt", "r", encoding="utf-8") as w2v_file:
for word_enc in w2v_file:
word = word_enc[:word_enc.index(" ")]
const demofile = require('demofile');
const fs = require('fs');
const _ = require('lodash');
// Replace with your own demo files
const INFERNO_DEMOS = [
'/Users/shoffing/inferno-demos/astralis-vs-liquid-inferno.dem',
'/Users/shoffing/inferno-demos/fnatic-vs-complexity-inferno.dem',
'/Users/shoffing/inferno-demos/g2-vs-cloud9-inferno.dem',
'/Users/shoffing/inferno-demos/g2-vs-mibr-inferno.dem',
@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
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 / 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) );
};
@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);
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 / 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