Skip to content

Instantly share code, notes, and snippets.

View warmwaffles's full-sized avatar
🛠️
Code Wrestling

Matthew Johnston warmwaffles

🛠️
Code Wrestling
View GitHub Profile
#ifndef _COMMON_H
#define _COMMON_H
#include <math.h>
#define square(v) ((v) * (v))
#define cube(v) ((v) * (v) * (v))
#define deg_to_rad(deg) ((deg) * (M_PI / 180.0))
#define rad_to_deg(rad) ((rad) * (180.0 / M_PI))
require 'pp'
class Model
def initialize(args={})
set(args)
end
def set(attributes={})
return if attributes.nil? || attributes.empty? || !attributes.is_a?(Hash)
attributes.each do |k, v|
@warmwaffles
warmwaffles / latency.markdown
Created December 9, 2015 06:36 — forked from hellerbarde/latency.markdown
Latency numbers every programmer should know

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs

Object Files (.obj)

Object files define the geometry and other properties for objects in Wavefront's Advanced Visualizer. Object files can also be used to transfer geometric data back and forth between the Advanced Visualizer and other applications.

Object files can be in ASCII format (.obj) or binary format (.mod). This appendix describes the ASCII format for object files. These files must have the extension .obj.

FROM nfnty/arch-mini
# This is a dockerfile meant for people who are trying to cross compile their C projects
# into windows binaries to ensure things actually compile correctly
RUN pacman -Syyu --noconfirm
RUN pacman -S --noconfirm git curl jshon expac yajl wget unzip cmake
RUN pacman -S --noconfirm --needed base-devel
RUN useradd -mg root travis
#pragma once
#include <stdlib.h>
#include <stdio.h>
#define MU_ANSI_BLACK "\033[0;30m"
#define MU_ANSI_RED "\033[0;31m"
#define MU_ANSI_GREEN "\033[0;32m"
#define MU_ANSI_YELLOW "\033[0;33m"
#define MU_ANSI_BLUE "\033[0;34m"
---
Language: Cpp
BasedOnStyle: Mozilla
IndentWidth: 4
AllowShortFunctionsOnASingleLine: None
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AlignAfterOpenBracket: Align
SpaceBeforeParens: ControlStatements
ColumnLimit: 100
class Hash
def pile(key, *args)
if args.count < 2
self[key] = args[0]
else
self[key] ||= {}
self[key].pile(args.shift, *args)
end
end
end
#include <stdlib.h>
#include <stdarg.h>
#include <assert.h>
#include <logger.h>
bool logger_init(logger_t* logger, FILE* fd)
{
assert(logger);
assert(fd);

Note: the constants BI_RGB, BI_RLE8, and BI_RLE4 have the values 0, 1, and 2, respectively.

Graphics File Formats

This topic describes the graphics-file formats used by the Microsoft Windows operating system. Graphics files include bitmap files, icon-resource files, and cursor-resource files.

Bitmap-File Formats