Skip to content

Instantly share code, notes, and snippets.

@jamie23
jamie23 / gist:d84f1c11aa307940d7afbbb903a68c34
Created April 5, 2016 14:00
Bing image url with specific size parameters
https://api.datamarket.azure.com/Bing/Search/v1/Image?Query=%27playstation%27&ImageFilters=%27Size%3AWidth%3A300%2BSize%3AHeight%3A300%27&$format=json
@jamie23
jamie23 / Hangman.py
Created April 28, 2015 00:34
Very quick hangman game to teach primary school kids in 1 hour
Making a hangman game, woohoo
#Get input and convert to list
word = raw_input("Please input your word: ");
word = list(word);
guesses = 5;
#Setting up our hashes list
guessingWord = len(word)*["*"];
@jamie23
jamie23 / gist:bbf56059883e195e76c4
Created February 2, 2015 17:08
Amazebots py code
# Pi2Go Motor Test
# Moves: Forward, Reverse, turn Right, turn Left, Stop - then repeat
# Press Ctrl-C to stop
#
# Also demonstrates writing to the LEDs
#
# To check wiring is correct ensure the order of movement as above is correct
# Run using: sudo python motorTest.py
import pi2go, time
https://www.youtube.com/watch?v=byeqpfBUyaU
@jamie23
jamie23 / gist:a3495349ff5103a9b59b
Created May 5, 2014 01:17
3 cluster, hierarchical clustering, cluster.stats() output
$n
[1] 573
$cluster.number
[1] 3
$cluster.size
[1] 112 310 151
$min.cluster.size
d = dist(cl, method = "euclidean")
fit = hclust(d, method = "ward")
plot(fit, labels=rownames(d), xaxt = "n")
groups = cutree(fit, k=3)
x = rect.hclust(fit, k=3, border="red", cluster = groups)
Removed comments for dissertation.
dataSmall <- read.delim("//Users//jamie//Programming//R//Dissertation//SmallData.out", row.names = 1)
dataBig <- read.delim("//Users//jamie//Programming//R//Dissertation//LargeData.tab", row.names = 1)
dataComplete <- merge(dataSmall,dataBig,by="row.names")
dataComplete[1]<-NULL
@jamie23
jamie23 / Classification tree
Last active August 29, 2015 14:00
Creating regression tree on data
check = as.factor(groups)
#fit tree model with training data
tree_model = tree(check~., training_data)
plot(tree_model)
text(tree_model, pretty=0)
#model precision check
tree_pred = predict(tree_model, testing_data, type="class")
@jamie23
jamie23 / gist:11197652
Created April 22, 2014 23:15
Good resources for papers
acm
siteseerx
research gate
import java.util.Scanner;
public class Solution {
public static void main(String[] args){
Solution x = new Solution();
int[] A = {-7,1,5,2,-4,3,0};
System.out.println(x.solution(A));
}