This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class IntervalSquelch | |
# Accepts an `interval` in fractional seconds and a `max_runs` as an integer. | |
# Will ensure that `go` calls its block no more than `max_runs` times per | |
# `interval`. | |
# | |
# By default, `max_runs` is 1. | |
def initialize(interval, max_runs = 1) | |
@max_runs = max_runs.to_i | |
@interval = interval.to_f |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sw17ch: today i'm trying to figure out quaternions and if they are different from a normal vector and a rotation around that normal... | |
[3:53pm] jcaudle_ is now known as jcaudle. | |
[3:53pm] oliffia: ive made maybe a dozen games before, none particularly big | |
[3:53pm] oliffia: or good :) | |
[3:53pm] vanila: sw17ch, I know a nice way to think about them with analogy to normal complex numbers if you like | |
[3:54pm] sw17ch: vanila: i think part of my problem is the complex numbers | |
[3:54pm] sw17ch: euler angles seem to work well for me | |
[3:54pm] sw17ch: and i'm trying to figure out the advantage in quaternions | |
[3:54pm] sw17ch: or why complex numbers come into play | |
[3:54pm] vanila: the main advantage of quaternions is that they don't suffer from gimbal lock, which the axis-angle approach does |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define _POSIX_C_SOURCE 199309L | |
#include <stdlib.h> | |
#include <stdio.h> | |
#include <stdbool.h> | |
#include <stdint.h> | |
#include <time.h> | |
#include <signal.h> | |
#define GTCHECK(EXP) \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
CORE="cauterize-core" | |
OTHER="cauterize cauterize-test caut-c11-synchronous caut-hs2010-synchronous" | |
REPOS="$CORE $OTHER" | |
PREFIX="git@gitlab.com:cauterize/" | |
POSTFIX=".git" | |
mkdir -p cauterize-env/sandbox |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdint.h> | |
#include <stdbool.h> | |
static const uint32_t SIGN_MASK = 0x80000000; | |
static const uint32_t EXP_MASK = 0x7f800000; | |
static const uint32_t FRA_MASK = 0x007fffff; | |
int main(int argc, char * argv[]) { | |
if (argc < 2) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* http://en.wikipedia.org/wiki/Single_precision_floating-point_format | |
*/ | |
#include <stdio.h> | |
#include <stdint.h> | |
#include <stdbool.h> | |
static const uint32_t SIGN_MASK = 0x80000000; | |
static const uint32_t EXP_MASK = 0x7f800000; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::io::net::ip::SocketAddr; | |
use std::io::net::tcp::{TcpListener, TcpStream}; | |
use std::io::{IoResult, Acceptor, Listener}; | |
fn main() { | |
let addr = from_str::<SocketAddr>("127.0.0.1:7123").unwrap(); | |
match TcpListener::bind(addr) { | |
Err(e) => fail!("Unable to bind to {}: {}", addr, e), | |
Ok(l) => listen(l), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sequences :: [a] -> [[a]] | |
sequences ls = ls' ++ [i ++ [a] | i <- sequences ls, a <- ls] | |
where | |
ls' = map (:[]) ls | |
main :: IO () | |
main = do | |
let syms = ["a","e","i","o","u","y"] | |
mapM_ (print . concat) (sequences syms) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- | For reference, see http://en.wikipedia.org/wiki/MU_puzzle. | |
module Main where | |
import Control.Monad ((>=>)) | |
import Data.Maybe (mapMaybe) | |
-- | The base language primitives. | |
data MuVal = U | I | M deriving (Show, Eq) | |
-- | Names for the MU rules. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
loop do | |
puts (" " * (rand() * 80).floor) + "(╯°□°)╯︵ ┻━┻" | |
end |