Skip to content

Instantly share code, notes, and snippets.

View l3kn's full-sized avatar

Leon l3kn

View GitHub Profile
@l3kn
l3kn / CDArdulamp
Created September 10, 2012 20:00
One button Arduino rgb controller
int redPin = 10;
int greenPin = 11;
int bluePin = 9;
int buttonPin = 8;
int colorPins[] = {0, 10, 11, 9};
float colorVals[] = {125,255,255,255}; //aktuelle Farbwerte
float colorValsOrig[] = {125,255,255,255}; //Originalwerte(Warmweiß)
int colorDirs[] = {-2,-3,-3,-3};
@l3kn
l3kn / avr_fade_1.c
Created October 5, 2012 19:21
Simple .c LED-Fader
#include<avr/io.h>
#include<util/delay.h>
void sleep(uint8_t millisec)
{
while(millisec)
{
_delay_ms(1);/* 1 ms delay */
millisec--;
@l3kn
l3kn / l3cube_text.c
Created October 14, 2012 22:23
l3cube 4*4 Test
#include <avr/io.h>
#include <avr/interrupt.h>
#include <util/delay.h>
#define LED_CONFIG (DDRD |= (1<<1))
#define CPU_PRESCALE(n) (CLKPR = 0x80, CLKPR = (n))
#define DIT 80 /* unit time for morse code */
#define FPS 2;
@l3kn
l3kn / gist:3893299
Created October 15, 2012 16:02
Addition to l3cube
#include <avr/io.h>
#include <avr/interrupt.h>
#include <util/delay.h>
#define CPU_PRESCALE(n) (CLKPR = 0x80, CLKPR = (n))
#define FPS 1;
volatile int frame = 0;
uint8_t cube[4][4];
require 'rubygems'
require 'csv'
class Value
attr_accessor :name, :min , :max
def initialize(name, min = 0, max = 0)
@name = name
@min = min
@max = max
@l3kn
l3kn / humanize_seconds.rb
Created August 7, 2013 14:46
Convert seconds to human readable string
def humanize(seconds)
units = [[60, 'sec'],[60, 'min'],[24, 'hour'],[365, 'day']]
time = []
units.each do |count, name|
if seconds > 0
seconds, rest = seconds.divmod(count)
time << "#{rest}#{name}#{rest > 1 ?'s':''}"
end
end
// Array with default value
int foo[1337] = {0};
#!/usr/bin/env ruby
require 'commander/import'
require 'nopoint/version'
require 'nopoint'
program :name, 'nopoint'
program :version, Nopoint::VERSION
program :description, 'Slideshow generator'
// Sass
#Menu-button
display: none
&:checked ~ #Menu-wrapper
display: block
#Menu-label
display: block
text-align: center
font-size: 1.5em
@l3kn
l3kn / hass1.hs
Last active December 25, 2015 07:59
module Main where
import Text.ParserCombinators.Parsec
data ListItem = List ListItem [ListItem]
| Value String
| Property String String
unwordsList :: [ListItem] -> String
unwordsList = unwords . map showVal