Skip to content

Instantly share code, notes, and snippets.

View twosdai's full-sized avatar
🐶
🐱

Daniel Wasserlauf twosdai

🐶
🐱
View GitHub Profile
function gas() {
local repo_dir branch owner repo api_url gh_status conclusion color
# Ensure GITHUB_TOKEN is set
if [[ -z "$GITHUB_TOKEN" ]]; then
echo "❌ GITHUB_TOKEN is not set. Export it in your shell environment."
return 1
fi
# Find the Git repo root
@twosdai
twosdai / webHookRegisterAndTest.js
Created March 18, 2025 23:42
Webhook Register
// Description: This script registers a webhook, tests it, and then unregisters it.
// Run npm install cross-fetch to install the cross-fetch package. you can also use node-fetch but the ESM module system will struggle with it.
// To run the script, run: node webHookRegisterAndTest.js
const fetch = require("cross-fetch");
const apiKey = "EXAMPLE_API_KEY";
const webhookUrl = "https://public.prod.tenex.email/webhooks/register";
const testWebhookUrl = "https://public.prod.tenex.email/webhooks/test";
const unregisterWebhookUrl = "https://public.prod.tenex.email/webhooks/";
const fetch = require('cross-fetch');
async function fetchAndCheckLeadsForTrackingmore(url) {
let offset = 0;
const limit = 100;
let totalLeads = Infinity; // Initial dummy value
while (offset < totalLeads) {
try {
const response = await fetch(`${url}&offset=${offset}&limit=${limit}`);
const fetch = require("cross-fetch");
async function fetchAllLeads(url) {
const leadsMap = new Map();
let offset = 0;
const limit = 100;
let totalLeads = Infinity; // initial dummy value
while (offset < totalLeads) {
try {
// Read in a CSV file and check for errors
// Usage: node csvChecker.js <filename>
// Example: node csvChecker.js test.csv
const fs = require('fs');
const csv = require('csv-parser');
const createCsvWriter = require('csv-writer').createObjectCsvWriter
const results = [];
@twosdai
twosdai / taxJarImpl.js
Created January 11, 2024 17:43
TaxJar Testing
// Below is our basic function call implementation Treat this as Psudeo Code
// npm init -y
// npm i taxjar --save
const TaxJar = require("taxjar");
const taxjarClient = new TaxJar({
apiKey: "FILLMEIN",
apiUrl: "https://api.sandbox.taxjar.com",
});
const calculateSalesTax = async () => {
try {
//const fetch = require("node-fetch");
const apiEndpoint = "http://api.open-notify.org/iss-now.json";
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
/**
*
* Below are a few examples of how to use async stuff inside of JS. I am using the ISS now API for the async request.
*/
// To force some ASYNC method to run synchronously, I reccomend using a for loop or a do while loop to force the code to run in order.
// This is useful for pagination or when you really need to be sure that a previous request executed before the next one. I reccomend only doing this if you have less than 20 Http calls to make. total
Y. _
YiL .```.
Yii; YC IS 1337 .; .;;`.
YY;ii._ .;`.;;;; :
iiYYYYYYiiiii;;;;i` ;;::;;;;
_.;YYYYYYiiiiiiYYYii .;;. ;;;
.YYYYYYYYYYiiYYYYYYYYYYYYii;` ;;;;
.YYYYYYY$$YYiiYY$$$$iiiYYYYYY;.ii;`..
:YYY$!. TYiiYY$$$$$YYYYYYYiiYYYYiYYii.
Y$MM$: :YYYYYY$!"``"4YYYYYiiiYYYYiiYY.
apiVersion: v1
kind: Service
metadata:
labels:
app.kubernetes.io/component: exporter
app.kubernetes.io/name: kube-state-metrics
app.kubernetes.io/version: 2.5.0
name: kube-state-metrics
namespace: kube-system
spec:
@twosdai
twosdai / prom.yml
Created July 13, 2022 06:45
Prometheus configuration for basic scraping and remote write.
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: prometheus
rules:
- apiGroups: ['']
resources:
- nodes
- nodes/proxy
- services