Skip to content

Instantly share code, notes, and snippets.

View peetzweg's full-sized avatar
🍋

peetzweg/ peetzweg

🍋
View GitHub Profile
@peetzweg
peetzweg / nuke.sh
Created March 27, 2025 14:35
Nuke GitHub Notifications - Mark All as Read
#!/bin/bash
# Script to mark all GitHub notifications as read
# Requires GITHUB_TOKEN environment variable to be set
# Check if GITHUB_TOKEN is set
if [ -z "$GITHUB_TOKEN" ]; then
echo "Error: GITHUB_TOKEN environment variable is not set"
echo "Please set it with: export GITHUB_TOKEN=your_github_token"
exit 1
fi
function repo() {
# Save current directory
local cwd=$(pwd)
# Change to given directory
if [[ -n "$1" ]]; then
cd $1
fi
local remote=$(git config --get remote.origin.url)
@peetzweg
peetzweg / etherscan.sh
Created November 10, 2023 15:56
etherscan lookup shell function
# add this to your shell init code, i.e. .zshrc
function etherscan() {
url="https://etherscan.io"
if [[ -z "$1" ]]; then
open $url
else
case ${#1} in
42) # 42 chars => account address
open "${url}/address/${1}"
@peetzweg
peetzweg / issues.zsh
Created March 29, 2023 15:11
`zsh` function to open the current directories GitHub issues page. It extracts repository name and owner from `git config --get remote.origin.url`.
function issues() {
local remote=$(git config --get remote.origin.url)
local repo=$(echo $remote | sed 's/.*github.com[:/]\(.*\).git/\1/')
local url="https://github.com/${repo}/issues"
echo $url
open $url
}
/*
# Query the OpenAI API
- Prompts the user for an OPENAI_API_KEY
- Prompts the user for a prompt to send to OpenAI
- Sends the prompt to OpenAI
- Displays the response from OpenAI in the built-in editor
*/
// Name: OpenAI Playground
BEGIN MESSAGE.
6RWRPDhd8eBIrVB AO8mtW3IvgSAmjt bqwx3aajEWGQHik oty4A5bUwnTIRIk
mnyYLYSZUzxtBp7 5RqimeYSY5HTCKq 6Xr2MZHgg4UNQDZ l9vo1ZoJjfbYIco
8NlcsQGTVOhulqf o1Jcs5GVRLtka3i dCrOT3ldBQ4JChk FDjlNp9Qbe59ou8
UcQnDInpTuGTfXz XhrVcSriUzXxLwH yS2iD.
END MESSAGE.
local modifier = {"alt", "cmd"}
local homeDir = os.getenv("HOME")
local sounds = {
[1] = "mgs.mp3",
[2] = "wow.mp3",
[3] = "nice.m4a",
[4] = "LennartLache.wav",
[5] = "dumm.m4a",
[9] = "boah_alta_geil.mp3",
@peetzweg
peetzweg / DestructureWithInterface.tsx
Created September 4, 2020 11:33
Destructure Components Props using Interfaces
import React from 'react';
import { TextInput, TextInputProps } from 'react-native';
import styled from 'styled-components/native';
import { ColorProps, SpaceProps, color, compose, space } from 'styled-system';
interface WrapperProps extends ColorProps, SpaceProps {
// ColorProps will et al. add `bg`, `backgroundColor` props
// SpaceProps => `margin`, `padding`, `paddingTop` etc.
}
@peetzweg
peetzweg / HammerspoonColorPicker.lua
Last active July 26, 2020 17:04
Hammerspoon Color Picker Script
local modifier = {"alt"}
function rgbToHex(red, green, blue)
return "#" .. string.format("%x", red) .. string.format("%x", green) ..
string.format("%x", blue)
end
function hslToRgb(h, s, l)
if s == 0 then return l, l, l end
local function to(p, q, t)