Skip to content

Instantly share code, notes, and snippets.

View thomasnield's full-sized avatar

Thomas Nield thomasnield

  • Frisco, Texas (United States)
View GitHub Profile
@thomasnield
thomasnield / hello_world_nginx.sh
Created February 3, 2022 00:13
Hello World nginx
apt-get update -y && apt-get upgrade -y
apt-get install -y nginx
echo "Hello World from " $HOSTNAME | sudo tee -a /var/www/html/index.html
@thomasnield
thomasnield / oreilly_katacoda_ahk_helper.ahk
Created December 3, 2021 19:25
O'Reilly Katacoda AHK Helper
^+c::
Clipboard := random_Chars(10)
return
^+v:: Send, %Clipboard%
;-------------------------------------------------------------------------------
random_Chars(Count) { ; returns count random characters
;-------------------------------------------------------------------------------
@thomasnield
thomasnield / oreilly_atlas_ahk_helper.ahk
Created December 3, 2021 19:23
O'Reilly Atlas AHK Helper
^+c::
Clipboard := random_Chars(10)
return
^+v:: Send, %Clipboard%
;-------------------------------------------------------------------------------
random_Chars(Count) { ; returns count random characters
;-------------------------------------------------------------------------------
static Char_List := "ABCDEFGHIJKLMNOPQRSTUVW"
@thomasnield
thomasnield / moviepy_video_editing.py
Created November 3, 2021 18:21
MoviePy Video Editing in Python
from moviepy.editor import *
clip = VideoFileClip("C:/Users/thoma/OneDrive/Workspace/Projects/Yawman/media/prototype_2_demo.mp4") \
.subclip(8*60+7,8*60+30)\
.without_audio()
final_clip = concatenate_videoclips([clip])
clip.write_videofile("C:/Users/thoma/OneDrive/Workspace/Projects/Yawman/media/turn.mp4")
@thomasnield
thomasnield / sympy_simple_linear_regression_derivatives.py
Created November 1, 2021 13:51
sympy_simple_linear_regression_derivatives.py
from sympy import *
m, b, i, n = symbols('m b i n')
x, y = symbols('x y', cls=Function)
sum_of_squares = Sum((m*x(i) + b - y(i)) ** 2, (i, 0, n))
d_m = diff(sum_of_squares, m)
d_b = diff(sum_of_squares, b)
print(d_m)
@thomasnield
thomasnield / sympy_neural_network_derivatives.py
Last active November 11, 2021 14:10
sympy_neural_network_derivatives.py
from sympy import *
# Declare weight, bias, layer outputs, and input variables
# W1 and W2 are hidden and output layer weights
# B1 and B2 are hidden and output layer biases
# A1 and A2 are activated layer outputs
# Z1 and Z2 are inactivated layer outputs
# X and Y are the training data
W1, W2, B1, B2, A1, A2, Z1, Z2, X, Y = \
@thomasnield
thomasnield / neural_network_stochastic_gradient_descent.py
Last active October 30, 2021 19:48
neural_network_stochastic_gradient_descent.py
import numpy as np
import pandas as pd
from sklearn.model_selection import train_test_split
all_data = pd.read_csv("https://tinyurl.com/y2qmhfsr")
# Learning rate controls how slowly we approach a solution
# Make it too small, it will take too long to run.
# Make it too big, it will likely overshoot and miss the solution.
L = 0.05
@thomasnield
thomasnield / sympy_xor_neural_network.py
Last active September 28, 2021 01:05
sympy_xor_neural_network.py
from sympy import *
a, b, c, d, e, f = symbols('a b c d e f')
x1, x2, x3, x4 = symbols('x:4')
y1, y2, y3, y4 = symbols('y:4')
z1, z2, z3, z4 = symbols('z:4')
"""
input = Matrix([
[x1, y1],
@thomasnield
thomasnield / linear_regression_sympy.py
Created September 19, 2021 05:15
Linear Regression with SymPy
import pandas as pd
from sympy import *
# Import points from CSV
points = list(pd.read_csv("https://bit.ly/2KF29Bd").itertuples())
m, b, i, n = symbols('m b i n')
x, y = symbols('x y', cls=Function)
sum_of_squares = Sum((m*x(i) + b - y(i)) ** 2, (i, 0, n))
@thomasnield
thomasnield / logistic_regression_sympy.py
Last active September 19, 2021 05:17
Logistic Regression with SymPy
from sympy import *
import pandas as pd
m, b, i, n = symbols('m b i n')
x, y = symbols('x y', cls=Function)
joint_likelihood = Sum(log((1.0 / (1.0 + exp(-(b + m * x(i)))))**y(i) * (1.0 - (1.0 / (1.0 + exp(-(b + m * x(i))))))**(1-y(i))), (i, 0, n))
points = list(pd.read_csv("https://tinyurl.com/y2cocoo7").itertuples())