Skip to content

Instantly share code, notes, and snippets.

View tomjuggler's full-sized avatar
💭
Juggling Code

Tom tomjuggler

💭
Juggling Code
View GitHub Profile
@tomjuggler
tomjuggler / unpack_inverted_index.py
Created January 7, 2022 06:59
function to unpack an inverted index with Python 3
import collections
def unpack_inverted_index(input):
all_dict = {}
for ind in input:
for i in range(len(input[ind])):
key = input[ind][i]
all_dict[key] = ind
sorted_dict = collections.OrderedDict(sorted(all_dict.items()))
// Most of this code is the hard work of Tom Hastings www.bigtop.co.za //
// other credits here! Many thanks to .....//
volatile unsigned long millisecs = 0;
unsigned long seconds = 0;
volatile int variable = 0;
#include <avr/io.h>
#include <avr/interrupt.h>
typedef unsigned char PROGMEM prog_uchar;
@tomjuggler
tomjuggler / Suncoast2016NYE.ino
Created December 14, 2020 11:45
Example 36px Smart Poi Nano version 1 - with millis() timer
// Most of this code is the hard work of Tom Hastings www.bigtop.co.za //
// other credits here! Many thanks to .....//
volatile unsigned long millisecs = 0;
unsigned long seconds = 0;
volatile int variable = 0;
#include <avr/io.h>
#include <avr/interrupt.h>
background
fish
fish
shark
shark
shark
ray
ray
chicken
chicken
@tomjuggler
tomjuggler / proofThatAndroidIsLinux.pde
Last active June 7, 2017 08:23
Proof that Android is Linux
// I was trying to see if I could get different code to run when the program was executing on Android as opposed to on my Linux Desktop
// came across this..
//paste into Processing for Android (tested on 2.2.1 only)
String OS = null;
String message = "";
void setup(){
size(displayWidth, displayHeight);
OS = System.getProperty("os.name");
@tomjuggler
tomjuggler / gist:718e513d504706a1f07a14aa4e95efc4
Created June 6, 2017 09:51
remove item from processing array
// credit: user nbrooks, stack overflow answer
// https://stackoverflow.com/questions/35822629/using-traditional-for-loop-to-remove-certain-elements-within-a-string-array
public void removeFromArray(String[] Arr, int item){
for (int i = item; i < Arr.length - 1; i++) {
// Replace each value with the next value
Arr[i] = Arr[i+1];
println(Arr[i]);