Skip to content

Instantly share code, notes, and snippets.

@lpereira
lpereira / gist:3267085
Created August 5, 2012 20:47
Pinball Display Driver
/*
* Pinball Display Driver
* Arudino version by Leandro Pereira
*
* Based on code by Daniel Quadros, available at
* http://dqsoft.blogspot.com.br/2011/06/projeto-epoch-parte4-software-cont.html
*/
#define DISP_S0 8
#define DISP_S1 9
@lpereira
lpereira / Chamada de Participação para a Tosconf[1]
Created March 6, 2013 19:16
Chamada de Participação para a Tosconf[1]
┌───┬───┬───┬───┬───┬───┬───┐
└─┐ │ │ ─┤ │ │ │ ─┤
│ │ │ ├─ │ ─┤ │ │ │ │ ┌─┘
└─┴───┴───┴───┴───┴─┴─┴─┘
2013-06-01 LHC, Campinas - São Paulo
A Tosconf é uma desconferência anual organizada pelo Laboratório
Hacker de Campinas (LHC). Em sua primeira edição, em 2012, atraiu
desenvolvedores, pesquisadores de segurança da informação e
figuras míticas da computação.
@lpereira
lpereira / arduino-7seg.cc
Created October 20, 2013 02:18
Arduino 7-segment display driver
namespace {
const char segment_pin[7] = {
[0] = 0,
[1] = 0,
[2] = 0,
[3] = 0,
[4] = 0,
[5] = 0,
[6] = 0,
@lpereira
lpereira / gist:8466423
Created January 17, 2014 00:46
Epoch LHC
/*
* Pinball Display Driver
* Arudino version by Leandro Pereira
*
* Based on code by Daniel Quadros, available at
* http://dqsoft.blogspot.com.br/2011/06/projeto-epoch-parte4-software-cont.html
*/
/*
* Com o ethernet shield, alguns dos pinos usados aqui nao funcionam pq o shield
@lpereira
lpereira / gist:6694015
Last active January 26, 2016 23:11
How to use sequences with lwan template
#include <assert.h>
#include <sys/types.h>
#include <dirent.h>
#include "lwan-status.h"
#include "lwan-template.h"
#include "strbuf.h"
struct file_list {
const char *path;
/*
package main
import "fmt"
func main() {
fmt.Println("counting");
for i := 0; i < 10; i++ {
import socket
import time
import random
import pygame
import pygame.camera
import pygame.transform
from pygame.locals import *
UDP_IP = "192.168.50.50"
UDP_PORT = 2711
@lpereira
lpereira / tpl-array.c
Created November 3, 2016 02:18
Lwan template with arrays
#include <lwan.h>
#include <lwan-template.h>
#include <strbuf.h>
struct thing {
lwan_tpl_list_generator_t generator;
const char *name;
};
@lpereira
lpereira / bbshield.go
Last active December 18, 2016 20:03
Buildbot shield generator
/*
* Buildbot 0.9.x shield generator
* Copyright (c) 2016 Leandro Pereira <leandro@tia.mat.br>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in the
* Software without restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
* and to permit persons to whom the Software is furnished to do so, subject to the
* following conditions:
% sudo cpupower frequency-set -g performance ~/git/benchmark/build
Setting cpu: 0
Setting cpu: 1
Setting cpu: 2
Setting cpu: 3
% ./test ~/git/simdswitch
Run on (4 X 2746.51 MHz CPU s)
2017-01-06 08:06:24
Benchmark Time CPU Iterations