Skip to content

Instantly share code, notes, and snippets.

View bostelk's full-sized avatar
🍜

Kyle Bostelmann bostelk

🍜
View GitHub Profile
@bostelk
bostelk / accel.bat
Created March 20, 2022 21:41
Accelerate Path Of Exile Bundles
@echo off
rem A script to relocate bundles to a faster drive.
rem Put this file in Path of Exile "Bundles2" directory.
rem Example: I:\steam\steamapps\common\Path of Exile\Bundles2
rem The directory to relocate bundles to.
set BUNDLES2="C:\Path Of Exile\Bundles2"
rem Accelerate login.
@bostelk
bostelk / update_twitter_icon.py
Last active January 2, 2020 23:13
Selects a random image to use as a twitter icon
import twitter
import glob
import fnmatch
import random
import os
TWITTER_ICON_GLOB = '*.png'
BLACKLIST_FILENAME = 'blacklist.txt'
CONSUMER_KEY=''
@bostelk
bostelk / permutation.c
Last active July 30, 2019 11:39
permutations in lexicographic order
#include <stdio.h>
#include <stdlib.h>
int numbers[4] = { 1, 2, 3, 4};
int asc (const void * a, const void * b)
{
if ( *(int*)a < *(int*)b ) return -1;
if ( *(int*)a == *(int*)b ) return 0;
if ( *(int*)a > *(int*)b ) return 1;
@bostelk
bostelk / solve.pl
Last active January 27, 2019 16:40
Solution to @TechSparx's special math challenge!
is_prime(X) :-
findall(
Y,
(between(1,X,Y), divisible(X,Y)),
F),
(F=[1,X];F=[X,1]).
divisible(X,Y) :-
0 is X rem Y.
def N_i_k(k):
if k == 1:
return "float N_i_"+str(k)+"(in float t, in float i) { return step(i,t) * step(t,i+1.); }"
else:
return "float N_i_"+str(k)+"(in float t, in float i) { return (t - i)/"+str(k-1)+".*N_i_"+str(k-1)+"(t, i) + (i + "+str(k)+".0 - t)/"+str(k-1)+".0*N_i_"+str(k-1)+"(t, i + 1.); }"
def bspline(order, num_count_points):
code = ""
for n in range(0,order):
code += N_i_k(n+1) + "\n"
#define TAU 6.28318530718
#define DEG2RAD 0.0174532925199433
vec3 hsv2rgb(vec3 c) {
c = vec3(c.x, clamp(c.yz, 0.0, 1.0));
vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);
return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);
}
vec4 cross(vec4 U, vec4 V, vec4 W)
{
@bostelk
bostelk / unity_product_version_count.bq
Last active February 6, 2017 16:47
Use BigQuery to find the Unity editor versions in use.
SELECT
line AS version,
COUNT(*) AS count
FROM
FLATTEN( (
SELECT
SPLIT(REGEXP_EXTRACT(content, r'm_EditorVersion: (.+)'), '\n') AS line,
FROM (
SELECT
id,