Skip to content

Instantly share code, notes, and snippets.

int potPin = A5; // select the input pin for the potentiometer
int ledPin = 13; // select the pin for the LED
int val = 0; // variable to store the value coming from the sensor
// from https://bildr.org/2012/08/rotary-encoder-arduino/
int orange = 4;
int green = 2;
volatile int lastEncoded = 0;
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@shanecandoit
shanecandoit / coursera-python-machine-learning-module-1-knn.ipynb
Created January 17, 2020 19:19
coursera-python-machine-learning-module-1-knn
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
free -m | awk '{if (NR==2) {print $3" / "$2" = "$3/$2}}'
# 61 / 483 = 0.126294
from PyPDF2 import PdfFileWriter, PdfFileReader
# https://stackoverflow.com/questions/490195/split-a-multi-page-pdf-file-into-multiple-pdf-files-with-python#490203
def pdf_split(fname, start, end=None):
print('pdf_split', fname, start, end)
# pdf_split ~/Downloads/4-27-files/Invoice Email-0.pdf 1 4
#inputpdf = PdfFileReader(open("document.pdf", "rb"))
inputpdf = PdfFileReader(open(fname, "rb"))
@shanecandoit
shanecandoit / gist:6c3009fa374e15aba9d330a08db16f53
Created July 31, 2021 04:04
icecream-parlor: Given a list of prices for the flavors of ice cream, select the two that will cost all of the money they have.
import java.util.*;
class Scratch {
public static void main(String[] args) {
// https://www.hackerrank.com/challenges/icecream-parlor/problem
// solved!
// Given a list of prices for the flavors of ice cream,
// select the two that will cost all of the money they have.
int m;
@shanecandoit
shanecandoit / ast_to_json.ipynb
Created October 1, 2022 03:59
read some python code, turn it into an ast, into json, then ...
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title></title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="">