Skip to content

Instantly share code, notes, and snippets.

View lfzawacki's full-sized avatar
💭
Millennials just wanna have 🥑s

Lucas lfzawacki

💭
Millennials just wanna have 🥑s
View GitHub Profile
@lfzawacki
lfzawacki / gist:1252580
Created September 30, 2011 03:37
Send ASCII Sketch
void setup()
{
Serial.begin(9600);
pinMode(13, INPUT);
}
void loop()
{
if (digitalRead(13) == HIGH)
@lfzawacki
lfzawacki / zombie.py
Created November 28, 2011 00:54
OSC wrapper for zombie GUI
// OscWrapper.ck
public class OscWrapper
{
OscEvent e;
int data;
string url;
fun void create(OscRecv recv, string s)
{
@lfzawacki
lfzawacki / gist:1553625
Created January 3, 2012 05:18
Algorithmic Symphonies
class Symph
{
Step s;
fun void connect(UGen u) { s => u; }
fun void next(int sa) { (sa & 0xff) / 128. - 1. => s.next; }
}
Symph s;
s.connect(dac);
@lfzawacki
lfzawacki / mic.py
Created February 11, 2012 08:14
Coding Dojo Garoa/Matehackers Campus Party
def lugar_vazio(bathroom):
pmetade=bathroom[:len(bathroom)/2]
smetade=bathroom[len(bathroom)/2:]
if bathroom[0]==0:
return 0
elif bathroom[-1]==0:
return len(bathroom)-1
elif bathroom[(len(bathroom)-1)/2]==0:
return (len(bathroom)-1)/2
else:
@lfzawacki
lfzawacki / 1.patch
Created July 13, 2012 19:21
force feedback
From bd9e9c08082419828098ee7b327448725d1455ca Mon Sep 17 00:00:00 2001
From: Lucas Zawacki <lfzawacki@gmail.com>
Date: Wed, 11 Jul 2012 14:24:04 -0300
Subject: joy.cpl: Correct joystick testing thread behavior (try 2)
The problem with the original behavior is that it starts a new thread each time the test tab is switched to, but
only stopped them on PSN_RESET. Now when the window receives PSN_KILLACTIVE (cancel button, X button or tab switch) or
PSN_RESET (ok button), the thread will rightfully die.
---
@lfzawacki
lfzawacki / gist:3442507
Created August 23, 2012 21:58
joystick names
From d035e950c47861a94215a2508ef5f27247b89c0e Mon Sep 17 00:00:00 2001
From: Lucas Zawacki <lfzawacki@gmail.com>
Date: Mon, 18 Jun 2012 14:48:50 -0300
Subject: [PATCH] dinput: Append driver name to dinput joysticks on Linux
---
dlls/dinput/joystick_linux.c | 7 ++++++-
dlls/dinput/joystick_linuxinput.c | 15 ++++++++++-----
2 files changed, 16 insertions(+), 6 deletions(-)
@lfzawacki
lfzawacki / gist:4149836
Created November 26, 2012 18:40
buzzer with notes
// Buzzer example function for the CEM-1203 buzzer (Sparkfun's part #COM-07950).
// by Rob Faludi
// http://www.faludi.com
// Matehacked by Lucas and Jerônimo
int noteToFreq(int note)
{
return (int) pow(2, (double)note/12) * 440;
}
@lfzawacki
lfzawacki / gist:4199092
Created December 3, 2012 23:37
PHP STUFF
<?php
$sql0 = mysql_query("SELECT DISTINCT nomecliente FROM andamento ORDER BY nomecliente") or die ("Erro: ".mysql_error());
$list_options = "";
while ($aux0 = mysql_fetch_array($sql0)) {
$nome = $aux0["nomecliente"];
/* Cria uma string com as options de todos clientes, coloca um depois do outro */
$list_options .= "<option value='$nome'>$nome</option>\n";
/* Fica tipo
<option value='lucas'>lucas</option>
@lfzawacki
lfzawacki / get_thumbs.rb
Created December 21, 2012 01:08
Ever needed to get all thumbnails for a youtube video?
#!/usr/bin/ruby
require 'open-uri'
def classy_exit
puts "I need a youtube video URL"
exit 0
end
def get_video_id url
@lfzawacki
lfzawacki / remove.rb
Created August 13, 2013 17:54
remove accents ruby
def self.remove_accents(str)
accents = {
['á','à','â','ä','ã'] => 'a',
['Ã','Ä','Â','À'] => 'A',
['é','è','ê','ë'] => 'e',
['Ë','É','È','Ê'] => 'E',
['í','ì','î','ï'] => 'i',
['Î','Ì'] => 'I',
['ó','ò','ô','ö','õ'] => 'o',
['Õ','Ö','Ô','Ò','Ó'] => 'O',