Skip to content

Instantly share code, notes, and snippets.

View JeremyMorgan's full-sized avatar

Jeremy Morgan JeremyMorgan

View GitHub Profile
@JeremyMorgan
JeremyMorgan / getbadguys.sh
Created February 8, 2020 04:35
Get a list of IP addresses trying to attack your CentOS server
#/usr/bin/bash
# strings to look for in our file
# Note: you could just parse the whole file. But if you put in a bad password your IP
# could end up on the bad guy list
declare -a badstrings=("Failed password for invalid user"
"input_userauth_request: invalid user"
"pam_unix(sshd:auth): check pass; user unknown"
"input_userauth_request: invalid user"
"does not map back to the address"
"pam_unix(sshd:auth): authentication failure"
import unittest
"""
This is a function to extract numbers from the string.
It is implemented in my main script that reads the entire input file and runs
this function against each line.
"""
from [YOURSCRIPT] import extract_numbers
class TestExtract(unittest.TestCase):
@JeremyMorgan
JeremyMorgan / states.sql
Last active October 3, 2023 12:55
An SQL Query to insert 50 U.S. States into a database.Make sure your auto increment is set in MySQL, and Identity_insert is set in MS-SQL.
CREATE TABLE [state](
[stateID] [int] IDENTITY(1,1) NOT NULL,
[stateCode] [nchar](2) NOT NULL,
[stateName] [nvarchar](128) NOT NULL,
CONSTRAINT [PK_state] PRIMARY KEY CLUSTERED
( [stateID] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY])
ON [PRIMARY]
@JeremyMorgan
JeremyMorgan / cmake.sh
Last active May 25, 2023 19:01
My latest OpenCV CMake config
export OPENCV_DOWNLOAD_PATH=/tmp/opencv-cache
cmake -D CMAKE_C_COMPILER=/usr/bin/clang-15 -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D CMAKE_PREFIX_PATH=/usr/lib -D OPENCV_EXTRA_MODULES_PATH=../opencv_contrib/modules -D WITH_CUDA=ON -D CUDA_ARCH_BIN=8.9 -D ARCH=sm_89 -D gencode=arch=compute_89,code=sm_89 -D ENABLE_FAST_MATH=ON -D CUDA_FAST_MATH=ON -D WITH_CUBLAS=ON -D WITH_CUFFT=ON -D WITH_NVCUVID=ON -D WITH_OPENMP=ON -D BUILD_EXAMPLES=ON -D BUILD_DOCS=OFF -D BUILD_PERF_TESTS=OFF -D BUILD_TESTS=OFF -D WITH_TBB=ON -D WITH_IPP=ON -D WITH_NVCUVID=ON -D WITH_CSTRIPES=ON -D WITH_OPENCL=ON -D WITH_FFMPEG=ON -D BUILD_opencv_apps=ON -D OPENCV_DOWNLOAD_PATH=/tmp/opencv-cache -D WITH_PNG=ON -D WITH_JPEG=ON -D WITH_WEBP=ON -D WITH_V4L=ON -D WITH_GTK=ON -D WITH_QT=ON -D WITH_GPHOTO2=ON -D WITH_GSTREAMER=ON -D WITH_PROTOBUF=ON -D OPENCV_DNN_CUDA=ON -D CMAKE_PREFIX_PATH=/usr/lib -D CMAKE_CXX_FLAGS="-Ofast" ../opencv
@JeremyMorgan
JeremyMorgan / Batman-vs-ironman.txt
Created April 24, 2023 02:20
Batman vs IronMan
Jeremy: Who is the better superhero? Batman or Ironman?
ChatGPT: As an AI language model, I do not have personal opinions or preferences. However, I can provide you with a comparison between Batman and Iron Man to help you decide for yourself.
Batman, also known as Bruce Wayne, is a DC Comics superhero created by artist Bob Kane and writer Bill Finger in 1939. Batman is a highly skilled martial artist and detective, utilizing his intellect, technology, and wealth to fight crime in Gotham City. He does not possess any superhuman abilities but relies on his physical prowess, gadgets, and vehicles. Batman's motivation stems from witnessing the murder of his parents, which drives him to protect innocent people and bring justice to criminals.
Iron Man, or Tony Stark, is a Marvel Comics superhero created by writer Stan Lee, artist Don Heck, and scripter Larry Lieber in 1963. Tony Stark is a billionaire inventor, engineer, and philanthropist who created the Iron Man suit to save his own life after being injured a
@JeremyMorgan
JeremyMorgan / mutethisshit.txt
Created April 8, 2023 03:46
Great terms to mute on Twitter
#politics
#election
#government
#policy
#vote
#democracy
#republican
#democrat
#conservative
#liberal
@JeremyMorgan
JeremyMorgan / workstationsetup.sh
Last active March 27, 2023 21:12
Setup for my FreeBSD Workstation
# This may be runnable as a script, but keep in mind -y is not always acknowledged.
# These are the drop dead basics
pkg -y install vim
pkg -y install git
pkg -y install chromium
pkg -y install gimp
pkg -y install sudo
# Install Rust
@JeremyMorgan
JeremyMorgan / shake.go
Last active January 28, 2022 23:21
The most important code I've ever written
package main
import (
"fmt";
)
func loopit(phrase string, repeat int)(string){
var outputphrase string = "";
@JeremyMorgan
JeremyMorgan / OpenGraphHeader.htm
Last active January 16, 2022 21:24
Template for Open Graph Tags. Adding these to your pages will help you display information better on Google+, Facebook and Twitter. Just replace the values with their own.
<meta itemprop="name" content="[ TITLE ]" />
<meta itemprop="image" content="[ LISTING IMAGE ]" />
<meta itemprop="description" content="[ ARTICLE DESCRIPTION ]" />
<meta name="description" content="[ ARTICLE DESCRIPTION ]" />
<meta name="author" content="[ AUTHOR FULL NAME ]" />
<meta property="article:author" content="[ GOOGLE+ AUTHOR URL ]" />
<meta property="article:published_time" content="[ PUBLISHED TIMESTAMP ]" />
<meta property="article:section" content="[ CATEGORY ]" />
@JeremyMorgan
JeremyMorgan / popsetup.sh
Created December 24, 2020 23:59
Initial setup for my Pop!_OS Dev Boxes
#!/bin/bash
sudo apt update
### Visual Studio Code
sudo apt install wget
wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > packages.microsoft.gpg
sudo install -o root -g root -m 644 packages.microsoft.gpg /etc/apt/trusted.gpg.d/