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 / 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(-)
In a new Ubuntu Trusty lxc-container:
sudo lxc-create -t ubuntu -n bbb-html5 -- -r trusty
Install BBB090: https://code.google.com/p/bigbluebutton/wiki/090InstallationUbuntu
Install development stuff: https://code.google.com/p/bigbluebutton/wiki/090Developing
Install nodejs
@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 / links.md
Last active December 3, 2015 19:40
Links to Learn Ruby
@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 / title.rb
Created August 19, 2013 16:07
Get title from a lot of links
#/usr/bin/ruby
require 'open-uri'
require 'nokogiri'
links = IO.read('links.txt').split("\n")
links.each do |link|
f = open(link)
doc = Nokogiri::HTML(f)
@lfzawacki
lfzawacki / generate_test.rb
Created August 20, 2013 16:26
Read a Rails model file and print to stdout an rspec describe block for each method
def warn_and_exit
puts "Prints to stdout a describe block for each method in the model file."
puts "\tusage \"#{__FILE__}\" [MODEL_FILE]"
exit 0
end
warn_and_exit if ARGV.size != 1
content = IO.read(ARGV[0])