Skip to content

Instantly share code, notes, and snippets.

View peterpme's full-sized avatar
🏠
Working from home

Peter Piekarczyk peterpme

🏠
Working from home
View GitHub Profile
@peterpme
peterpme / update-import.ts
Created March 8, 2024 14:52
Update Import
export const parser = "tsx";
const importName = "A";
const importPath = "B";
const updatedImportPath = "C";
export default function transform(file, { jscodeshift: j }, options) {
const source = j(file.source); // Create an AST of the given file
let hasChanged = false; // Flag to track if any changes have been made
const subtitle =
serverPublicKeys.length === 1
? t('cant_find_recovery_phrase2', {
publicKey: formatWalletAddress(serverPublicKeys[0].publicKey),
})
: t('cant_find_recovery_phrase');
@peterpme
peterpme / index.js
Last active July 8, 2023 19:09
Cloudflare Workers + Expo Webhook + Slack Notification. Update SLACK_WEBHOOK_URL & paste this in the worker file
const SLACK_WEBHOOK_URL = "https://hooks.slack.com/services/XXX/YYY/ZZZZZ";
async function sendSlackRequest({ text, blocks }) {
const postToSlack = await fetch(SLACK_WEBHOOK_URL, {
body: JSON.stringify({ text, blocks }),
method: "POST",
headers: { "Content-Type": "application/json" },
});
}
@peterpme
peterpme / App.js
Created December 16, 2022 18:03
SectionList expand/collapse example
import { useState } from 'react';
import {
Text,
View,
StyleSheet,
SectionList,
SafeAreaView,
StatusBar,
Pressable,
} from 'react-native';
@peterpme
peterpme / db.json
Created March 3, 2022 23:36
Postgres Grafana
{
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": "-- Grafana --",
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",
@peterpme
peterpme / one.ts
Created September 21, 2021 15:37
Test gist
function hello() {
console.log("hi");
}
@peterpme
peterpme / testgist.ts
Created September 21, 2021 15:36
TestGist.ts
function hello() {
console.log("hi");
}
@peterpme
peterpme / home-assistant-os-kvm-linux.sh
Last active March 17, 2023 22:10
Home Assistant OS with Ubuntu 20.04 (Linux) using KVM and Nortek USB for Z-Wave / ZHA
## Home Assistant OS (Latest as of July 17th, 2021)
## Installation using Ubuntu 20.04 Server and KVM
## Thanks to:
# https://gist.github.com/dsbaars/82a31303f50da08edb422fdc15031257
# https://community.home-assistant.io/t/install-home-assistant-os-with-kvm-on-ubuntu-headless-cli-only/254941
# /var/lib/libvirt/images/hassos-vm
## Everything lives here
mkdir -vp /var/lib/libvirt/images/hassos-vm && cd /var/lib/libvirt/images/hassos-vm
@peterpme
peterpme / ReactColor.re
Last active October 20, 2020 18:13
React-Color ReasonML Binding
open BsTinycolor;
open Belt;
type colorChange = {
.
"hex": string,
"hsl": TinyColor.hsl,
"hsv": TinyColor.hsv,
"oldHue": float,
"rgb": TinyColor.rgb,
@peterpme
peterpme / fbd.zsh
Created July 30, 2020 04:09
Interactive git branch delete
# fbd - delete git branch (including remote branches)
fbd() {
local branches branch
branches=$(git for-each-ref --count=30 --sort=-committerdate refs/heads/ --format="%(refname:short)") &&
branch=$(echo "$branches" | fzf --multi ) &&
git branch -D $(echo "$branch" | sed "s/.* //" | sed "s#remotes/[^/]*/##")
}
## place this in your ~/.zshrc and make sure you have fzf installed: brew install fzf