Instantly share code, notes, and snippets.

View inbox_flight_scraping.md

Google Inbox Flight Scraper

First, go here: https://inbox.google.com/u/0/trips

Keep scrolling to the bottom until no more trips load.

Then open the developer console and paste the code below. Leave it alone for a few minutes. Once it's done scraping your flights, click the link it prints to the end of the console. This will take you to gcmap.com, which will then ask you to disambiguate the city names (e.g. "Washington DC")

View Example.java
class Node {
private int value;
private Node next;
public Node(int value) {
this.value = value;
next = null;
}
public int getValue() {
View pascal
(define (pascal row col)
(cond ((< row 2) 1)
((= col 0) 1)
((= row col) 1)
(else (+ (pascal (- row 1) col)
(pascal (- row 1) (- col 1))))))
(define (pascal-row row)
(define (pascal->string row col)
(number->string (pascal row col)))
View Product.py
class Product:
name = "Product Name"
description = "Product Description"
price = 0
def __init__(self, name, description):
self.name = name
self.description = description
def setPrice(self, price):
View counter.js
/* Real-Time PNG-Streaming HTTP User Counter
Copyright Drew Gottlieb, 2012
Free for any use, but don't claim
that this is your work.
Doesn't work on Windows because
node-canvas only works on Linux and OSX. */
var moment = require('moment');
View sketch.ino
const int pin_data = 2;
const int pin_clock = 3;
const int pin_latch = 4;
byte cylon = 0b10000000;
boolean right = true;
void output(byte data) {
digitalWrite(pin_latch, LOW);
shiftOut(pin_data, pin_clock, MSBFIRST, data);
View drew_grades.cpp
#include <iostream>
using namespace std;
const int ENDGRADE = 999;
int main() {
cout << "This program accepts user-entered grades and calculates the average." << endl;
double grade_entered = 0;
double grade_total;