Skip to content

Instantly share code, notes, and snippets.

View nhalstead's full-sized avatar
👨‍💻
Something. Maybe cool

Noah Halstead nhalstead

👨‍💻
Something. Maybe cool
View GitHub Profile
@nhalstead
nhalstead / abreavtion.js
Last active November 12, 2020 20:46
Javascript Number Abreavtion
/**
* Parse an aberration of a number
*
* @author Noah Halstead <[email protected]>
* @param {string} value Abbreviated Number
* @return {number} amount
*/
function unabbreviateNumber(value = "") {
value = value.toLowerCase().replace(/,/g, "")
@nhalstead
nhalstead / deploy_airconnect.sh
Created August 18, 2020 16:47
Deploy AirConnect in a Docker Container linked to the host adapter.
#!/bin/bash
docker run -d --net=host \
--restart=always \
--label stack.application=airconnect \
--label stack.category=audio \
--label stack.type=p2p-bridge \
--hostname airconnect \
--name airconnect \
1activegeek/airconnect
@nhalstead
nhalstead / index.js
Created August 7, 2020 18:12
app.salesloft.com Unsubscribe
var params = location.search
.substr(1)
.split("&")
.reduce(function(params, param) {
params[param.split('=')[0]] = decodeURIComponent(param.split('=')[1])
return params
}, {})
document.getElementById('email').textContent = params['email']
@nhalstead
nhalstead / dejadup-auto-exclude
Last active August 29, 2022 18:37
This will exclude Node_modules, Vendor (Composer), and Build Folders from the Backup that is run by Deja Dup Backup
#!/bin/bash
# Update Deja Dup Backup Exclude Config for the node_modules folders.
# This will only auto exclude if a package.json file and a .git folder exist.
# This also will update the list for excluding backups of vendor <composer> folders.
if [[ ! -x "$(command -v yq)" ]]; then
echo "'yq' is required. Please install 'yq'. Try 'snap install yq'"
exit 1;
fi
@nhalstead
nhalstead / BootingTraits.php
Created July 27, 2020 17:48
Laravel BootingTraits
<?php
namespace App\Traits;
/**
* This is a copy of code from Illuminate\Database\Eloquent\Model
* that allows traits to be booted and initialized.
*
* These functions are on the trait its self and allow for an initialization
* to take place.
@nhalstead
nhalstead / configMap.yml
Last active June 5, 2020 15:16
Kubernetes ConfigMap
apiVersion: v1
kind: ConfigMap
metadata:
name: my-laravel-env-vars
namespace: default
data:
APP_KEY: xyz
APP_URL: https://example.com
const insertFill = function (arr, index, item, fillValue = 0) {
if (arr.length === 0 && index === 0) return [item];
if (arr.length < index) {
// Index is not found, Fill in the length needed.
const missing = index - arr.length;
const fill = Array(missing - 1).fill(fillValue);
arr = arr.concat(fill);
return arr.concat([item]);
}
// The Index exists, insert at that point.
@nhalstead
nhalstead / .rc_extra
Last active September 16, 2024 18:25
Handy Bash Scripts for Development using docker containers in a namespace fashion built from a docker compose script using DockerStation and Kubernetes cluster.
# Bash Functions to load into the shell environment
alias chmox="chmod +x"
alias claer="clear"
alias exiut="exit"
alias exuit="exit"
@nhalstead
nhalstead / convert_ts.py
Created April 15, 2020 02:52
GNotes to Joplin Import Format, This will convert a GNotes Export into a plain text import for Joplin.
#!/usr/bin/env python
import os
import sys
import time
dataIn = float(sys.stdin.read())
os.utime(sys.argv[1], (dataIn, dataIn))
@nhalstead
nhalstead / example.php
Last active March 21, 2020 16:38
Renumber the Order Param Function
<?php
require_once("reorder.php");
/**
* This is just an element to hold the data,
* you can use any thing as long as the function
* knows where to get the order and an ID.
*/
class Element {