Skip to content

Instantly share code, notes, and snippets.

View otac0n's full-sized avatar

John Gietzen otac0n

View GitHub Profile
@otac0n
otac0n / SplayTree`2.cs
Last active December 5, 2019 09:55
A splay tree in C# for .NET, fully implementing IDictionary<TKey, TValue>.
/* ---- MIT LICENSE ----
Copyright (c) 2011 John Gietzen
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@otac0n
otac0n / program.cs
Created July 12, 2011 00:38
Generated IE9 Test Fixture
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
namespace NegativeTests
{
class Program
@otac0n
otac0n / ArrayPointer.cs
Created July 19, 2011 14:35
An implementation of PHP and Unix's `crypt` function in C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Test
{
public struct ArrayPointer<T>
{
T[] array;
@otac0n
otac0n / FindConflictingReferences.cs
Created January 25, 2012 01:13 — forked from brianlow/FindConflictingReferences.cs
Find conflicting assembly references
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using NUnit.Framework;
namespace MyProject
{
[TestFixture]
<!DOCTYPE HTML>
<html>
<head>
<title>WebTurtle/Parser tests</title>
<meta charset="utf-8">
<script language="javascript" SRC="js/peg-0.7.0.js"></script>
<script language="peg" id="grammar">
start = wt program wt
program = front / back
front = 'μπροστά' wt integer
#!/bin/sh
git filter-branch --env-filter '
an="$GIT_AUTHOR_NAME"
am="$GIT_AUTHOR_EMAIL"
cn="$GIT_COMMITTER_NAME"
cm="$GIT_COMMITTER_EMAIL"
if [ "$GIT_COMMITTER_EMAIL" = "your@email.to.match" ]

Keybase proof

I hereby claim:

  • I am otac0n on github.
  • I am otac0n (https://keybase.io/otac0n) on keybase.
  • I have a public key whose fingerprint is 049F A0C3 7352 DB2C 3FAA 05B2 0246 FA2A C899 8685

To claim this, I am signing this object:

@otac0n
otac0n / app.js
Last active March 12, 2017 10:42
Bootstrap Modal for EmberJS
App = Ember.Application.create();
App.BootstrapModalView = Ember.View.extend({
classNames: ['modal', 'fade'],
layout: Ember.Handlebars.compile('<div class="modal-dialog"><div class="modal-content">{{yield}}</div></div>'),
didInsertElement: function () {
this._super();
Ember.run.scheduleOnce('afterRender', this, this.afterRenderEvent);
},
afterRenderEvent: function () {
@otac0n
otac0n / alias.sh
Last active June 19, 2023 02:31
My Git Aliases
git config --global alias.graph 'log --graph --oneline --author-date-order --full-history --all --decorate'
git config --global alias.reset-working '!git diff --no-color --staged | git apply --reverse'
git config --global alias.dirdiff 'difftool --dir-diff --no-symlinks --extcmd "C:/Program Files/Beyond Compare 4/bcomp.exe"'
@otac0n
otac0n / SecretStore.cs
Created July 22, 2015 21:08
Quick, secure secret storage for C# scripts.
public class SecretStore
{
private readonly string SecretsPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), typeof(SecretStore).FullName);
public bool Exists(Guid key)
{
return File.Exists(GetPath(key));
}