virtualenv VIRTUALENV_NAME
cd VIRTUALENV_NAME
source bin/activate
pip install django ipython
// Example testing sketch for various DHT humidity/temperature sensors | |
// Written by ladyada, public domain | |
#include "DHT.h" | |
#define DHTPIN 2 // what pin we're connected to | |
#define DHTPIN2 3 // what pin we're connected to | |
// Uncomment whatever type you're using! | |
#define DHTTYPE DHT11 // DHT 11 |
from livereload.task import Task | |
def delay(): | |
import time | |
time.sleep(10) # 10s | |
Task.add('*', delay) |
## Quick Bash ## | |
function absolute_path { echo "$PWD/$1"; } | |
alias ap="absolute_path" | |
alias edbash='vim $HOME/.bash_aliases' | |
alias upbash='source $HOME/.bashrc' | |
## apache ## | |
alias apr='sudo apachectl graceful' | |
alias apc='sudo apachectl' |
def Integer(obj): | |
if obj["min"] < obj["value"] < obj["max"]: | |
return True | |
else: | |
raise ValueError("value out of range") | |
min_tile_size = {"type": Integer, | |
"min": 10, | |
"max": 20, | |
"value": 15, |
#! /bin/bash | |
# Sass: http://sass-lang.com/ | |
# Sass is a "smart" form of css, supporting nested targeting of html, variables and logic | |
# scss is a variant of sass using a syntax much closer to css | |
# Compass: http://compass-style.org/ | |
# Compass is a sass framework containing a range of shortcuts for cross-browser css effects. | |
# rounded corners, transparency... |
function control_zone() { | |
this.var_a = 'a'; | |
this.var_b = 'b'; | |
this.var_c = 'c'; | |
this.do_stuff = function() { | |
// do stuff with variables | |
console.log('var_a: '+this.var_a); | |
console.log('var_b: '+this.var_b); | |
console.log('var_c: '+this.var_c); |
#!/bin/bash | |
# install linux headers | |
wget https://raw.github.com/gkaindl/beaglebone-ubuntu-scripts/master/bb-get-rcn-kernel-source.sh | |
chmod +x bb-get-rcn-kernel-source.sh | |
sudo ./bb-get-rcn-kernel-source.sh | |
# download backports drivers | |
wget https://www.kernel.org/pub/linux/kernel/projects/backports/stable/v3.16/backports-3.16-1.tar.gz | |
tar xvfz backports-3.16-1.tar.gz |
# solution to entry problem 1 | |
def multiply(a, b): | |
return a * b | |
# solution to entry problem 2 | |
class Person: | |
def __init__(self, name): | |
self.name = name | |
# https://www.codewars.com/kata/convert-string-to-camel-case/train/python | |
def to_camel_case(text): | |
text_list = text.replace('-', '_').split('_') | |
answer_list = [text_list[0], ] | |
for word in text_list[1:]: | |
answer_list.append( word.title() ) | |
return ''.join(answer_list) | |