Skip to content

Instantly share code, notes, and snippets.

View dag10's full-sized avatar

Drew Gottlieb dag10

View GitHub Profile
#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;
@dag10
dag10 / sketch.ino
Created April 19, 2014 00:31
Cylon Eye 595
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);
@dag10
dag10 / counter.js
Created May 15, 2014 20:53
A node.js program for serving a multipart x-mixed-replace image displaying the user count.
/* 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');
@dag10
dag10 / Product.py
Last active August 29, 2015 14:08 — forked from blackcorvidae/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):
@dag10
dag10 / pascal
Created December 31, 2014 04:07
(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)))
class Node {
private int value;
private Node next;
public Node(int value) {
this.value = value;
next = null;
}
public int getValue() {
@dag10
dag10 / inbox_flight_scraping.md
Last active November 20, 2017 09:28
A script with instructions for scraping your flight history from Google Inbox and mapping them.

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")

@dag10
dag10 / index.html
Created May 22, 2020 02:39
Mongoose maximum connections demonstration
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>MG Connection Test</title>
<style>
body {
@dag10
dag10 / showvideocontrols.js
Created November 6, 2023 00:38
Bookmarklet to show video controls on a web page
//bookmarklet_title: Show Video Controls
//bookmarklet_about: Drew Gottlieb
document.querySelectorAll('video').forEach(video => video.controls = true);
new MutationObserver(mutations => {
mutations.forEach(mutation => {
mutation.addedNodes.forEach(node => {
if (node.tagName === 'VIDEO') node.controls = true;
});