Skip to content

Instantly share code, notes, and snippets.

View faun's full-sized avatar
🌵

Faun faun

🌵
View GitHub Profile
@mattlord
mattlord / proto_examples.txt
Last active January 25, 2024 17:34
vtctlclient and etcdctl examples
❯ vtctldclient GetTablets
zone1-0000000100 commerce 0 replica localhost:15100 localhost:17100 [] <null>
zone1-0000000101 commerce 0 primary localhost:15101 localhost:17101 [] 2023-09-28T16:37:49Z
zone1-0000000102 commerce 0 rdonly localhost:15102 localhost:17102 [] <null>
zone1-0000000200 customer 0 primary localhost:15200 localhost:17200 [] 2023-09-28T16:39:19Z
zone1-0000000201 customer 0 replica localhost:15201 localhost:17201 [] <null>
zone1-0000000202 customer 0 rdonly localhost:15202 localhost:17202 [] <null>
❯ etcdctl get --prefix /vitess/zone1/tablets/zone1-0000000100/Tablet -w protobuf | protoc --proto_path=${HOME}/git/vitess/proto --decode=topodata.Keyspace topodata.proto
1 {
@mscoutermarsh
mscoutermarsh / DR deploy example.yml
Last active July 1, 2023 19:09
GitHub Actions + PlanetScale example. Get DR number and deploy it.
steps:
- name: checkout
uses: actions/checkout@v3
- name: Setup pscale
uses: planetscale/setup-pscale-action@v1
- name: Get Deploy Requests
if: github.event.pull_request.merged == true
env:
PLANETSCALE_SERVICE_TOKEN_ID: ${{ secrets.PLANETSCALE_SERVICE_TOKEN_ID }}
PLANETSCALE_SERVICE_TOKEN: ${{ secrets.PLANETSCALE_SERVICE_TOKEN }}
@Lanny
Lanny / README.md
Created June 28, 2021 16:41
File Hierarchy Preview

Outputs a limited file tree rooted at the current directory which highlights the position of the argument within the tree. Originally intended for FZF like so:

fzf --preview 'ptf.py {}'

Screenshot:

screenshot

@wlib
wlib / LICENSE
Last active April 30, 2024 17:07
Run a shell script with bash, line-by-line, prompted on each command. Useful for running unknown scripts or debugging. Not a secure substitute for understanding a script beforehand.
MIT License
Copyright (c) 2021 Daniel Ethridge
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@MelbourneDeveloper
MelbourneDeveloper / Stuff That Software Developers Do.md
Last active April 15, 2024 12:30
Stuff That Software Developers Do

Stuff That Software Developers Do

This is a list of stuff that the average software developer does from week to week

Coding

  • Code design
  • Refactoring
  • Algorithms
  • Profiling
  • Code reviews
  • Building frameworks
@jedna
jedna / entrypoint.sh
Created August 3, 2020 08:52
Simple bash live reload for Go
#!/bin/bash
SERVER=/go/bin/api
# create directory for Delve logs, we use it to know that Delve
# debugger is running
mkdir -p /tmp/dlv_log
runServer() {
echo Running server
@nileshtrivedi
nileshtrivedi / home-server.md
Last active January 10, 2024 06:30
Home Server setup: Raspberry PI on Internet via reverse SSH tunnel

Raspberry Pi on Internet via reverse SSH tunnel

HackerNews discussed this with many alternative solutions: https://news.ycombinator.com/item?id=24893615

I already have my own domain name: mydomain.com. I wanted to be able to run some webapps on my Raspberry Pi 4B running perpetually at home in headless mode (just needs 5W power and wireless internet). I wanted to be able to access these apps from public Internet. Dynamic DNS wasn't an option because my ISP blocks all incoming traffic. ngrok would work but the free plan is too restrictive.

I bought a cheap 2GB RAM, 20GB disk VM + a 25GB volume on Hetzner for about 4 EUR/month. Hetzner gave me a static IP for it. I haven't purchased a floating IP yet.

VIM-GO

Plugin https://github.com/fatih/vim-go
Tutorial https://github.com/fatih/vim-go-tutorial
Vimrc https://github.com/fatih/dotfiles/blob/master/vimrc

Run

Commands

  • File :GoRun %
  • Package :GoRun
  • Debug :GoDebugStart
@rwuwon
rwuwon / mosh.md
Last active August 22, 2022 19:21
Connect to a Google Cloud Compute Engine using Mosh (mobile shell)

Connect to a Google Cloud Compute Engine using Mosh (mobile shell)

Mosh is a great way to overcome lag and flakey connection issues when accessing remote terminals over SSH: https://mosh.org/

Unfortunately, there's still not a lot of clear documentation for "idiots" because a lot of the existing guides assume a) "it just works", or b) you're already skilled enough to set everything up from scratch (assumed knowledge/use cases).

One of the problems I ran into for quite a long time yesterday was getting the darn thing to connect to my Google Cloud instance. I kept running into the mosh: Nothing received from server on UDP port 60001. [To quit: Ctrl-^ .] error (by the way - to quit, you have to press . after Ctrl-^ - it's not just Ctrl-^, there is a dot there too!)

FAQs and the like made vague spartan references to NATs, firewalls, iptables and the like and I tried out various commands and configurations on the se

@nikmd23
nikmd23 / TransformStream.js
Last active April 9, 2020 20:57
Basic Implementation of a Transform (Pass-through) Stream
function TransformStream() {
var readableController,
writableController,
readable = new ReadableStream({
start(controller) {
readableController = controller;
},
cancel(reason) {
writableController.error(reason);
}