Skip to content

Instantly share code, notes, and snippets.

View LyndonArmitage's full-sized avatar

Lyndon Armitage LyndonArmitage

View GitHub Profile
@LyndonArmitage
LyndonArmitage / glider.txt
Last active August 29, 2015 13:58
Basic Conways Game Of Life in C
#..
.##
##.
@LyndonArmitage
LyndonArmitage / redditSpeak.py
Created March 9, 2013 18:47
My first Python program. Gets the top 10 news stories from Reddits worldnews subreddit and speaks them out using a Text to Speech engine.
import time
import praw
import pyttsx
__author__ = "Lyndon Armitage"
username = "alarmbot"
password = "password"
engine = pyttsx.init()
@LyndonArmitage
LyndonArmitage / gist:5224257
Created March 22, 2013 19:55
Speak the top news from reddit. Runs in an infinite loop. Quite messy code, makes use of 3 different libraries.
package com.lyndonarmitage.reddit;
import com.omrlnr.jreddit.submissions.Submission;
import com.omrlnr.jreddit.submissions.Submissions;
import com.omrlnr.jreddit.user.User;
import com.sun.speech.freetts.VoiceManager;
import org.joda.time.DateTime;
import org.joda.time.LocalDateTime;
import org.joda.time.LocalTime;
import org.joda.time.Period;
@LyndonArmitage
LyndonArmitage / planetside_certs.py
Created May 23, 2013 18:11
This is a basic python script to check the average cert gained per minute on Planetside 2 using their API.
import requests
import time
__author__ = "Lyndon Armitage"
check_interval = 60 * 1 # Every 1 min
interval = 60 * 1 # Interval to sleep at (can be faster than check interval)
last_check_time = time.clock() - check_interval
username = "theanchorman"
start_certs = 0
@LyndonArmitage
LyndonArmitage / clock.html
Created June 30, 2013 14:55
The HTML5 file for the analog clock
<!DOCTYPE html>
<html>
<head>
<title>Clock</title>
<style type="text/css">
#container {
margin: 0 auto;
width: 800px;
text-align: center;
border: black dashed 1px;
<!DOCTYPE html>
<html>
<head>
<title>Check if File is PDF on the Client Side</title>
</head>
<body>
<form id="uploadForm">
<label>Upload a PDF: <input type="file" id="fileUpload" name="file" /></label>
</form>
<script type="text/javascript" src="js/checkPDF.js"></script>
@LyndonArmitage
LyndonArmitage / checkPDF.js
Created July 11, 2013 14:21
js/checkPDF.js
/**
* Used to attach events to an element or object in a browser independent way
* @param element
* @param event
* @param callbackFunction
*/
function attachEvent(element, event, callbackFunction) {
if(element.addEventListener) {
element.addEventListener(event, callbackFunction, false);
}
@LyndonArmitage
LyndonArmitage / index.html
Created August 20, 2013 16:02
The Index.html for a jQuery based PDF Viewer that makes use of the PDF to HTML5 converter made by http://www.idrsolutions.com/
<!DOCTYPE html>
<html>
<head>
<title>jQuery Viewer Example</title>
<style type="text/css">
body {
background: #0000FF;
}
#container {
margin-left: auto;
@LyndonArmitage
LyndonArmitage / anagram.sc
Last active January 25, 2016 23:12
anagram scala file
import java.io.File
import scala.collection.mutable
def sortWord(word: String) = new String(word.toCharArray.sorted)
val wordList = scala.io.Source.fromFile(
new File("wordsEn.txt"))
.getLines()
.filter(_.length > 2)
import scala.collection.mutable
// The word wheel data
val required = List[Char]('a')
val otherChars = List[Char]('t', 'n', 'd', 'o', 'e', 'c', 'i', 'u')
// Load a word list and remove anything smaller than 2 letters
val wordList = scala.io.Source.fromInputStream(getClass.getResourceAsStream("/wordsEn.txt"))
.getLines()
.filter(_.length > 2)