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 <sys/types.h> | |
#include <sys/stat.h> | |
#include <sys/ioctl.h> | |
#include <unistd.h> | |
#include <fcntl.h> | |
#include <errno.h> | |
#include <string.h> | |
#include <linux/input.h> |
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
import pygame | |
import pygame.freetype | |
import pygame.gfxdraw | |
quadrants = ( | |
(( 0, 0), (+1, -1), (+1, +1)), | |
(( 0, 0), (+1, +1), (-1, +1)), | |
(( 0, 0), (-1, +1), (-1, -1)), | |
(( 0, 0), (-1, -1), (+1, -1))) |
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 <stdint.h> | |
#include <x86intrin.h> | |
#include <stdio.h> | |
void printv(__m128 vec) | |
{ | |
float x[4]; |
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 <stdbool.h> | |
#include <stdio.h> | |
#include <X11/Xlib.h> | |
#include <GL/glx.h> | |
#include <GL/glxext.h> | |
#include <GL/gl.h> | |
GLXContext glXCreateContextAttribsARB( | |
Display *dpy, GLXFBConfig config, |
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
% vim:nolist lbr tw=78 expandtab | |
\documentclass[a4paper]{article} | |
\usepackage[utf8]{inputenc} | |
\usepackage[landscape,top=1cm,bottom=1cm,left=1cm,right=1cm]{geometry} | |
\usepackage[tiny]{titlesec} % smaller titles | |
\usepackage{multicol} | |
\usepackage{amsmath} | |
\pagestyle{empty} |
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
#version 420 | |
uniform mat4 projection_matrix; | |
uniform mat4 model_matrix; | |
void main() | |
{ | |
int tri = gl_VertexID / 3; | |
int idx = gl_VertexID % 3; | |
int face = tri / 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
def numerical(): | |
from scipy.integrate import odeint | |
from numpy import array | |
# [position, mass, velocity, mass flow] | |
def acceleration(y, t, v_exhaust=1.0): | |
return array([y[2], y[3], v_exhaust * y[3]/y[1], 0.0]) | |
initial_state = array([0.0, 2.0, 0.0, -1.0]) |
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
declare void @llvm.init.trampoline(i8*, i8*, i8*); | |
declare i8* @llvm.adjust.trampoline(i8*); | |
define i32 @foo(i32* nest %ptr, i32 %val) | |
{ | |
%x = load i32* %ptr | |
%sum = add i32 %x, %val | |
ret i32 %sum | |
} |
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
#if defined(__ARM_NEON__) | |
vec4 dot(vec4 a, vec4 b) | |
{ | |
vec4 prod = vmulq_f32(a, b); | |
vec4 sum1 = vaddq_f32(prod, vrev64q_f32(prod)); | |
vec4 sum2 = vaddq_f32(sum1, vcombine_f32(vget_high_f32(sum1), vget_low_f32(sum1))); | |
return sum2; | |
} | |
#else if defined(__SSE3__) | |
static inline vec4 vdot(vec4 x, vec4 y) |
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
module Main where | |
import Debug.Trace | |
import Control.Monad (forM_) | |
epsilon = 1.0e-10 :: Double | |
add (x1, y1, z1) (x2, y2, z2) = (x1+x2, y1+y2, z1+z2) | |
sub (x1, y1, z1) (x2, y2, z2) = (x1-x2, y1-y2, z1-z2) | |
mul (x1, y1, z1) (x2, y2, z2) = (x1*x2, y1*y2, z1*z2) |
NewerOlder