Skip to content

Instantly share code, notes, and snippets.

View octaflop's full-sized avatar

Faris Chebib octaflop

View GitHub Profile
# encoding: utf-8
import pytz
import datetime
from django.utils import timezone
"""
campus is a django model
for these examples:
campus.tz = 'America/Denver'
@octaflop
octaflop / light_show.ino
Created May 21, 2014 02:57
light show!
/*
Arduino colour mood setter
*/
int const rled = 11;
int const gled = 10;
int const bled = 9;
int const rrgb = 7;
int const grgb = 5;
int const brgb = 6;
@octaflop
octaflop / polyphonic_piano.ino
Created May 19, 2014 18:06
arduino polyphonic piano
/*
Arduino Polyphonic Piano
Faris Chebib, 2014
*/
int notes[] = {245, 262, 294, 330, 349};
int timer = 100; // play for this duration
int sound_pin = 12;
int const potPin = A0;
#!/bin/bash
# from fixubuntu.com, in case the site is taken down
GS="/usr/bin/gsettings"
CCUL="com.canonical.Unity.lenses"
# Figure out the version of Ubuntu that you're running
V=`/usr/bin/lsb_release -rs`
# The privacy problems started with 12.10, so earlier versions should do nothing
if awk "BEGIN {exit !($V < 12.10)}"; then
@octaflop
octaflop / app.py
Last active July 13, 2017 08:22 — forked from maccman/app.py
import os
from flask import Flask, render_template, request
import stripe
stripe_keys = {
'secret_key': os.environ['SECRET_KEY'],
'publishable_key': os.environ['PUBLISHABLE_KEY']
}
stripe.api_key = stripe_keys['secret_key']
import unittest
from selenium import webdriver
# from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.common.keys import Keys
import time
import os
import re
import uuid
@octaflop
octaflop / fsModel.js
Created April 19, 2013 19:33
A basic jsondb controller
// fsModel.js
// a simple file i/o node.js model
var fs = require("fs");
var path = require("path");
var uuid = require("node-uuid");
var moment = require("moment");
var extend = require("node.extend");
var dbPath = "db/db.json";
var filePath = path.resolve(__dirname, dbPath);
// From octopress: https://github.com/imathis/octopress/blob/master/.themes/classic/source/_includes/asides/github.html
{% if site.github_user %}
<section>
<h1>GitHub Repos</h1>
<ul id="gh_repos">
<li class="loading">Status updating...</li>
</ul>
{% if site.github_show_profile_link %}
<a href="https://github.com/{{site.github_user}}">@{{site.github_user}}</a> on GitHub
{% endif %}
module.exports = { // Created with "sails generate Experience" → so the routes and controllers are auto-generated
attributes : {
organization: "STRING",
dateStarted: "DATE",
dateEnded: "DATE",
title: "STRING",
description: "STRING",
schoolOrWork: "STRING"
@octaflop
octaflop / blog.js
Last active December 14, 2015 02:49
working example of hand-written async on a redis server
exports.list = function(req, cb) {
client.get(MODELSET_ID + ":blog:entries", function(err, blogLen) {
if (err) { console.log(err); }
var retList = [];
function done (retBlog) {
console.log("pushing id: " + retBlog.metadata._id);
retList.push(retBlog);
blogLen--;
if (blogLen <= 0) { cb(retList); }