Skip to content

Instantly share code, notes, and snippets.

View retran's full-sized avatar
:octocat:

Andrew Vasilyev retran

:octocat:
View GitHub Profile
@retran
retran / Program.cs
Last active January 5, 2020 08:42
WM_PAINT reentrancy
using System;
using System.Diagnostics;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WutExample
{
static class Program
@retran
retran / dithering.p8
Created August 23, 2019 19:25
Simple dithering for PICO-8
pico-8 cartridge // http://www.pico-8.com
version 18
__lua__
-- simple 1-bit dithering by Andrew @retran Vasilyev
function _draw()
cls()
for x = 0, 128, 1 do
for y = 0, 128, 1 do
@retran
retran / fireworks.p8
Last active August 19, 2019 17:46
Fireworks for PICO-8
pico-8 cartridge // http://www.pico-8.com
version 18
__lua__
-- fireworks demo by andrew @retran vasilyev
max_particles_count = 1024
particles_by_explosion = 100
gravity = 0.05
explosion_treshold = max_particles_count / 3
@retran
retran / ThreadLocalExample.cs
Created May 21, 2019 16:25
ThreadLocal example
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
class Program
{
static void Main(string[] args)
{
Console.WriteLine("press to start");
@retran
retran / Program.cs
Created October 1, 2018 07:49
method hiding
using System;
namespace ConsoleApp1
{
class Foo
{
public void Do()
{
throw new InvalidOperationException();
}
using System;
using System.Threading.Tasks;
namespace MemoryReordering
{
class Program
{
private static int x;
private static int y;
@retran
retran / coroutines.cs
Created June 7, 2018 14:18
C# cooperative multitasking
using System;
using System.Collections.Generic;
public class Program
{
public static IEnumerable<bool> Coroutine1()
{
int i = 0;
while (i < 100)
{
@retran
retran / wtf.cs
Created May 16, 2018 08:09
works on 64-bit cpu but fails on 32-bit
using System;
using System.Threading.Tasks;
class MainClass {
public static void Main (string[] args)
{
for (int i = 0; i < 10000; i++)
{
long value = 0;
(ns brainfuck)
(defn build-jumpmap [source]
(let [points (for [x (range (count source))
:when (or (= \[ (nth source x)) (= \] (nth source x)))]
x)]
(loop [[first & coll] points
stack '()
map { }]
(if first
import java.util.ArrayList;
import java.util.List;
import java.util.Vector;
public class HashTable
{
private final int numberOfBuckets = 50;
private final Vector<List<HashTableNode>> buckets;
private class HashTableNode