Skip to content

Instantly share code, notes, and snippets.

View jaytaph's full-sized avatar
:shipit:
Calculating pi

Joshua Thijssen jaytaph

:shipit:
Calculating pi
View GitHub Profile
@jaytaph
jaytaph / gameengine.txt
Last active August 29, 2015 13:56
game framework
How do we create a game?
Could it be (simply) javascript like system? In such a way that we can interact with a game engine where we add our stuff?
something like (don't mind the horrible JS code) :
game = new Game.Game("my game name", {
boxed_game : true
playing_field : [ 51.5, -0.9, 51.6, -0.6 ],
import io;
class foo {
public method bar() {
try {
io.print("try\n");
return "1";
} catch (exception e) {
io.print("exception\n");
@jaytaph
jaytaph / sf2create.sh
Created January 20, 2014 17:56
Simple script that automatically creates and initializes a correct sf2 project for me.
#!/bin/sh
php composer.phar create-project symfony/framework-standard-edition $1
cd $1
ln -s web public
sed -i public/app_dev.php -e '/header/s|^|//|' -e '/exit/s|^|//|'
sudo setfacl -R -m u:www-data:rwX -m u:jthijssen:rwX app/cache app/logs
#define MAXLED 3
int ledPins[MAXLED][3] = {
{2,3,4},
{5,6,7},
{8,9,10},
};
typedef struct _rgb {
class string {
public method pad(numerical width, numerical direction = PAD_RIGHT); // PAD_LEFT, PAD_RIGHT, PAD_BOTH
public method utf8(); // shortcut to convert("utf-8");
public method utf16(); // shortcut to convert("utf-16");
public method bytes(); // Return some kind of bytestream?
public method convert(string charset); // Convert to different charset
public method byte_length(); // Returns number of BYTES in this string (which can be more than actual characters)
public method char_length(); // shortcut to length();
/** gcc -g -O0 -fno-inline -o test test.c `pkg-config --libs --cflags icu-uc icu-io` */
// We will be using UTF8
#define U_CHARSET_IS_UTF8 1
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "unicode/uchar.h"
#include "unicode/ucnv.h"
filter:
paths: [lib/*]
excluded_paths: [vendor/*, tests/*]
before_commands:
- 'composer install --dev --prefer-source'
tools:
external_code_coverage: true
php_mess_detector: true
php_code_sniffer: true
sensiolabs_security_checker: true
@jaytaph
jaytaph / gist:7517596
Created November 17, 2013 20:02
telehash xfer app
All application packets are marked with the "_xfer" type.
Returning a listing of all files from a particular node:
Request:
{
type : '_xfer',
_ : {
request : 'list'
// 7. Create sig
// This is why we can't have nice things
if (! defined('OPENSSL_ALGO_SHA256')) define('OPENSSL_ALGO_SHA256', 7);
// // sign & encrypt the sig
// var md = forge.md.sha256.create();
// md.update(body.bytes());
// var sig = id.private.sign(md);
openssl_sign($body, $sig, $my_priv_key, OPENSSL_ALGO_SHA256);
// 6. Encrypt inner packet
$blob = $inner_packet->encode();
$cipher = new \Crypt_AES(CRYPT_AES_MODE_CTR);
$cipher->setIv($iv);
$cipher->setKey($hash);
$body = $cipher->encrypt($blob);