Skip to content

Instantly share code, notes, and snippets.

@jskherman
jskherman / chatgpt-telegram-bot-deploy.md
Created March 7, 2023 12:59
Guide to deploying n3d1117's ChatGPT Telegram bot to Fly.io
@belm0
belm0 / article_sc_and_lua_1.md
Last active September 21, 2023 06:37
Structured concurrency and Lua (part 1)

Structured concurrency and Lua (part 1)

John Belmonte, 2022-Sep

I've started writing a toy structured concurrency implementation for the Lua programming language. Some motivations:

  • use it as a simple introduction to structured concurrency from the perspective of Lua (this article)
  • learn the fundamental properties of structured concurrency and how to implement them
  • share code that could become the starting point for a real Lua library and framework

So what is structured concurrency? For now, I'll just say that it's a programming paradigm that makes managing concurrency (arguably the hardest problem of computer science) an order of magnitude easier in many contexts. It achieves this in ways that seem subtle to us—clearly so, since its utility didn't reach critical mass until around 2018[^sc_birth] (just as control structures like functions, if, and while weren't introduced to languages until long after the first compu

@1player
1player / bazarr.docker-compose.yml
Last active February 17, 2024 20:41
Poor man's media centre
# Bazarr downloads subtitles
version: "3.4"
services:
bazarr:
image: linuxserver/bazarr:1.0.5-development
container_name: bazarr
restart: unless-stopped
environment:
- TZ=Europe/London
@AnomalRoil
AnomalRoil / go-switch-bash
Last active July 1, 2022 13:37
The `go switch` function allows you to easily switch you current Go version
# to add to your ~/.bashrc or your ~/.zshrc file. Usage: $ go switch 1.18.1
function go() {
case $* in
switch* )
shift 1
gobindir=$(go env GOBIN)
# adapt to a valid directory at the beginning of your $PATH if you're not on systemd
homebindir=$(systemd-path user-binaries)
go install golang.org/dl/go"$@"@latest
$gobindir/go"$@" download

Schema

Example of a storage agnostic schema layer that can drive queries, graphql, privacy, mutations and other concerns. We'll call it Ent (short for entity).

A Facebook team from Tel Aviv did open-source an Ent framework for Go. It is heavily inspired by the framework used by the rest of the company except that EntGo:

  1. Only supports Go as a target language
  2. Only supports SQL and Gremlin as backends
  3. Schema definitions are written in Go rather than a DSL or something like Yaml.

I never got around to asking them why they didn't use the existing framework.

@zsviczian
zsviczian / meeting-note.md
Last active March 16, 2024 18:57
Daily note taking scripts

<%* /*

*/
const view = app.workspace.activeLeaf.view;
const editor = view.editor;
const curLineNum = editor.getCursor().line;
const curLineText = editor.getLine(curLineNum);
const title = tp.file.title;
const today = title.match(/\d{4}\-\d{2}\-\d{2} .+/) //are we on the DNP?
@DavidWells
DavidWells / github-proxy-client.js
Last active March 15, 2024 08:28
Full Github REST api in 34 lines of code
/* Ultra lightweight Github REST Client */
// original inspiration via https://gist.github.com/v1vendi/75d5e5dad7a2d1ef3fcb48234e4528cb
const token = 'github-token-here'
const githubClient = generateAPI('https://api.github.com', {
headers: {
'User-Agent': 'xyz',
'Authorization': `bearer ${token}`
}
})
@piaverous
piaverous / setup_ssh_agent_with_apple_keychain.sh
Last active April 26, 2022 01:31
A simple bash snippet to add to your .bashrc or .zshrc in order to easily load password protected SSH Keys from the Apple Keychain, and never worry about them again !
###
# SSH keys setup with Apple keychain
###
if [ -z "$SSH_AUTH_SOCK" ] && [ -z "$SSH_AGENT_PID" ]; then
# If no SSH Agent is running, start one and load keys from Apple keychain
eval `ssh-agent -s` &> /dev/null
ssh-add --apple-load-keychain &> /dev/null
else
if [ -z "$(ssh-add -l | grep SHA256)" ]; then
# If agent is running but has no keys, load keys from Apple keychain
@agmm
agmm / obsidian-ios-sync.md
Last active April 22, 2024 09:33
How to sync Obsidian Notes on iOS

⚠️ To prevent data loss make sure you understand how rclone sync and rclone copy work.

How to sync Obsidian Notes on iOS

  1. Download iSH from the AppStore

  2. Open iSH and install rclone and nano with the following command:

apk add rclone nano
@pablodz
pablodz / install_docker_in_ubuntu_21-10.sh
Last active June 17, 2023 20:58
Install Docker in Ubuntu 21.10, Install Dockercompose on Ubuntu 21.10
# [🟨OPTIONAL] Uninstall old docker versions
sudo apt-get remove docker docker-engine docker.io containerd runc
# Refresh latest version
sudo apt-get update
# Install pre-req
sudo apt-get install -y \
apt-transport-https \
ca-certificates \
curl \
gnupg \