Skip to content

Instantly share code, notes, and snippets.

View nitrix's full-sized avatar

Alex Belanger nitrix

View GitHub Profile
/*
* This returns 0 under C99 and 1 under C89
* kate, Sun May 28 16:25:24 BST 2006
*/
int main(void) {
int a = 5, b = 0;
(void)(a //* */ b++
);
@nitrix
nitrix / cute.pgm
Created July 1, 2014 18:41
Cute PGM
P2
# CREATOR: GIMP PNM Filter Version 1.1
360 490
255
255
255
255
255
255
255
P2
# feep.pgm
24 7
15
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 3 3 3 3 0 0 7 7 7 7 0 0 11 11 11 11 0 0 15 15 15 15 0
0 3 0 0 0 0 0 7 0 0 0 0 0 11 0 0 0 0 0 15 0 0 15 0
0 3 3 3 0 0 0 7 7 7 0 0 0 11 11 11 0 0 0 15 15 15 15 0
0 3 0 0 0 0 0 7 0 0 0 0 0 11 0 0 0 0 0 15 0 0 0 0
0 3 0 0 0 0 0 7 7 7 7 0 0 11 11 11 11 0 0 15 0 0 0 0
<?php
$data ='O:8:"stdClass":3:{s:3:"aaa";a:5:{i:0;i:1;i:1;i:2;i:2;s:39:"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";i:3;i:4;i:4;i:5;}s:3:"aaa";i:1;s:3:"ccc";R:5;}';
$x = unserialize($data);
var_dump($x);
?>
@nitrix
nitrix / nn.php
Last active August 29, 2015 14:17
Generic Neural Network
<?php
/******************* CONFIG *******************/
$config_nn_layout = [2, 3, 2, 1];
$config_nn_step = 7;
/******************** MAIN ********************/
$neurons = nn_init_neurons($config_nn_layout);
$weights = nn_init_weights($config_nn_layout);
while (true) {
@nitrix
nitrix / gist:1bd49a09c4a6698dad64
Last active August 29, 2015 14:21
Interesting problem to simulate
##programming
SrPx | As a side question, if a company has an income, and it wants to compute the most it can of a problem in 10 years, is it better to buy computers as you income comes, or wait 9 years, buy faster computers and to do much more on the last year? Hmm. Not sure why I'm asking this here, that is a math question.
@nitrix
nitrix / quine.php
Created June 14, 2012 19:51
PHP challenge
<?php
$y = "function q(\$q) {
\$q = str_replace('\\\\', '\\\\\\\\', \$q);
\$q = str_replace('\$', '\\\\\$', \$q);
\$q = str_replace('\\n', '\\\\n', \$q);
\$q = str_replace('\"', '\\\\\"', \$q);
return \$q;
}
echo \"<?php\\n\";
@nitrix
nitrix / .gitignore
Created July 23, 2012 15:50
Triangles! A small experiment with HTML canvas
*.swp
*.swo
----------
! Xft settings
! ------------
Xft.dpi: 96
Xft.antialias: true
Xft.rgba: rgb
Xft.hinting: true
Xft.hintstyle: hintslight
nitrix at meow in ~/Projects/testga/build
$ cmake .. && make && ./testga
-- The C compiler identification is GNU 4.7.1
-- The CXX compiler identification is GNU 4.7.1
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works