This file contains hidden or 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 <stdint.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include "emmintrin.h" | |
struct Color4 | |
{ | |
uint8_t red; | |
uint8_t green; |
This file contains hidden or 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
Color4 Lerp(Color4 a, Color4 b, float t) | |
{ | |
// nice branchless SIMD color lerp | |
__m128 one = _mm_set1_ps(1); | |
__m128 t4 = _mm_set1_ps(t); | |
t4 = _mm_max_ps(t4, _mm_setzero_ps()); | |
t4 = _mm_min_ps(t4, one); |
This file contains hidden or 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
using System.Text; | |
namespace Whatever | |
{ | |
public static class HexDumper | |
{ | |
public static string HexDump(byte[] data) | |
{ | |
var sb = new StringBuilder(); |
This file contains hidden or 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 <SPI.h> | |
#define CE_0 2 | |
#define CE_1 3 | |
#define CS_0 4 | |
#define CS_1 5 | |
#define IRQ_0 6 | |
#define IRQ_1 7 | |
#define PIN_SS 10 |
This file contains hidden or 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 <LiquidCrystal.h> | |
// Notes: | |
// - LCD has an on-board current limiting resistor for the LED backlight (510 ohm I think.) | |
// So it can be connected directly to +5V and GND. | |
// LCD backlight LED draws 34 mA. | |
// - The whole LCD only draws about 35-36 mA, so the backlight is the majority of the power. | |
// - The included contrast trim pot is 10K. | |
// - Line 1 wraps to line 3 and line 2 wraps to line 4, although LiquidCrystal::setCursor() works(!) | |
// So LCDWrite may require some adjustment... |
This file contains hidden or 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
using System; | |
using System.Collections.Generic; | |
using System.Text; | |
using System.IO; | |
using System.Linq; | |
using Microsoft.Xna.Framework.Content; | |
namespace Platformer | |
{ | |
/// <summary> |
This file contains hidden or 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
LUA: | |
-- prints "nil" | |
print(undefined_var) | |
AS3: | |
// doesn't even compile, gives you "Access of undefined property" compiler error. | |
trace(undefined_var); |
This file contains hidden or 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
import matplotlib.pyplot as plt | |
from scipy import stats | |
import numpy as np | |
# parse CSV file | |
# format is <size>, <recv_time>, <send_time> | |
# recv_time and send_time may be on different clocks so we can only compare vs. mean | |
lines =[] | |
for l in open('client_data/0.csv'): | |
parts = [float(x) for x in l.strip().split(',')] |
This file contains hidden or 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
""" | |
Usage: | |
(1) on host A: | |
python ploss.py recv <port> | |
(2) on host B: | |
python ploss.py send <A's hostname> <port from step 1> | |
(3) watch output on host B | |
""" |
This file contains hidden or 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/bash | |
# If this doesn't work, ensure you have UNIX line endings in this file | |
# (\n, not \r\n.) You can use Notepad++ to switch them. | |
# Cygwin package requirements: gcc-mingw, pkg-config | |
# If you want to pass -z to mkbundle: mingw-zlib1, mingw-zlib-devel | |
# crash immediately if anything bad happens | |
set -o errexit | |
set -o nounset |
NewerOlder