Skip to content

Instantly share code, notes, and snippets.

@bronifty
bronifty / cjs_esm_interop_sqlite.js
Created October 3, 2023 04:14
cjs esm interop sqlite libsql
// db.mjs
import { createClient } from "@libsql/client";
const config = {
url: "file:local.db",
};
const db = createClient(config);
export default db;
// client.cjs
// const { createRequire } = require("node:module");
// const requireFromUrl = createRequire(__filename);
@bronifty
bronifty / javascript.json
Last active October 9, 2023 12:18
javascript.json globall snippets
{
"log!!": {
"scope": "javascript,typescript,deno,wing,jsx,tsx",
"prefix": "log",
"body": ["console.log($1);", "$2"],
"description": "log!!"
},
"JSONStringify!!": {
"prefix": "JSONStringify",
"scope": "javascript,typescript,deno,wing,jsx,tsx",
#!/bin/bash
# bash variables
export NATS_SERVER_VERSION="2.10.9"
export NATS_CLI_VERSION="0.1.1"
export GOLANG_VERSION="1.21.6"
export ARCH="$(uname -m)"
sudo apt-get update && sudo apt-get install git \
&& sudo apt-get install unzip \
&& sudo apt-get update \
@bronifty
bronifty / aws_config
Last active October 2, 2023 16:05
aws configure sso
[default]
sso_session = wing
sso_account_id = 644023290801
sso_role_name = AdministratorAccess
region = us-east-1
output = json
[sso-session wing]
sso_start_url = https://d-9a670195a1.awsapps.com/start#
sso_region = us-east-2
sso_registration_scopes = sso:account:access
@bronifty
bronifty / index.ts
Created August 5, 2023 00:01 — forked from trvswgnr/SyncService.test.ts
daxxer challenge 2
class SyncService {
private processing = false;
constructor(
private bService: IBService,
private monitorService: IMonitorService,
private logService: ILogService,
private userCache: ICacheService<UserId>,
private idempotencyKeys: ICacheService<EventId>,
private queue: IQueueService<EventFromA>,
aws s3 ls s3://bronifty.xyz.target/ --recursive | awk '{print $4}' | xargs -I {} aws s3 rm s3://bronifty.xyz.target/{}
@bronifty
bronifty / shebang
Last active September 1, 2023 15:33
#!/bin/bash
apt-get update
apt-get install unzip
ssh-keygen -t rsa -f /root/.ssh/id_rsa -N '' -q
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
curl -LO "https://dl.k8s.io/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl.sha256"
echo "$(cat kubectl.sha256) kubectl" | sha256sum --check
install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash
curl -fsS https://packages.fluvio.io/v1/install.sh | bash
@bronifty
bronifty / Makefile
Created December 26, 2022 18:34
Makefile to run MySQL in Docker and populate a products table
#.PHONY: refers to a target that is not a file
.PHONY: all mysql sleep populate show
#all: signifies everything that will run when you run make
all: mysql sleep populate show
mysql:
docker run -d -p 3306:3306 \
-e MYSQL_ROOT_PASSWORD=password \
-e MYSQL_USER=user \
-e MYSQL_PASSWORD=password \
@bronifty
bronifty / multipartupload.py
Created November 13, 2022 02:03
aws boto3 multipart upload python script
import argparse
import boto3
import json
import multiprocessing
# Starts Multipart Upload
def start_upload(bucket, key):
s3_client = boto3.client('s3')
response = s3_client.create_multipart_upload(
@bronifty
bronifty / .gitattributes
Created November 12, 2022 20:33
.gitattributes for git lfs
# text
*.csv filter=lfs diff=lfs merge=lfs -text
*.xlsx filter=lfs diff=lfs merge=lfs -text
*.docx filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
# images
*.jpeg filter=lfs diff=lfs merge=lfs -text
*.jpg filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.gif filter=lfs diff=lfs merge=lfs -text