Skip to content

Instantly share code, notes, and snippets.

View peterfoxflick's full-sized avatar
🐧
Coding up a storm

Peter Flickinger peterfoxflick

🐧
Coding up a storm
View GitHub Profile
@peterfoxflick
peterfoxflick / header.html
Created June 9, 2018 20:16
Header in Html
<html>
<head>
<title>Header</title>
<style type="text/css">
body {margin:0;}
#header {
margin: 0;
padding: 0;
overflow: hidden;
@peterfoxflick
peterfoxflick / TrelloCount.md
Last active June 15, 2018 20:46
Trello Card Counter

Trello Count

This is program will do two things:

  1. Count the number of trello cards in each list on a board
  2. Add compleated courses to a spreadsheet in google This code is ran as a google script.
function countTrello() {
  // Trello api key found at: https://trello.com/app-key
  var key = '';
@peterfoxflick
peterfoxflick / Change All Sheets
Created July 18, 2018 16:24
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.
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.
@peterfoxflick
peterfoxflick / AttinyDarkDetector.ino
Created August 11, 2018 06:44
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.
/*
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
peterfoxflick / AttinyFlowerPot.ino
Created August 11, 2018 06:50
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.
/*
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
peterfoxflick / Google Form to Trello
Last active August 11, 2018 07:29
This code takes a google form and makes a Trello card on each submit. It then creates a copy of a google sheet and folder. These are then linked to the Trello card and are partial filled out.
/*****************************************************************
* This code create a trello card for every Google Form that is
* filled out with information given on the form. Each trello
* card is linked to a sheet that resides in its own folder.
* for a live example see: https://trello.com/b/CQXMpx0u/demo-trello-card-create
* Author: Peter Fox Flick
****************************************************************/
/*****************************************************************
@peterfoxflick
peterfoxflick / CountingUp.rb
Last active October 11, 2018 02:54
This is for a school project on testing if you can count with the sqrt(2) and (2 + sqrt(2)).
require 'twitter'
twitter = Twitter::REST::Client.new 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"
end
def getA(n)
@peterfoxflick
peterfoxflick / removeFiles.js
Created May 16, 2019 21:16
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
var Request = require("request");
const folderID = "XXXX"
const access_token = "XXXXXXXXXX"
delete100()
//Get all the files in a given folder ID and remove them.
function delete100(){
var url = "https://byui.instructure.com/api/v1/folders/" + folderID + "/files?access_token=" + access_token + "&per_page=100"
require 'benchmark'
%x(rm output.csv)
file = File.open('output.csv', 'a')
file.puts("N,DoWhile,ForEach,ForOf,ForLoop,While")
file.close
10000.times{ |i|
file = File.open('output.csv', 'a')
var key = "xxxxx"; // for trello
var token = "xxxxx"; // for trello
function main() {
//First get all homework assignments
var homework = UrlFetchApp.fetch('https://byui.instructure.com/api/v1/users/self/upcoming_events?access_token=xxxxxx');
homework = JSON.parse(homework);
//Now create cards for each one
homework.forEach(createCard);
}