This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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())) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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> | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
background | |
fish | |
fish | |
shark | |
shark | |
shark | |
ray | |
ray | |
chicken | |
chicken |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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]); |