This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def hsv2rgb(h,s,v): | |
""" | |
0 <= h < 360 # Hue | |
0 <= s <= 255 # Saturation | |
0 <= v <= 255 # Value | |
Hue: position on the color wheel (0 is red) | |
Saturation: How much of the color is present | |
Value: How bright the resultant color is |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def hsv2rgb(h,s,v): | |
""" | |
0 <= h < 360 # Hue | |
0 <= s <= 255 # Saturation | |
0 <= v <= 255 # Value | |
Hue: position on the color wheel (0 is red) | |
Saturation: How much of the color is present | |
Value: How bright the resultant color is |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int char_is_int(char c) { | |
return c >= '0' && c <= '9'; | |
} | |
int char_to_int(char c) { | |
return c - '0'; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
char *fizz[3] = {"Fizz", "", ""}; | |
char *buzz[5] = {"Buzz", "", "", "", ""}; | |
void main(void) { | |
for (int i = 1; i <= 100; i++) | |
printf("%d\r%s%s\n", i, fizz[i%3], buzz[i%5]); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <avr/io.h> | |
#include <util/delay.h> | |
#include <avr/interrupt.h> | |
#include "lcd.h" | |
// Shift register pin info | |
#define SRCLK_PIN 2 | |
#define DATA_PIN 1 | |
#define RCLK_PIN 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
root@tiamat:~# ps faxo f,uid,pid,ppid,pri,ni,vsz,rss,wchan:20,stat,tty,time,comm | tee ps.log | |
F UID PID PPID PRI NI VSZ RSS WCHAN STAT TT TIME COMMAND | |
1 0 2 0 19 0 0 0 kthreadd S ? 00:00:00 kthreadd | |
1 0 3 2 19 0 0 0 smpboot_thread_fn S ? 00:00:02 \_ ksoftirqd/0 | |
1 0 5 2 39 -20 0 0 worker_thread S< ? 00:00:00 \_ kworker/0:0H | |
1 0 7 2 19 0 0 0 rcu_gp_kthread S ? 00:03:19 \_ rcu_sched | |
1 0 8 2 19 0 0 0 rcu_gp_kthread S ? 00:00:00 \_ rcu_bh | |
1 0 9 2 19 0 0 0 rcu_nocb_kthread S ? 00:02:00 \_ rcuos/0 | |
1 0 10 2 19 0 0 0 rcu_nocb_kthread S ? 00:00:00 \_ rcuob/0 | |
1 0 11 2 139 - 0 0 smpboot_thread_fn S ? 00:00:04 \_ migration/0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var a = [1, 2, 3, 4, 5]; | |
var b = function() { | |
if (null) { | |
var a = [1, 2, 3]; | |
} | |
console.log(a); | |
} | |
console.log(a); | |
b(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.get("/gamevil/privacy", function(req, res) { | |
if (cache.privacy && cache.privacy.timestamp > moment().unix() - 3600) { | |
res.end(cache.privacy.data); | |
} else { | |
cache.privacy = {"timestamp": moment().unix()}; | |
http.get("http://us.gamevil.com/news.php?m=policy", function(r) { | |
var page = ""; | |
r.on('data', function(chunk) { | |
page += chunk; | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var feed_url = "http://dragonfinsoup.com/wp/wordpress/?json_route=/posts"; | |
var data; | |
var masterTemplate; | |
var fetchPosts = function(num, offset) { | |
if (!masterTemplate) { | |
masterTemplate = $('.blogEntry').first().clone(); | |
} | |
if (!data) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function preload(urls, callback) { | |
console.log("Setting up preload"); | |
// Container for the actual images | |
var images = []; | |
// List of images already loaded | |
var loaded = {}; | |
// Initialize loaded array to all false |