Skip to content

Instantly share code, notes, and snippets.

View ReaperUnreal's full-sized avatar

Guillaume Couture-Levesque ReaperUnreal

View GitHub Profile
@ReaperUnreal
ReaperUnreal / c121intermediate.txt
Created March 6, 2013 21:05
The answer for the reddit daily programmer challenge 121 intermediate written in system 390 assembly. Note: will only run when malloc can pass.
.section .text,"ax","progbits"
.file "foo.c"
.section .text
.align 4
.globl foo
.type foo,@function
foo:
@ReaperUnreal
ReaperUnreal / gist:5094380
Last active December 14, 2015 13:38
DailyProgrammer Challenge 121 Dynamic Programming solution in S390 assembly
.section .text
.align 4
.globl foo
.type foo,@function
foo:
.foo:
STG GPR14,112(,GPR15)
STMG GPR7,GPR11,56(GPR15)
@ReaperUnreal
ReaperUnreal / main.cpp
Created November 7, 2012 18:13
Mandelbrot code
void doFractal(float xpos, float ypos, float zoom = 1.0f)
{
//doing Mandelbrot
Mandelbrot m(maxIter, escape);
const float scale = 1.0f / zoom;
const float floatWidth = 3.5f * scale; //zoom = 1 should be -2.5 to 1 in X
const float floatHeight = floatWidth * static_cast<float>(height) / static_cast<float>(width);
const float minX = xpos - (floatWidth * 0.5f);
const float minY = ypos - (floatHeight * 0.5f);
@ReaperUnreal
ReaperUnreal / qr.cpp
Created October 26, 2012 20:49
QR Decomposition of 3x3 Matrix Using Householder Reflections
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
void printMatrix3x3(float *mat)
{
printf("%0.3f\t%0.3f\t%0.3f\n", mat[0], mat[1], mat[2]);
printf("%0.3f\t%0.3f\t%0.3f\n", mat[3], mat[4], mat[5]);
printf("%0.3f\t%0.3f\t%0.3f\n", mat[6], mat[7], mat[8]);
printf("\n");
@ReaperUnreal
ReaperUnreal / gist:3907218
Created October 17, 2012 18:30
fizzbuzz++
void fizzbuzz(int n)
{
static bool firstRun = true;
if(firstRun)
{
std::sort(table);
firstRun = false;
}
char buffer[MAX_CHAR];
buffer[0] = '\0';
@ReaperUnreal
ReaperUnreal / gist:3885276
Created October 13, 2012 16:37
Compromised Tweet
HTTP/1.1 200 OK
X-Transaction:
a09713e0086a75d9
X-RateLimit-Remaining:
19997
Content-Length:
1807
X-RateLimit-Limit:
20000
int mask = (1 << __popcnt(v)) - 1;
return (~n) & mask;
var obj = {
val: 0,
double: function() {
function helper() {
this.val += this.val; //this refers to global scope
}
helper();
}
};
@ReaperUnreal
ReaperUnreal / gist:2116799
Created March 19, 2012 15:46
Bunch of hash functions
unsigned int djb2(const char *text, int len)
{
unsigned int hash = 5381;
int c;
while(c = *text++)
hash = ((hash << 5) + hash) + c;
return hash;
}
@ReaperUnreal
ReaperUnreal / gist:1602418
Created January 12, 2012 19:04
Palli Interview Rough Translation
What happened that you started to play with you jojo?
In elementary school I started to spend with me jojo I had
been give n and then I went online and saw videos of people
do disgusting fl Ott tricks. I wanted to immediately learn that trick
so I ordered me a good jojo online and started training me
in full. After two years I was a good single on it and then
way has been upward.
What do you have to be able with jojo?
You have to have ngrafi fi mi and so this is all muscle memory.
Patience is also important because some tricks are very annoying