Skip to content

Instantly share code, notes, and snippets.

Coding up a storm

Peter Flickinger peterfoxflick

Coding up a storm
View GitHub Profile
peterfoxflick / contentView.swift
Last active Nov 6, 2020
Progress view updated by threads in SwiftUI
View contentView.swift
import SwiftUI
struct ContentView: View {
@State var total = 0
@State var progress = 0
@State private var workItem: DispatchWorkItem?
var body: some View {
peterfoxflick / socailDist.ino
Last active Apr 19, 2020
ATTINY Social Distancing
View socailDist.ino
* Original Ultrasonic code by Rui Santos,
* Modified by Peter Fox Flick for attiny,
Ultrasonic sensor Pins:
Trig : Trigger (INPUT) - Pin 0
Echo: Echo (OUTPUT) - Pin 1
var key = "xxxxx"; // for trello
var token = "xxxxx"; // for trello
function main() {
//First get all homework assignments
var homework = UrlFetchApp.fetch('');
homework = JSON.parse(homework);
//Now create cards for each one
View Control.rb
require 'benchmark'
%x(rm output.csv)
file ='output.csv', 'a')
10000.times{ |i|
file ='output.csv', 'a')
peterfoxflick / removeFiles.js
Created May 16, 2019
If you need a simple way to remove files from a cluttered folder in canvas this should help do the trick. It only works in chunks of 100. Run with node.js
View removeFiles.js
var Request = require("request");
const folderID = "XXXX"
const access_token = "XXXXXXXXXX"
//Get all the files in a given folder ID and remove them.
function delete100(){
var url = "" + folderID + "/files?access_token=" + access_token + "&per_page=100"
peterfoxflick /
Created Feb 26, 2019
Hidden Row Data: A simple Google Add-on that shows the meta data you save to a row in Google Sheets.
function onOpen() {
var ui = SpreadsheetApp.getUi();
ui.createMenu('Hidden Row Data')
.addItem('Show Data', 'showSidebar')
function showSidebar() {
var html = HtmlService.createTemplateFromFile('sidebar');
peterfoxflick / CountingUp.rb
Last active Oct 11, 2018
This is for a school project on testing if you can count with the sqrt(2) and (2 + sqrt(2)).
View CountingUp.rb
require 'twitter'
twitter = do |config|
config.consumer_key = "YOUR_CONSUMER_KEY"
config.consumer_secret = "YOUR_CONSUMER_SECRET"
config.access_token = "YOUR_ACCESS_TOKEN"
config.access_token_secret = "YOUR_ACCESS_SECRET"
def getA(n)
peterfoxflick / AttinyFlowerPot.ino
Created Aug 11, 2018
The code for a flower pot that has a built-in sensor to detects when the soil is dry and lets you know. The circuit uses an ATtiny85 as the brain and copper tape as the sensor.
View AttinyFlowerPot.ino
ATtiny Indoor Plant
This program flashes a blue light when there is dry dirt.
Pin OUT (only pins that are shown are used)
--[[()]]-- 5V
A3 --[[[]]]--
peterfoxflick / AttinyDarkDetector.ino
Created Aug 11, 2018
This little project makes an ATtiny tell you when it is dark or bright. This project is an excellent introduction to the capabilities of the ATtiny85 chip.
View AttinyDarkDetector.ino
ATtiny Dark Detector
This program turns on a green light when it is bright.
and a red light when it is dark.
Pin OUT (only shows pins used)
--[[()]]-- 5V
--[[[]]]-- A1
peterfoxflick / Change All Sheets
Created Jul 18, 2018
This script take a list of sheets by ID and will iterate through each one. I found this helpful when needing to apply changes to a large number of sheets. If you set it up to run every hour or fifteen minutes it can change as many as you need. If the script times out, it will begin where it left off the next time it runs.
View Change All Sheets
function changeAll() {
//Insert the id of the sheet that contains all the spreadsheets by id
var msheet = SpreadsheetApp.openById('---').getSheetByName("Sheet Ids");
var mdata = msheet.getRange('C:C').getValues();
//m-varname is the master data
var startd = new Date();
var diff = 0;
//Start keeps track of what row you are on incase the script times out.
You can’t perform that action at this time.