Skip to content

Instantly share code, notes, and snippets.

View claymcleod's full-sized avatar
🧬

Clay McLeod claymcleod

🧬
View GitHub Profile

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:

#!/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"
import subprocess
def cmd(line):
complete_cmd = subprocess.run(
line, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
return {'stdout': complete_cmd.stdout, 'stderr': complete_cmd.stderr}
print(cmd("echo 'hello, world'"))
@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 / cifar100.py
Last active February 8, 2016 21:23
CIFAR100
# 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 cifar100
@claymcleod
claymcleod / stdloss.py
Last active February 6, 2016 19:18
STD Loss for DNN
import sys
import numpy as np
from keras.models import Sequential
from keras.layers.core import Dense, Dropout, Activation, Flatten
from keras.layers.convolutional import Convolution2D, MaxPooling2D
from keras.layers.advanced_activations import Quorum
from keras.datasets import mnist
from keras.utils import np_utils
from keras.activations import relu
@claymcleod
claymcleod / main.py
Created January 20, 2016 08:30
Simple NN Theano
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright © 2016 Clay L. McLeod <[email protected]>
#
# Distributed under terms of the MIT license.
from __future__ import print_function
import theano
@claymcleod
claymcleod / pycurses.py
Last active October 13, 2024 16:45
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.
#
import numpy as np
import pandas as pd
from sklearn.preprocessing import StandardScaler, LabelEncoder
df = pd.read_csv('data.csv')
df = df.fillna(0)
for (_col, _dtype) in zip(df.columns, df.dtypes):
_dtype_as_str = str(_dtype)
if 'int' in _dtype_as_str or 'float' in _dtype_as_str: