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
#!/usr/bin/env python | |
print("Hampton [k4kfh] - blog.evilgeniustech.com") | |
firstx = float(input("What is the first X coordinate? ")) | |
firsty = float(input("What is the first Y coordinate? ")) | |
print("Ordered pair for first point: (%d, %d)") % (firstx, firsty) | |
secondx = float(input("What is the second X coordinate? ")) | |
secondy = float(input("What is the second Y coordinate? ")) |
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
//BUILDDROPDOWN.JS | |
//by Hampton [evilgeniustech.com] | |
//buildDropdown.js is a useful script that makes it easy to build an HTML dropdown <select> tag from a JavaScript array. | |
//How to use: | |
//The function accepts 2-3 parameters. | |
// - id >>> this is the HTML ID of the select element you wish to modify, as a string of course. | |
// - list >>> this is the JavaScript array you want to use with the dropdown. | |
// - clear >>> this is a boolean which decides whether or not the script removes existing dropdown choices. For example, if I called this with clear = true, it would delete any existing <option> tags and start fresh. If it is false or undefined, it simply appends the new <option> tags to the existing ones, if any. |
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
emd567:function(address, trainPosition) { | |
//ESU LokSound Select V4 | |
//decoder object for ESU official EMD 567 Sound project | |
//By Hampton Morgan - k4kfh@github - May 2015 | |
//evilgeniustech.com | |
train[trainPosition].throttle = new jmri.throttle(address, trainPosition) //we use the train position as the throttle name for future lookup purposes | |
//FUNCTIONS | |
this.f = new Object(); |
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
prototype: { | |
"builder": "EMD", //This is displayed to the client and can be anything | |
"name": "F7-A", //This is also displayed to the client and can be anything | |
"type": "locomotive", //This must be "locomotive" | |
"weight": 250000, //Weight of the locomotive in lbs | |
"maxHP": 1500, //Horsepower of the locomotive | |
"notchRPM": [300, 362, 425, 487, 550, 613, 675, 738, 800], //This is an array of RPMs for the notch values. Start with idle, end with RUN8, for a total of 9 array items. | |
"notchMaxSpeeds": [null, 7.5, 15, 22.5, 30, 37.5, 45, 52.5, 60], //This is an array of max speeds for the notch values. Set the first item to null. This is so we can look things up by just feeding the notch into it, but the max speed for IDLE is obviously zero. | |
"engineRunning": 0, //This is NOT A BOOLEAN! This is a binary value (0 is off, 1 is on). You should set this to 0, sim.js will redefine it as needed. |
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
decoders = { | |
//This is EXACTLY the same string value recieved from JMRI for the decoderFamily attribute. | |
"ESU LokSound Select": { | |
//This is EXACTLY the same string value recieved from JMRI for the decoderModel attribute. | |
"LokSound Select EMD 567": function (address, trainPosition) { | |
//First thing we do is create the throttle object. Make sure you use jmri.throttleName.generate() for the name! That function generates a unique name for each throttle, and if you don't use it you'll probably run into issues. | |
train.all[trainPosition].throttle = new jmri.throttle(address, jmri.throttleName.generate()); //we use the train position as the throttle name for future lookup purposes | |
/* | |
Functions: |
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
timestamp = function(type) { | |
if (type == undefined) { | |
type = 24; | |
} | |
if (type == 24) { | |
var currentDate = new Date(); | |
var hours = currentDate.getHours(); | |
var minutes = currentDate.getMinutes(); | |
var seconds = currentDate.getSeconds(); | |
var finalString = hours + ":" + minutes + ":" + seconds; |
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
//OLD ATTEMPT CODE | |
//run this on the old attempt page to spit out all your answers in an array. | |
//copy the array to your clipboard | |
var answerList = []; | |
$(".question_input").each(function() { | |
answerList.push($(this).val()) | |
}) | |
//NEW ATTEMPT CODE | |
//put in your answers in global variable answerList |
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
unsigned long currentMillis = 0; | |
unsigned long previousMillisArc = 0; | |
unsigned long previousMillisFlicker = 0; | |
int timeArcOff = 3000; | |
int timeArcOn = 3000; | |
bool arc = false; //whether there's an arc right now or not | |
int ledState = LOW; | |
const int ledPin = 2; | |
int timeFlickerOn = 50; | |
int timeFlickerOff = 170; |
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
# PROXY TESTER | |
# Run this script with an array of URLs and it will make HTTP requests. Whenever it encounters an error it will timestamp it and log it | |
#import libs | |
import urllib2 | |
import hashlib | |
import sys | |
import time | |
import datetime | |
#config |
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 os,sys,uuid | |
global injectedLegitFile | |
injectedLegitFile = True | |
def fillDirectoryWithFiles(path, numFiles, size): | |
file_names = [(str(uuid.uuid4())[:10] + ".xlsx") for i in range(0,numFiles)] | |
#print file_names | |
for name in file_names: | |
fileObject = open(path+"/"+name,"w+") | |
fileObject.write(os.urandom(size)) |
OlderNewer