Skip to content

Instantly share code, notes, and snippets.

View rodgtr1's full-sized avatar

Travis Rodgers rodgtr1

View GitHub Profile
@rodgtr1
rodgtr1 / eslint-setup.sh
Created November 6, 2024 21:53
A script to set up ESLint / Prettier completely in Next.js
#!/bin/bash
echo "Starting ESLint and Prettier setup..."
echo "Installing ESLint and Prettier dependencies..."
npm i eslint-config-standard eslint-plugin-tailwindcss eslint-config-prettier prettier eslint-plugin-import --save-dev
echo "Install ESLint plugin"
code --install-extension dbaeumer.vscode-eslint
echo "Install Prettier plugin"
@rodgtr1
rodgtr1 / github-ssh-deploy.yml
Created August 7, 2024 16:19
Use GitHub actions to set up automated deployment of WordPress site via SSH on any hosting provider
name: Hostinger SSH Deployment
on:
push:
branches: [main]
workflow_call:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
@rodgtr1
rodgtr1 / dijkstras-algorithm.py
Created May 28, 2024 16:12
Example code from the DSA For Non-Traditionals: 7 - Dijkstra's algorithm in the Travis Media Community - https://community.travis.media/recordings/dsa-for-non-traditionals-dijkstras-algorithm
# First, let's implement the graph. This time we'll need to store the neighbors AND the cost for getting to that neighbor.
# Start has two neighbors A and B
graph = {}
graph["start"] = {}
graph["start"]["a"] = 6
graph["start"]["b"] = 2
# Graph["start"] is a hash table
# Get all the neighbors for start like this
@rodgtr1
rodgtr1 / breadth_first_search.py
Created May 15, 2024 13:05
Example code from the DSA For Non-Traditionals: 6 - Graphs and the Breadth-first search algorithm in the Travis Media Community - https://community.travis.media/recordings/dsa-for-non-traditionals-graphs-and-the-breadth-first-search-algorithm
from collections import deque
graph = {}
graph["you"] = ["alice", "bob", "claire"]
graph["bob"] = ["anuj", "peggy"]
graph["alice"] = ["peggy"]
graph["claire"] = ["thom", "jonny"]
graph["anuj"] = []
graph["peggy"] = []
graph["thom"] = []
@rodgtr1
rodgtr1 / python_exercises.py
Last active October 30, 2024 09:57
Python exercises for Python Tutorial - https://youtu.be/f1E1NvcRvdc
# Install and Setup
# REPL
# VSCode & Extension
# 1. Variables / Types
@rodgtr1
rodgtr1 / BikeChain.sol
Created April 24, 2022 03:30
The Smart Contract for the BikeChain app built in my YouTube tutorial - here.
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract BikeChain {
address owner;
constructor() {
owner = msg.sender;
@rodgtr1
rodgtr1 / CryptoKids.sol
Created April 7, 2022 12:31
CryptoKids Solidity Smart Contract - Tutorial at https://youtu.be/s9MVkHKV2Vw
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.7;
contract CryptoKids {
// owner DAD
address owner;
event LogKidFundingReceived(address addr, uint amount, uint contractBalance);
@rodgtr1
rodgtr1 / sendBirthdayGreeting.go
Last active July 10, 2021 17:32
Lambda Function To Automate Birthday Greetings From CSV Written in Go
package main
import (
"encoding/csv"
"encoding/json"
"fmt"
"os"
"time"
"github.com/aws/aws-lambda-go/lambda"
@rodgtr1
rodgtr1 / bitbucket-pipelines.yml
Created July 10, 2021 17:29
Bitbucket Pipeline to SFTP Files Up To WordPress Server
pipelines:
branches:
master:
- step:
name: Deploy to staging
deployment: staging
script:
- pipe: atlassian/sftp-deploy:0.5.7
variables:
USER: $SFTP_USERNAME
@rodgtr1
rodgtr1 / uptimeMonitor.sh
Created July 2, 2021 14:17
Uptime Monitor for Ghost (or really any Linux service)
#!/bin/bash
#ver. 4
##this script will check mysql and apache
##if that service is not running
##it will start the service and send an email to you
##if the restart does not work, it sends an email and then exits
##set the path ##this works for Ubuntu 14.04 and 16.04
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin