Skip to content

Instantly share code, notes, and snippets.

/* Watchdog timer for DiscordSocketClient, until the cause of https://github.com/RogueException/Discord.Net/issues/883 is found
* If the client has been disconnected for 5 minutes -> Environment.FailFast()
* I use FailFast() instead of Exit() because at this stage I don't trust the process enough for it
* to shut down cleanly. This assumes there is some external program which will restart your bot
* if it crashes.
* Obviously the reconnect can fail simply because discord is still down, your server's network
* connection was lost etc.
*/
using System;
@raphaelr
raphaelr / gist:5cf958fd088dfec93cf8
Created June 25, 2014 17:50
Ghetto Ellipsoid builder
// Yes, ModelBuilder#createSphere can do that.
// But I wanted to give it a try too.
import com.badlogic.gdx.graphics.g3d.model.MeshPart;
import com.badlogic.gdx.graphics.g3d.utils.MeshPartBuilder;
import static com.badlogic.gdx.math.MathUtils.*;
import com.badlogic.gdx.math.Vector3;
import java.util.Vector;
@raphaelr
raphaelr / Kappa.hs
Last active December 11, 2015 03:38
module Kappa (kappa) where
kappa :: Int -> String
kappa 0 = ""
kappa 1 = "Kappa"
kappa n = kappa 1 ++ ' ':(kappa $ pred n)
@raphaelr
raphaelr / gist:3407174
Created August 20, 2012 19:48
This is not the greatest program in the world, this is just a tribute
using System;
using System.Dynamic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
namespace Calypso {
class Program {
static void Main()
{
@raphaelr
raphaelr / .emscripten
Created May 2, 2012 17:58
.emscripten
# This file will be copied to ~/.emscripten if that file doesn't exist. Or, this is that copy.
# IMPORTANT: Edit the *copy* with the right paths!
EMSCRIPTEN_ROOT = os.path.expanduser('~/devel/emscripten') # this helps projects using emscripten find it
LLVM_ROOT = os.path.expanduser('~/devel/llvm/build/Debug/bin')
# See below for notes on which JS engine(s) you need
NODE_JS = 'node'
SPIDERMONKEY_ENGINE = [os.path.expanduser('~/Dev/mozilla-central/js/src/js'), '-m', '-n']
@raphaelr
raphaelr / ammo-stuck-in-floor.html
Created April 24, 2012 17:08
Ammo.js - getting stuck in floor
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
</head>
<body>
<p>Check the console.</p>
<p><button id="left">Left</button> <button id="up">Up</button> <button id="right">Right</button></p>
<script src="https://github.com/kripken/ammo.js/raw/master/builds/ammo.js"></script>
@raphaelr
raphaelr / body-in-floor.cpp
Created April 24, 2012 16:58
Body getting stuck in floor
// Enter these commands, followed by <Return>, to control the player:
// "l" - Left
// "r" - Right
// "u" - Up
#include <btBulletDynamicsCommon.h>
#include <stdio.h>
#include <time.h>
#include <boost/timer/timer.hpp>
#include <boost/thread.hpp>