Skip to content

Instantly share code, notes, and snippets.

# standard imports
import logging
# 3rd party imports
import requests
logging.basicConfig(
level=logging.INFO,
format='%(asctime)s.%(msecs)03d %(message)s',
datefmt='%Y-%m-%d %H:%M:%S',
(steam:4318): GLib-GObject-WARNING **: /build/glib2.0-3vWc1h/glib2.0-2.42.1/./gobject/gsignal.c:3101: signal id '26' is invalid for instance '0xeb7a97a0'
Installing breakpad exception handler for appid(steam)/version(1473210378)
Generating new string page texture 2: 48x256, total string texture memory is 49.15 KB
Generating new string page texture 3: 256x256, total string texture memory is 311.30 KB
Installing breakpad exception handler for appid(steam)/version(1473210378)
Installing breakpad exception handler for appid(steam)/version(1473210378)
roaming config store loaded successfully - 844 bytes.
migrating temporary roaming config store
Installing breakpad exception handler for appid(steam)/version(1473210378)
Failed to init SteamVR because it isn't installed
@zzggbb
zzggbb / car.c
Last active August 29, 2015 14:20
#pragma config(Motor, port2, throw, tmotorServoContinuousRotation, openLoop)
#pragma config(Motor, port7, rmotor, tmotorServoContinuousRotation, openLoop)
#pragma config(Motor, port9, lmotor, tmotorServoContinuousRotation, openLoop)
#define MAX_SENS 5
#define THROW_SPEED -127
int speed_axis = 0, steer_axis = 0;
int bound(int n) {
return (n > 127 ? 127 : (n < -127 ? -127 : n));
#pragma config(Sensor, dgtl2, b0, sensorTouch)
#pragma config(Sensor, dgtl3, b1, sensorTouch)
#pragma config(Sensor, dgtl4, b2, sensorTouch)
#pragma config(Sensor, dgtl6, led0, sensorLEDtoVCC)
#pragma config(Sensor, dgtl7, led1, sensorLEDtoVCC)
#pragma config(Sensor, dgtl8, led2, sensorLEDtoVCC)
#pragma config(Sensor, dgtl10, shaft, sensorQuadEncoder)
#pragma config(Motor, port2, power, tmotorServoContinuousRotation, openLoop)
#define DEBUG false
struct t_node {
struct t_node *next;
int value;
} t_node;
struct t_list {
t_node *head;
t_node *tail;
int size;
} t_list;
#pragma config(Sensor, dgtl2, l1, sensorTouch)
#pragma config(Sensor, dgtl3, l2, sensorTouch)
#pragma config(Sensor, dgtl4, l3, sensorTouch)
#pragma config(Sensor, dgtl5, shaft, sensorQuadEncoder)
#pragma config(Motor, port2, power, tmotorServoContinuousRotation, openLoop)
#define motor_speed 15
#define f1 0
#define f2 500
#define f3 1000
/*
CREDITS:
DS3231 library: https://github.com/rodan/ds3231
RTC+LCD code: https://www.youtube.com/watch?v=NDwSrgfsiYQ
DHT11 code: http://playground.arduino.cc/main/DHT11Lib
WiFi to Thingspeak: http://www.instructables.com/id/ESP8266-Wifi-Temperature-Logger/step3/Arduino-Setup-and-Sketch/
*/
//Celsius to Fahrenheit conversion
double Fahrenheit(double celsius)
#!/bin/env python
from sys import argv, exit, stdin
argv[1:] or exit('no mode specified')
mode = argv[1]
apps = {
'minecraft':'/bin/minecraft',
function create_dir(dir) {
return
$('<li>').append(
$('<span>').attr('id','dir').text(dir.name).click(util.toggle_dir)
).append(
$('<ul>').append(
dir.files.map(util.create_file).concat(dir.dirs.map(create_dir))
)
)
}
function create_file(file) {
return $('<li>').append($('<span>').attr('id','file').text(file));
}
function create_dir(dir) {
return $('<li>')
.append($('<span>').attr('id','dir').text(dir.name).click(function(){$(this).next().slideToggle()}))
.append($('<ul>')
.append(
dir.files.length > 0 ? dir.files.map(create_file) : null