Skip to content

Instantly share code, notes, and snippets.

@sidharthshah
sidharthshah / science-wikipedia-articles.txt
Created October 14, 2015 03:35
List of wikipedia Pages relating to Science category
environmental change
resistor ladder
effects of high altitude on humans
mendelian inheritance
pellucidar
ryōji noyori
aphthous stomatitis
holonomic brain theory
umbilicus (mollusc)
destroy all humans!
parser.add_argument('-v', '--verbose', action='count', default=0)
parser.add_argument('-q', '--quiet', action='count', default=0)
logging_level = logging.WARN + 10*args.quiet - 10*args.verbose
# script -vv -> DEBUG
# script -v -> INFO
# script -> WARNING
# script -q -> ERROR
# script -qq -> CRITICAL
@sidharthshah
sidharthshah / MinimalisticPomodoroTimer-V1.ino
Created October 31, 2013 15:27
Modified version from previous Sketch to consider changes for Initial Button State
//Vars relating to IO
int START_PIN = 10;
int DONE_PIN = 9;
int WIP_PIN = 8;
int BUZZER_PIN = 13;
int BUTTON_PIN = 2;
//Vars related to Button
int buttonState = HIGH;
int lastButtonState = HIGH;
@sidharthshah
sidharthshah / MinimalisticPomodoroTimer.ino
Created October 12, 2013 18:42
Minimalistic Timer for Pomodoro implemented on Arduino. Has very basic requirements of hardware 1. Piezo Buzzer 2. LED + Resistor set 3. Rest Button + 10K
//Vars relating to IO
int START_PIN = 10;
int DONE_PIN = 9;
int WIP_PIN = 8;
int BUZZER_PIN = 13;
int BUTTON_PIN = 2;
//Vars related to Button
int buttonState;
int lastButtonState = LOW;
import processing.serial.*;
int serialData = 0;
Serial GamePad;
int x = 100;
int y = 70;
void setup() {
size(200, 200);
@sidharthshah
sidharthshah / GameControllerSerial.ino
Created October 5, 2013 03:50
Simple sketch that allows to take input from four button and write data to serial, which is then read by Processing and displayed
int inPins[] = {2,3,4,5};
int totalInPins = 4;
const int DELAY_PERIOD = 70;
void setup() {
for(int i=0; i < totalInPins; i++){
pinMode(inPins[i], INPUT);
}
cd ../../frontend/
rm -rf dist
yeoman build
cd ../src/ratingui
rm -rf static/styles
rm -rf static/scripts
rm -rf templates/layout/rating.jinja
cp -vr ../../frontend/dist/styles static
cp -vr ../../frontend/dist/scripts static
cp ../../frontend/dist/index.html templates/layout/rating.jinja
@sidharthshah
sidharthshah / gist:3798088
Created September 28, 2012 05:30
Email Sending Snippet from Gearman
def email_story(worker,job):
email = json.loads(job.data)
if email.has_key("html"):
text_subtype = 'html'
else:
text_subtype = 'plain'
send_to = []
send_to = parse_emails(email['to'])
content="""\
@sidharthshah
sidharthshah / gist:3434268
Created August 23, 2012 08:30
Updating CouchDB's doc with additional field
>>> import couchdb
>>> couch = couchdb.Server()
>>> db = couch['catalog_users']
>>> doc = db['f893955fc22b7ff25fd5d3764a009354']
>>> doc
<Document 'f893955fc22b7ff25fd5d3764a009354'@'19-ea4b426d433b779ff9ed8267b989714e' {'home_zipcode': '', 'city': '', 'fb_user_id': '', 'zipcode': '', 'state': '', 'type': 'Publisher', 'email': 'iamsidd@gmail.com', 'media_url': '', 'status': 'active', 'bio': '', 'couchrest-type': 'Publisher', 'passwd': '97032c0a89cba64bd10f7d221c589f60', 'address1': '', 'address2': '', 'auth': '59b58778-eb69-11e0-9bea-1231390b25d1', 'dob': '', 'key': '59b58778-eb69-11e0-9bea-1231390b25d1', 'super_publisher_id': 'a36c91061da18c0c1ba1c3412409d8aa', 'created_ts': 1338361447, 'name': '', 'access_token': '', 'gender': '', 'publisher_revenue': 0.5, 'customer_type': 'storyteller', 'stories': ['273374'], 'updated_ts': 1338361470, 'published': True}>
>>> doc['internal_rating'] = 4
>>> db.save(doc)
('f893955fc22b7ff25fd5d3764a009354', '20-f5c36653f45f853570f3399793ea560f')
@sidharthshah
sidharthshah / gist:3433296
Created August 23, 2012 06:15
MailChimp integration via PyChimp
from postmonkey import PostMonkey
pm = PostMonkey('341a2fc9bc064c33a3481f905d22b069-us5')
#storytellers
pm.listSubscribe(id='d3bb445eae',email_address='iamsidd@gmail.com')
#basic_users
pm.listSubscribe(id='13cbfa7eb2',email_address='iamsidd@gmail.com')