Skip to content

Instantly share code, notes, and snippets.

View jhadev's full-sized avatar

Josh A jhadev

View GitHub Profile
@jhadev
jhadev / austin-power-outages-puppeteer.js
Last active December 14, 2023 19:13
austin-power-outages-puppeteer
const puppeteer = require("puppeteer");
async function getAustinPowerOutages(endpoint) {
try {
const res = await fetch(endpoint);
if (!res.ok) {
throw new Error(`Austin Energy ${endpoint} is not available.`);
}
const data = await res.json();
return data;
@jhadev
jhadev / Script Info NEXT DATA iOS.shortcut
Created August 2, 2023 16:15
iOS Script Info NEXT DATA
Script Info NEXT DATA iOS
@jhadev
jhadev / reuseable-fetch.js
Last active December 14, 2023 19:15
reuseable-fetch.js
function client(endpoint, { body, ...customConfig } = {}) {
const headers = { 'Content-Type': 'application/json' };
const config = {
method: body ? 'POST' : 'GET',
...customConfig,
headers: {
...headers,
...customConfig.headers,
},
};
@jhadev
jhadev / Clone a forked repo and all it's branches.md
Created December 23, 2022 12:14
Clone a forked repo and bring all branches with it

All the answers I saw here were valid, but there is a much cleaner way to clone a repository and to pull all the branches at once.

When you clone a repository, all the information of the branches is actually downloaded, but the branches are hidden. With the command

git branch -a

you can show all the branches of the repository, and with the command

@jhadev
jhadev / scaffold.zsh
Last active December 13, 2022 23:14
Scaffold an entire simple html, css, js project in one command
# put in .zshrc
# cd into the folder you want to put your project in
# scaffold [PROJECT NAME]
scaffold() {
mkdir $1 && cd $1 && touch index.html && mkdir assets && mkdir assets/js && mkdir assets/css && touch assets/js/script.js && touch assets/css/style.css && echo '<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
@jhadev
jhadev / kill_old_ssh_agents
Created November 21, 2022 17:49 — forked from gubatron/kill_old_ssh_agents
Linux command (script) to kill old ssh-agent processes, (could be parametrized to change the process name)
#!/usr/bin/env python
# Author: @gubatron
# License: MIT License, Copyright 2019
import os
import sys
if __name__ == '__main__':
cmd_get_process_list = 'ps -ef --sort=start_time | grep ssh-agent | grep -v grep'
output = os.popen(cmd_get_process_list)
lines = output.read().split("\n")
@jhadev
jhadev / .gitignore.txt
Created November 4, 2022 18:52
gitignore
# Created by https://www.toptal.com/developers/gitignore/api/visualstudiocode,macos,node
# Edit at https://www.toptal.com/developers/gitignore?templates=visualstudiocode,macos,node
### macOS ###
# General
.DS_Store
.AppleDouble
.LSOverride
# Icon must end with two \r
@jhadev
jhadev / create_html_repo.zsh
Last active October 12, 2022 11:06
create_html_repo.zsh
source ${ZDOTDIR-$HOME}/.zsh/create_html_repo.zsh
export GH_TOKEN=<TOKEN>
export REPO_NAME="$USER-automated-repo"
# create_html_repo my-cool-project
create_html_repo() {
cd ~/Desktop && mkdir $1 && cd $1 && touch index.html && mkdir assets && mkdir assets/js && mkdir assets/css && touch assets/js/script.js && touch assets/css/style.css && echo '<!DOCTYPE html>
@jhadev
jhadev / create_repo.zsh
Last active December 13, 2022 23:17
ZSH Create Repo
export GH_TOKEN="<YOUR TOKEN>"
export REPO_NAME="$USER-automated-repo"
create_repo() {
echo default $REPO_NAME
vared -c -p 'Please enter a repo name: ' REPO_NAME
echo new $REPO_NAME
curl \
-X POST \