Skip to content

Instantly share code, notes, and snippets.

View amites's full-sized avatar

Alvin Mites amites

View GitHub Profile
@amites
amites / setup_TP-WN722NC.sh
Last active September 5, 2015 05:49
Bash script to setup a TL-WN722NC as an available wifi dongle onto a bbb.
#!/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
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);
@amites
amites / centos_install_compass.sh
Last active December 3, 2017 22:39
bash script to install sass/compass onto centos
#! /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...
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,
@amites
amites / .bash_aliases
Created January 28, 2014 07:07
My standard ubuntu server bash aliases, most are also good on a workstation.
## 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'
from livereload.task import Task
def delay():
import time
time.sleep(10) # 10s
Task.add('*', delay)
@amites
amites / webclient_dht.ino
Created February 3, 2013 03:16
For an Arduino -- pulls sensor data from 2 DHT11's and uploads to a remote server using a GET call over an ethernet shield requires libraries from Adafruit for the DHT & EtherCard
// 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
@amites
amites / DHTtester1.ino
Last active December 10, 2015 00:49
Combined 2 example scripts with a bit of scripting to publish sensor data from 2 DHT11 sensors to a remote web-server using a GET request webClient_dht -- doesn't work with error code in comments below webClient -- works to post to web-server using a GET request DHTtester1 -- works to read sensor data and concatenate floats to a string and retur…
// 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
@amites
amites / center_geo.py
Last active October 15, 2021 23:14
Center Geolocations
from math import cos, sin, atan2, sqrt
def center_geolocation(geolocations):
"""
Provide a relatively accurate center lat, lon returned as a list pair, given
a list of list pairs.
ex: in: geolocations = ((lat1,lon1), (lat2,lon2),)
out: (center_lat, center_lon)
"""
x = 0
@amites
amites / gimp-to-css.py
Created September 12, 2012 08:39
Convert Gimp Palette to SCSS vars
# coding: utf-8
import re
## quick hack to convert gimp color palettes into scss vars
## ended up getting rather complex when I started making it more dynamic
## may clean up in the future as proper functions with command line option
## title will be written as title_basetitle_sub[loop#]
## allows customization of title that could be extended into a config