Skip to content

Instantly share code, notes, and snippets.

View LyndonArmitage's full-sized avatar

Lyndon Armitage LyndonArmitage

View GitHub Profile
@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 / planetside_events.py
Created May 23, 2013 18:15
A Planetside 2 Python bot that periodically told me what the last event was that happened on the server I play on via a text to speech engine called pyttsx and prints it to the console.
import requests
import pyttsx
import time
__author__ = 'Lyndon'
# SOE documentation: https://census.soe.com/
# Faction IDs
def get_faction(id):
@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;
@LyndonArmitage
LyndonArmitage / analogCanvasClock.js
Last active May 24, 2023 19:21
The JavaScript file for the HTML5 Clock
/**
* Setup and start an analog clock using a canvas
* @param canvas The canvas to use
* @param clockWidth The width of the clock (radius*2)
* @author Lyndon Armitage
*/
function setupAnalogClock(canvas, clockWidth) {
var ctx = canvas.getContext("2d");
var centerX = canvas.width / 2;
var centerY = canvas.height / 2;
<!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 / cookiebot.js
Created September 11, 2013 19:34
CookieClicker Bot
/*
Cookie Clicker Bot by Lyndon Armitage.
Cookie Clicker itself is a game copyright of Orteil 2013.
You can play it here: http://orteil.dashnet.org/cookieclicker/
This is a very basic bot for Cookie Clicker.
It is written in such a way that it does not interact directly with the game itself but instead it relies on reading
the CSS/HTML IDs and classes of the GUI elements on the page.