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 "FImage.hpp" | |
using namespace CR; | |
// Constructor | |
FImage::FImage() {}; | |
FImage::FImage(int w, int h) { | |
Constructor(w, 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
module drawtext(text) { | |
//Characters | |
chars = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}"; | |
//Chracter table defining 5x7 characters | |
//Adapted from: http://www.geocities.com/dinceraydin/djlcdsim/chartable.js | |
char_table = [ [ 0, 0, 0, 0, 0, 0, 0], | |
[ 4, 0, 4, 4, 4, 4, 4], | |
[ 0, 0, 0, 0,10,10,10], | |
[10,10,31,10,31,10,10], |
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 "DRand.hpp" | |
#define RAND48_SEED_0 (0x330e) | |
#define RAND48_SEED_1 (0xabcd) | |
#define RAND48_SEED_2 (0x1234) | |
#define RAND48_MULT_0 (0xe66d) | |
#define RAND48_MULT_1 (0xdeec) | |
#define RAND48_MULT_2 (0x0005) | |
#define RAND48_ADD (0x000b) |
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
len = 30; | |
%GRID = int8(rand(len,len)); | |
% Diehard | |
GRID = int8(zeros(len,len)); | |
GRID(10,10:11) = 1; | |
GRID(11,11) = 1; | |
GRID(11,15:17) = 1; | |
GRID(9,16) = 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 <cstdio> | |
// C-Quine | |
int main() { | |
char *s = "#include <cstdio>%c// C-Quine%cint main() {%c char *s = %c%s%c;%c printf(s, 0x0a, 0x0a, 0x0a, 0x22, s, 0x22, 0x0a, 0x0a, 0x0a);%c return 1;%c};"; | |
printf(s, 0x0a, 0x0a, 0x0a, 0x22, s, 0x22, 0x0a, 0x0a, 0x0a); | |
return 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 <cstdio> | |
#include <omp.h> | |
#include <cassert> | |
using namespace std; | |
constexpr int T_SIZE = 1e8; | |
// Bitwise operator based function to check multiple of 9 | |
bool isMulOf9(int n) { |
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
void glPrintString(void *font, const char *str) { | |
int len, i; | |
len = (int)strlen(str); | |
for (i = 0; i < len; i++) { | |
glutBitmapCharacter(font, str[i]); | |
} | |
} | |
void glPrintString(int x, int y, std::string str) { |
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
struct Pixel { | |
Colour val; | |
real_t cnt; | |
// Stats on Luminance | |
real_t mean, var, skew, kurtosis, m2, m3, m4; | |
inline void add(const Colour &col) { | |
val = val + ((col - val) / ++cnt); |
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 java.awt.Color; | |
import java.awt.Component; | |
import java.awt.Dimension; | |
import java.awt.Font; | |
import java.awt.Graphics; | |
import java.awt.Graphics2D; | |
import java.awt.RenderingHints; | |
import javax.swing.JList; | |
import javax.swing.JPanel; |
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
<?php | |
// Called after an insertion or update to the `posts` table | |
// Returns void | |
function writeScripts() { | |
$atom_date = getDateRFC(getD()); // Current Date 3339 for Atom feed | |
$site_date = getDateSite(getD()); // Current Date YYYY-MM-DD for Sitemap | |
// Beginning of Atom.xml | |
$atom_str = '<feed xml:lang="en-US" xmlns="http://www.w3.org/2005/Atom"> |
OlderNewer