Skip to content

Instantly share code, notes, and snippets.

View famanson's full-sized avatar

Son Pham famanson

View GitHub Profile
@famanson
famanson / countdown
Last active December 19, 2015 22:39
Basic countdown app
#!/usr/bin/python
from optparse import OptionParser
import datetime
def countdown(deadline, event):
today = datetime.datetime.today()
remaining = deadline - today
days = remaining.days
@famanson
famanson / gist:11286737
Created April 25, 2014 11:44
HTML example snippet
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" type="image/png" href="./favicon.ico">
@famanson
famanson / multi_servo.ino
Last active August 29, 2015 14:05
Arduino GMail Notification
#include <Servo.h>
int led = 13, override = HIGH;
int OVERRIDE_PIN = 2;
const int SERVO_COUNT = 2;
Servo servoArray[SERVO_COUNT];
int servoPins[SERVO_COUNT] = {9,10};
int servoStates[SERVO_COUNT] = {270,10};
void blink(int duration, int repeat) {
pcm.usb
{
type hw
card Device
}
pcm.internal
{
type hw
card ALSA
import re
test_name = 'development-db-1481955f2b3'
pattern = r"(development-)?(db|es|web|imgrszr|geo)(\d+|-[a-z0-9]+)"
m = re.match(pattern, test_name)
type = m.group(1)
curl -F "pub_ks3-eu-west-1.amazonaws.com/esplorio-images/dc2aff42c13beed3732470e0d1d06c84c805c54f_550x550_rauto.jpg" "https://upload.uploadcare.com/from_url/" -v
// include the library code:
#include <Wire.h>
#include <Adafruit_MCP23017.h>
#include <Adafruit_RGBLCDShield.h>
Adafruit_RGBLCDShield lcd = Adafruit_RGBLCDShield();
// These #defines make it easy to set the backlight color
#define RED 0x1
#define YELLOW 0x3
Environment:
Request Method: GET
Request URL: http://localhost:8000/trips/1bjxps0rm6mqp/
Django Version: 1.6.8
Python Version: 2.7.6
Installed Applications:
('django.contrib.auth',
@famanson
famanson / esplorio_icon.ino
Last active August 29, 2015 14:14
Prototype Mobile Allegiance Identification System
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define OLED_DC 11
#define OLED_CS 13
#define OLED_CLK 10
#define OLED_MOSI 9
#define OLED_RESET 12
Adafruit_SSD1306 display(OLED_MOSI, OLED_CLK, OLED_DC, OLED_RESET, OLED_CS);
Environment:
Request Method: GET
Request URL: http://localhost:8000/diary/json/
Django Version: 1.6.8
Python Version: 2.7.6
Installed Applications:
('opbeat.contrib.django',