Skip to content

Instantly share code, notes, and snippets.

View claymcleod's full-sized avatar
🧬

Clay McLeod claymcleod

🧬
View GitHub Profile
@claymcleod
claymcleod / pycurses.py
Last active November 30, 2024 16:08
Python curses example
import sys,os
import curses
def draw_menu(stdscr):
k = 0
cursor_x = 0
cursor_y = 0
# Clear and refresh the screen for a blank canvas
stdscr.clear()
@claymcleod
claymcleod / controller.py
Last active December 15, 2022 21:40
Playstation 4 Controller Python
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# This file presents an interface for interacting with the Playstation 4 Controller
# in Python. Simply plug your PS4 controller into your computer using USB and run this
# script!
#
# NOTE: I assume in this script that the only joystick plugged in is the PS4 controller.
# if this is not the case, you will need to change the class accordingly.
#
# Title: Regular Expressions with Python
# Authors: Clay McLeod
# Description: Shows you how to find all instances of a regular expression
# in a string
# Section: Python
# Subsection: General
#
# Python docs on Regex: https://docs.python.org/2/howto/regex.html
#
# Notes:

Keybase proof

I hereby claim:

  • I am claymcleod on github.
  • I am clmcleod (https://keybase.io/clmcleod) on keybase.
  • I have a public key ASAq3m8EC04REjVlhiiWoN_TyW6Exl2ZpR3387VQewzG4go

To claim this, I am signing this object:

# Title: Randomized Algorithm (Median)
# Authors: Clay McLeod
# Description: A randomized algorithm for finding the median of an array.
# Section: Python
# Subsection: Interesting Problems
import sys
import math
import random
#!/usr/bin/python
# Title: Reddit Data Mining Script
# Authors: Clay McLeod
# Description: This script mines JSON data
# from the Reddit front page and stores it
# as a CSV file for analysis.
# Section: Python
# Subsection: Data Science
want=["domain", "subreddit", "subreddit_id" "id", "author", "score", "over_18", "downs", "created_utc", "ups", "num_comments"]
@claymcleod
claymcleod / mine_reddit.rb
Last active March 11, 2019 22:25
Simple ruby datamining example
# Title: Simple Ruby Datamining Example
# Authors: Clay McLeod
# Description: Mines data every minute concerning how many people are logged into a certain subreddit.
# Section: Ruby
# Subsection: Data Science
require 'csv'
require 'rubygems'
require 'nokogiri'
require 'rest-client'
#!/bin/bash
useage() {
printf "\n\e[1;4mAscii Escape Code Helper Utility\e[m\n\n"
printf " \e[1mUseage:\e[m colors.sh [-|-b|-f|-bq|-fq|-?|?] [start] [end] [step]\n\n"
printf "The values for the first parameter may be one of the following:\n\n"
printf " \e[1m-\e[m Will result in the default output.\n"
printf " \e[1m-b\e[m This will display the 8 color version of this chart.\n"
printf " \e[1m-f\e[m This will display the 256 color version of this chart using foreground colors.\n"
printf " \e[1m-q\e[m This will display the 256 color version of this chart without the extra text.\n"
@claymcleod
claymcleod / MNIST.py
Created February 9, 2016 03:35
MNIST.py
# Setup
import os
import sys
from keras.models import Sequential
from keras.layers.core import Dense, Dropout, Activation, Flatten
from keras.layers.convolutional import Convolution2D, MaxPooling2D
from keras.preprocessing.image import ImageDataGenerator
from keras.layers.advanced_activations import Quorum
from keras.datasets import mnist
@claymcleod
claymcleod / ubuntu_compile_kernel.sh
Last active September 29, 2017 17:13
Compiling the current ubuntu kernel
# Get kernel source
apt-get source linux-image-$(uname -r)
# Download kernel build tools
sudo apt-get install libncurses5-dev kernel-package
sudo apt-get build-dep linux-image-$(uname -r)
# Change the directory to the Linux source directory
cd /usr/src/linux-.....