Skip to content

Instantly share code, notes, and snippets.

@dylangolow
dylangolow / nfl_teams.csv
Created January 20, 2023 22:24 — forked from cnizzardini/nfl_teams.csv
List of nfl teams as a CSV: name,abbreviation,conference,division for MySQL format. Please comment if you find any errors.
ID Name Abbreviation Conference Division
1 Arizona Cardinals ARI NFC West
2 Atlanta Falcons ATL NFC South
3 Baltimore Ravens BAL AFC North
4 Buffalo Bills BUF AFC East
5 Carolina Panthers CAR NFC South
6 Chicago Bears CHI NFC North
7 Cincinnati Bengals CIN AFC North
8 Cleveland Browns CLE AFC North
9 Dallas Cowboys DAL NFC East

search and replace text

mac

git grep -l 'search_text' | xargs sed -i '' -e 's/old_text/new_text/g'

non-mac

git grep -l 'search_text' | xargs sed -i 's/old_text/new_text/g'

@dylangolow
dylangolow / ComponentX_useEffectTest.tsx
Created September 2, 2022 18:36
Test code to check frequency of re-render based on state variable updates while using useEffect hook.
import { useEffect, useState } from "react";
export const ComponentX: React.FC = () => {
const [stateVar, setStateVar] = useState(undefined);
const [numberGeoRequests, setNumberGeoRequests] = useState(0);
const [lastRequestTime, setLastRequestTime] = useState(
new Date().getTime(),
);
useEffect(() => {
@dylangolow
dylangolow / artillery-config.test.yaml
Created June 29, 2021 16:05 — forked from whitehorse0/artillery-config.test.yaml
Artillery configuration example Load testing, and allow writing custom logic JS functions to be called at certain points during the execution of a scenario.
config:
target: "http://localhost:8000"
http:
timeout: 10 # Responses have to be sent within 10 seconds or the request will be aborted
processor: "./processor.js"
phases:
# Create 100 virtual users every second for 60 seconds
- duration: 60 # seconds
arrivalRate: 100 # virtual users
@dylangolow
dylangolow / Fastfile
Created June 29, 2021 14:37 — forked from dddnuts/Fastfile
Build ipa from Unity project with fastlane
fastlane_version "1.94.0"
default_platform :ios
platform :ios do
desc "Run Unity Editor tests"
lane :test_unit do
unity(
run_editor_tests: true
)
@dylangolow
dylangolow / HotPotato.sol
Created February 8, 2021 08:03
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.7.6+commit.7338295f.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.8.0;
/**
* @title HotPotato
* @dev Implements voting process along with vote delegation
*/
contract HotPotato {
@dylangolow
dylangolow / README.md
Last active March 13, 2024 08:40
Postman Pre-Request script for Firebase Auth

Postman Pre-Request Script to fetch Firebase Auth token

This pre-request script uses environment variables to fetch an auth JWT.

This Auth JWT is used in the header of all requests when testing API endpoints that use Firebase for authorization.

@dylangolow
dylangolow / jwtRS256.sh
Created July 23, 2020 16:46
Generate public private pair
ssh-keygen -t rsa -b 4096 -m PEM -f jwtRS256.key
# Don't add passphrase
openssl rsa -in jwtRS256.key -pubout -outform PEM -out jwtRS256.key.pub
cat jwtRS256.key
cat jwtRS256.key.pub
@dylangolow
dylangolow / ecosystem.config.js
Created April 15, 2020 18:17
pm2 ecosystem sample
const BRANCH = 'demo-app';
const REPO = 'git@gitlab.com:path/to/repo.git';
const DEPLOY_PATH = '/home/ec2-user/AWS_PATH';
const HOST = 'APP.YOUR_URL.COM';
const USER = 'ec2-user'; // AWS user
module.exports = {
apps: [{
name: 'API',
script: 'dist/server.js',
@dylangolow
dylangolow / .gitlab-ci.yml
Created April 15, 2020 18:16
GitLab CD Samples
# Node docker image on which this would be run
image: node:latest
stages:
#- test
- deploy
# lint and test are two different jobs in the same stage.
# This allows us to run these two in parallel and making build faster