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
from collections import OrderedDict as o_dict | |
from fpdf import FPDF | |
from fpdf.util import textstring | |
def create_dictionary_string(dict_): | |
"""format ordered dictionary as PDF dictionary""" | |
return ''.join([ | |
'<<', | |
'\n'.join([' '.join(f) for f in dict_.items()]), |
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
import RPi.GPIO as GPIO | |
import time | |
def createBoolList(size=8): | |
ret = [] | |
for i in range(8): | |
ret.append(False) | |
return ret |
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
# coding: utf-8 | |
# http://forums.fedoraforum.org/showthread.php?t=272322 | |
import os | |
import uuid | |
import fnmatch | |
import subprocess | |
CURRENT_DIR = os.path.dirname(__file__) | |
CFG_DIR = '/etc/NetworkManager/system-connections' |
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
from flask import Flask | |
from flask.ext.sqlalchemy import SQLAlchemy | |
from flask.ext import admin, wtf | |
from flask.ext.admin.contrib import sqlamodel | |
app = Flask(__name__) | |
app.config['SECRET_KEY'] = '123456790' | |
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///test.sqlite' | |
db = SQLAlchemy(app) |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Title</title> | |
</head> | |
<body> | |
<form method="post"> | |
{{ form.hidden_tag() }} | |
{{ form.example }} |
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
#!/usr/bin/env python | |
#-*- coding: utf-8 -*- | |
from sqlalchemy import create_engine, Column, Integer, String, func | |
from sqlalchemy.ext.declarative import declarative_base | |
from sqlalchemy.orm import sessionmaker | |
Base = declarative_base() | |
class StudentInfo(Base): |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head><script type="text/javascript">var NREUMQ=NREUMQ||[];NREUMQ.push(["mark","firstbyte",new Date().getTime()]);</script> | |
<link href='/static/bootstrap/css/bootstrap.css' rel='stylesheet' type='text/css' /> | |
<link href='/static/wysihtml5/bootstrap-wysihtml5.css' rel='stylesheet' type='text/css' /> | |
</head> | |
<body> | |
... | |
<script src="/static/wysihtml5/wysihtml5-0.3.0.min.js"></script> |
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
package no.nsb.ombord; | |
import java.net.DatagramPacket; | |
import java.net.DatagramSocket; | |
import java.net.InetAddress; | |
import java.net.SocketTimeoutException; | |
import java.net.UnknownHostException; | |
import org.apache.http.util.ExceptionUtils; |
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
# Jarvis March O(nh) - Tom Switzer <thomas.switzer@gmail.com> | |
TURN_LEFT, TURN_RIGHT, TURN_NONE = (1, -1, 0) | |
def turn(p, q, r): | |
"""Returns -1, 0, 1 if p,q,r forms a right, straight, or left turn.""" | |
return cmp((q[0] - p[0])*(r[1] - p[1]) - (r[0] - p[0])*(q[1] - p[1]), 0) | |
def _dist(p, q): | |
"""Returns the squared Euclidean distance between p and q.""" |