Skip to content

Instantly share code, notes, and snippets.

using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Threading;
namespace LetterBloxBot {
class Program {
// WinAPI:
[DllImport("user32.dll")]
static extern void keybd_event(byte bVk, byte bScan, uint dwFlags, UIntPtr dwExtraInfo);
@lunasorcery
lunasorcery / dragon_curve.c
Created February 28, 2013 02:28
The Dragon Curve created using GBDK's 2D plotter APIs. I know it's not entirely optimal code.
// Dragon Curve for Gameboy, using GBDK
// By Will Kirkby 2013
//
// Ported from Eelke Schipper's http://www.khanacademy.org/cs/dragon-curve/1414142328
//
// Use the up and down buttons to
// increase or decrease the number of folds.
//
// (1 << n) is used in place of pow(2, n) for speed purposes.
static class ByteArrayExtensions
{
public static bool Contains(this byte[] src, byte query)
{
return src.IndexOf(query) >= 0;
}
public static bool Contains(this byte[] src, byte[] query)
{
return src.IndexOf(query) >= 0;
using System;
using System.IO;
using System.Text;
namespace FtlDat
{
class Program
{
static void Main(string[] args)
{
using System;
using System.CodeDom;
using System.CodeDom.Compiler;
using System.Collections.Generic;
using System.IO;
using System.Web.Script.Serialization;
namespace Json
{
public enum JsonObjectType
using System;
using System.Drawing;
using System.IO;
using System.Reflection;
namespace MipCreator
{
class Program
{
static void Main(string[] args)
using System;
using System.Diagnostics;
using System.IO;
using System.Text;
namespace SaboteurExtractor
{
class Program
{
static void Main(string[] args)
using System;
namespace FortyOneShades
{
class Program
{
static int[] values = new int[]{
0x276AD9,
0x3E6FD9,
0x3A6FDE,
using System;
using System.Diagnostics;
using System.Linq;
namespace LinqPerformance
{
class Program
{
static void Main(string[] args)
{
@lunasorcery
lunasorcery / crc_zeroing.cpp
Created September 7, 2015 16:31
A demonstration of how a custom-crafted CRC table can force a hash of zero.
#include <cstdint>
#include <cstdio>
#define MAX_DATA_SIZE 256
#define USE_MODIFIED_CRC_TAB 0
static uint32_t crc32_tab[] = {
#if !USE_MODIFIED_CRC_TAB
// this is the classic "default" CRC32 table.
0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3,