Skip to content

Instantly share code, notes, and snippets.

View SlayterDev's full-sized avatar

Brad Slayter SlayterDev

  • Texas, US
View GitHub Profile
@SlayterDev
SlayterDev / keymap.c
Created May 20, 2022 12:49
IDOBAO ID42 Keymap
/* Copyright 2021 TW59420 <https://github.com/TW59420>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
import UIKit
extension UIColor {
class func colorWithHexString(string: String) -> UIColor {
let num = Int(string, radix: 16)!
let r = CGFloat(num >> 16) / 255
let g = CGFloat(((num >> 8) - (num >> 8) & 0xFF00)) / 255
let b = CGFloat(num - (num & 0xFFFF00)) / 255
@SlayterDev
SlayterDev / RC4.swift
Last active February 2, 2016 21:22
Simple implementation of the RC4 stream cipher in Swift. Currently only encrypts. Feel free to make it better.
//
// RC4
//
// Created by Bradley Slayter on 2/2/16.
// Copyright © 2016 Bradley Slayter. All rights reserved.
//
import Foundation
@SlayterDev
SlayterDev / CountLines.py
Last active August 29, 2015 14:09
Count the number of lines and files in a path. The script defaults to the current directory. Add a path as a command line argument to check another directory.
import os
import sys
numlines = 0
numFiles = 0
exclude = ['.o', '.bin', '.iso', '.img', '.log', '#', '.dre'] # file extensions to ignore
def countLines(path):
global numlines
@SlayterDev
SlayterDev / WordFight.py
Created July 30, 2014 15:34
Get the word root of two strings and see who wins
def main():
strings = raw_input("Enter two comma seperated stings: ")
strings = strings.split(',')
origStrings = strings
root1 = getWordRoot(strings[0])
root2 = getWordRoot(strings[1])
while (root1 == root2) and (len(strings[0]) > 1 and len(strings[1]) > 1):
@SlayterDev
SlayterDev / Arrays.java
Created July 8, 2014 14:39
Array example
public class Arrays {
public static void main(String[] args) {
// TODO Auto-generated method stub
String[] names = new String[5];
names[0] = "Garret";
names[1] = "Calvin";
names[2] = "Ben";
names[3] = "James";
@SlayterDev
SlayterDev / Average.java
Created July 8, 2014 14:37
Calculate the average of a number of grades
import java.util.Scanner;
public class Average {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner input = new Scanner(System.in);
System.out.println("Brad's grade averager!!");
@SlayterDev
SlayterDev / RandomImage.java
Last active August 29, 2015 14:03
Create a picture
import java.util.Random;
public class TestBed {
public static void main(String[] args) {
// TODO Auto-generated method stub
char[] tokens = {'o', '+', '-', '#'}; // symobols
Random random = new Random();
import praw
import time
seen = []
def main():
user_agent = ("User stalker 1.0")
r = praw.Reddit(user_agent=user_agent)
r.login('username', 'password')