Skip to content

Instantly share code, notes, and snippets.

-- Old table with types that are too big
create table forecast_base_0 (
key_id bigint not null,
time timestamp without timezone not null,
value double precision,
primary key (key_id, time)
);
-- New table with smaller types
create table forecast_base_1 (
@ejrh
ejrh / bm.c
Created January 9, 2016 12:31
// Inspired by https://www.reddit.com/r/programming/comments/400wpy/andrei_alexandrescus_amazing_150_minutes_course/
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <sys/resource.h>
#include <sys/times.h>
#include <time.h>
#define NUM_POWERS 19
build: " git 2016-01-03 00:51"
mods:
- xcom1
time:
year: 1999
minute: 6
weekday: 5
month: 1
hour: 16
day: 21
Uint32 MESSAGE_EVENT = SDL_RegisterEvents(1);
/* In a thread dealing with network stuff */
while () {
shared_ptr<Message> message = read_message_from_network();
SDL_Event evt;
evt.type = MESSAGE_EVENT;
evt.user.data1 = // what?
@ejrh
ejrh / colour_key_conversion_test.cpp
Last active August 29, 2015 14:20
Test case for a potention SDL2 bug when converting surfaces with colour keys
// TO COMPILE: gcc -o test colour_key_conversion_test.c -lSDL2
// AND RUN: ./test
#include <stdio.h>
#include <SDL2/SDL.h>
// smiley face image with transparency
unsigned short pixel_data[] = {
0xB54A, 0xB54A, 0xB54A, 0xB54A, 0xB54A,
EC10FC27 // mov 10000,$r12
E402F400 // mov 2,$r4
364C // slt $r4,$r12,$r6
D602 // br $r6,L6
C01D // jmp main$exit
E102F100 // mov 2,$r1
3714 // slt $r1,$r4,$r7
D70B // br $r7,L10
1341 // sub $r4,$r1,$r3
D304 // br $r3,L21
main::
mov 10000, $r12
mov 2, $r4
L26:
slt $r4, $r12, $r6
br $r6, L6
L5:
jmp main$exit
L6:
mov 2, $r1
//#include <stdio.h>
void main() {
int max;
max = 10000;
int candidate;
candidate = 2;
while (candidate < max) {
@ejrh
ejrh / font.txt
Last active August 29, 2015 14:11
__
| __ |__| __|
|__ |__| | | |__|
__ __
|__ |__| | |
| | | | |__ |
__ __
| |__| | |
step(0, []).
step(1,[1]).
step(2,[2]).
step(3,[3]).
step(N,[H|T]) :-
N > 0,
member(H, [1,2,3]),
Remaining is N - H,
Remaining > 0,