Skip to content

Instantly share code, notes, and snippets.

View andijcr's full-sized avatar

Andrea Barbadoro andijcr

  • Italy
View GitHub Profile
# chi sono
[contatti]
ciao sono andrea, lavoro qui a 2hire come sviluppatore embedded e smontacose.
Visto che chi non sa fare insegna, oggi voglio parlarvi di entity component system e perché penso sia veramente bello
e perché non l'ho mai usato
# survey
vedo un po' di facce conosciute.
quanti di voi sono programmatori puri?
quanti sono programmatori per necessità di videogioco?
@andijcr
andijcr / l.cpp
Created July 13, 2018 09:34
an implementation of heap memory and gc for lisp, as illustrated in SICP. minimal deps, the code is written with an hardware implementation in mind. some functions provided to construct lists and to trigger the gc.
#include <cstdint>
namespace l {
namespace memory{
enum class Type: uint8_t {nil=0, num, ptr, utf32, broken_heart, last };
const char* type_name[] {"nil", "num", "ptr", "utf32", "broken_heart", "last"};
using Val = uint32_t;
@andijcr
andijcr / TrimLinenAntbear.sc
Created January 20, 2018 14:22
TrimLinenAntbear created by andijcr - https://repl.it/@andijcr/TrimLinenAntbear
(define (v+ a b)
(vector-map + a b))
(define (v- a b)
(vector-map - a b))
(define (vmag a)
(sqrt (fold-left + 0 (vector->list (vector-map (lambda (a) (expt a 2)) a)))))
(define (dist a b)
lua:
local a = {}
local b = {}
local cose = {[a]='uno', [b]='due'} --> cose contiene due chiavi differenti
python:
@andijcr
andijcr / Benchmarker.ino
Created April 7, 2017 20:38
quick code to benchmark string ops
void setup() {
Serial.begin(115200);
while(!Serial);
}
template<int execTime>
class Counter{
struct CountGuard{
Counter* pt;
#include <SD.h>
#include<Wire.h>
/**
* Based on https://www.arduino.cc/en/Tutorial/Datalogger for SD card writing
* * SD card attached to SPI bus as follows:
* ** MOSI - pin 11
* ** MISO - pin 12
* ** CLK - pin 13
* ** CS - pin 10 (for MKRZero SD: SDCARD_SS_PIN)
@andijcr
andijcr / HashCode_MPI_solution.ipynb
Created March 9, 2017 09:32
a Mixed Integer Linear Programming approach to the hashcode2017 first round challenge
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@andijcr
andijcr / ThreadSafeChannel.cpp
Last active February 1, 2016 13:45
Test for a thread safe channel, in c++14
//
// Created by andrea on 15/09/15.
//
#include <mutex>
#include <deque>
#include <condition_variable>
using namespace std;
@andijcr
andijcr / tree.js
Created September 16, 2015 20:04
convert a tree representation as (H2,((H4,H5)H3,H6)H7)H1 in a object structure
Tree = function(lbl, lT, rT){
this.label=lbl
this.leftTree= lT
this.rightTree= rT
};
function isAlphaNumeric(char) {
var code
code = char.charCodeAt(0);
if (!(code > 47 && code < 58) && // numeric (0-9)