Skip to content

Instantly share code, notes, and snippets.

View shanecelis's full-sized avatar

Shane Celis shanecelis

View GitHub Profile
@shanecelis
shanecelis / StackBag.cs
Created March 20, 2019 16:02
A heterogeneously typed stack that preserves O(1) for Push<T>(T o) and Pop<T>() and maintains order for Push(object o) and Pop().
/* Original code Copyright (c) 2019 Shane Celis[1]
Licensed under the MIT License[2]
Original code posted here[3].
This comment generated by code-cite[4].
[1]: https://github.com/shanecelis
[2]: https://opensource.org/licenses/MIT
[3]: https://github.com/shanecelis/push-forth-dotnet/
@shanecelis
shanecelis / SecretSanta.cs
Last active December 3, 2020 07:40
Solves a SecretSanta constraint problem using CatSAT; works in Unity because I'm lazy.
/* Original code Copyright (c) 2018 Shane Celis[1]
Licensed under the MIT License[2]
Original code posted here[3].
This comment generated by code-cite[4].
[1]: https://twitter.com/shanecelis
[2]: https://opensource.org/licenses/MIT
[3]: https://gist.github.com/shanecelis/b88808f5198832dd5f3dd2015017f0ec
@shanecelis
shanecelis / toothless-ransomware.txt
Created October 28, 2018 19:26
Toothless ransomware I got with the subject line: "$email password is $password"
Below is a scary spam message I got. Luckily, I use an email forwarding service,
so I knew it was for a comically old account. However, the password was accurate
at the time. The email states that they have my password and have compromised
not only it but my computer as well and that they have a Black Mirror-esque
image of me that they will release unless I pay a Bitcoin ransom. It is
bullshit, but it still made my heart race to read it.
I'm posting this here so that others can search and find it. These people have a
list of emails and passwords and are trying to somehow scare you into giving
them money. It's a different kind of ransomware, but this one has no teeth. It
@shanecelis
shanecelis / ReservoirSampler.cs
Created October 26, 2018 03:49
Keep a fixed-size sample of some stream of inputs. Each item has a uniform probability of being kept.
/* Original code Copyright (c) 2018 Shane Celis[1]
Licensed under the MIT License[2]
[1]: https://twitter.com/shanecelis
[2]: https://opensource.org/licenses/MIT
*/
using System;
using System.Collections.Generic;
/**
@shanecelis
shanecelis / lucerna-relay.cpp
Created September 21, 2018 18:54
A Magic Maker example project
/*
Copyright (c) 2018 Seawisp Hunter, LLC
Licensed under the MIT license.
*/
/*
Lucerna Relay
A Magic Maker[1] example project
/* Original code Copyright (c) 2018 Shane Celis[1]
Licensed under the MIT License[2]
Original code posted here[3].
This comment generated by code-cite[4].
[1]: https://github.com/shanecelis
[2]: https://opensource.org/licenses/MIT
[3]: https://gist.github.com/shanecelis/976f901fab5eebd3d68b479181999f01
// https://twitter.com/shanecelis/status/1024022967532101633
Shader "Custom/Lit Flat Height Field" {
Properties {
_Color ("Color", Color) = (1,1,1,1)
_MainTex ("Albedo (RGB)", 2D) = "white" {}
_HeightField ("Height Field", 2D) = "black" {}
_Glossiness ("Smoothness", Range(0,1)) = 0.5
_Metallic ("Metallic", Range(0,1)) = 0.0
}
SubShader {

Estimating the Coefficient of Drag for Real-Time Applications

@shanecelis
shanecelis / FrequencyOrPeriod.cs
Last active April 25, 2018 23:34
Adds a frequency or period custom drawer to Unity. Because I can never remember which one I've used.
/*
Adds a frequency or period custom drawer to Unity because I can never
remember which one I've used. See here for a quick demonstration:
https://twitter.com/shanecelis/status/989234269020180480
Its licensed under the MIT License.
* * *
Copyright 2018 Shane Celis
@shanecelis
shanecelis / twitter-mov-to-mp4
Created January 19, 2018 21:54
Convert a movie, typically recorded by QuickTime Player, into something Twitter will accept.
#!/bin/bash
# twitter-mov-to-mp4
#
# Convert a movie, typically recorded by QuickTime Player, into something Twitter will accept.
#
# e.g. $ twitter-mov-to-mp4 screencapture.{mov,mp4}
if [ $# -ne 2 ]; then
echo "usage: $0 <in.mov> <out.mp4>" >&2;
exit 2;