Skip to content

Instantly share code, notes, and snippets.

View debedb's full-sized avatar

Gregory Golberg debedb

View GitHub Profile
@debedb
debedb / sync-mcp-claude-desktop-to-claude-code.sh
Created March 1, 2025 06:01
Sync Claude Desktop MCP settings with Claude Code
#!/bin/bash
CONFIG_FILE="$HOME/Library/Application Support/Claude/claude_desktop_config.json"
# Check if the config file exists
if [ ! -f "$CONFIG_FILE" ]; then
echo "Config file not found: $CONFIG_FILE"
exit 1
fi
@debedb
debedb / pg-to-postgres.py
Last active January 26, 2025 00:29
Postgres to Parquet
import psycopg2
import pandas as pd
import pyarrow.parquet as pq
import pyarrow as pa
import glob
# PostgreSQL connection
conn_pg = psycopg2.connect(
host="db_host,
database="drumwave",
@debedb
debedb / check-actions-for-org.sh
Last active December 12, 2024 06:28
Check actions in all repos under an org
#!/bin/bash
# Variables
GITHUB_ORG=reddrummer
GITHUB_TOKEN=$DRUMWAVE_GITHUB_TOKEN
# Set GitHub CLI authentication
export GH_TOKEN=$GITHUB_TOKEN
# Check if `gh` CLI is installed
@debedb
debedb / dependabot.yml
Created October 15, 2024 05:20
GitHub action to dependencies to dependabot for Python, Node and Java (gradle)
name: Scan for CVEs
on:
schedule:
- cron: '0 * * * *'
workflow_dispatch:
repository_dispatch:
types:
- sync-prs
@debedb
debedb / ec2-memory-cloudwatch.sh
Last active April 5, 2024 23:52
cloudwatch-agent-sucks
#!/bin/bash
# set -x
inst_id=$(ec2metadata --instance-id)
while :
do
used_megs=$(free --mega | awk 'NR!=1 {print $3}' | head -1)
aws cloudwatch put-metric-data \
--region us-west-2 \
@debedb
debedb / subarrays_equal_sum.py
Created May 9, 2023 02:50
Find subarrays with equal sum
def findEqualParts(remArr, half, s, d=0):
for i in range(len(remArr)):
remArr2 = remArr[:]
diff = s - remArr2[i]
# print(f"Entering findEqualParts({remArr}, {half}, {s}; diff is {diff}, i is {i}, d is {d}")
if diff > 0:
half2 = half[:]
half2.append(remArr2[i])
s2 = s - remArr[i]
del remArr2[i]
@debedb
debedb / get-cloud-resources.sh
Created March 21, 2023 19:53
Primitive resource gathering from GCP
#!/bin/bash
# Parse the output and generate a Deployment Manager configuration file
echo "resources:" > config0.yaml
echo "outputs:" > outputs0.yaml
# List all Cloud Run services and their attributes
services=$(gcloud run services list --format="csv(NAME, REGION, IMAGE)" --quiet | tail -n+2)
@debedb
debedb / context.go
Created November 25, 2022 20:32
Go: Contexts
package main
import (
"context"
"fmt"
"sync"
"time"
)
func withCancel() {
@debedb
debedb / faafco.go
Last active November 25, 2022 21:26
Go: functions as first-class objects, variadic functions and generics
package main
import "fmt"
func plus[T int | float32](i1 T, i2 T) T {
return i1 + i2
}
func minus[T int | float32](i1 T, i2 T) T {
return i1 - i2
@debedb
debedb / channels.go
Last active November 25, 2022 21:05
Go: Goroutines and channels
package main
import (
"fmt"
"strconv"
"sync"
"sync/atomic"
)
// No deadlock on all sleeping, etc.