Skip to content

Instantly share code, notes, and snippets.

View snahor's full-sized avatar

Hans Roman snahor

  • Wakanda
View GitHub Profile
@lukestanley
lukestanley / be_nice.py
Last active February 13, 2024 07:20
LangChain spicy comment detox loop using Anthropic
import json
import time
from langchain.chat_models import ChatAnthropic
from langchain.schema import HumanMessage
FAST = "claude-instant-1"
GOOD = "claude-1.3"
model = GOOD
@gangsta
gangsta / hashicorp_vault_basics.md
Last active February 15, 2023 21:19
Get Started with HashiCorp Vault Presentation Demo Document

Setup

# Install
curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo apt-key add -
sudo apt-add-repository "deb [arch=amd64] https://apt.releases.hashicorp.com $(lsb_release -cs) main"
sudo apt-get update -y
sudo apt-get install vault -y

# Start
@niklaskorz
niklaskorz / Caddyfile
Created November 19, 2022 12:24
rheinneckar.social caddy config
www.rheinneckar.social {
redir https://rheinneckar.social{uri}
}
rheinneckar.social {
encode zstd gzip
reverse_proxy /api/v1/streaming* 127.0.0.1:4000
reverse_proxy 127.0.0.1:3000
}
@mholt
mholt / keypairs.js
Created June 25, 2021 20:07
Generate key pairs and PEM-encode them using vanilla JS and browser Crypto API
//
// Convert an ArrayBuffer into a string.
// From https://developers.google.com/web/updates/2012/06/How-to-convert-ArrayBuffer-to-and-from-String
function arrayBufToString(buf) {
return String.fromCharCode.apply(null, new Uint8Array(buf));
}
function pemEncode(label, data) {
const base64encoded = window.btoa(data);
@bpsib
bpsib / BBC-Radio-HLS.m3u
Last active April 15, 2024 13:47 — forked from stengland/BBC-Radio.m3u
BBC Radio Streams
#EXTM3U
#EXTINF:-1,BBC - Radio 1
http://as-hls-ww-live.akamaized.net/pool_904/live/ww/bbc_radio_one/bbc_radio_one.isml/bbc_radio_one-audio%3d96000.norewind.m3u8
#EXTINF:-1,BBC - Radio 1Xtra
http://as-hls-ww-live.akamaized.net/pool_904/live/ww/bbc_1xtra/bbc_1xtra.isml/bbc_1xtra-audio%3d96000.norewind.m3u8
#EXTINF:-1,BBC - Radio 1Dance
http://as-hls-ww-live.akamaized.net/pool_904/live/ww/bbc_radio_one_dance/bbc_radio_one_dance.isml/bbc_radio_one_dance-audio%3d96000.norewind.m3u8
#EXTINF:-1,BBC - Radio 1Relax
http://as-hls-ww-live.akamaized.net/pool_904/live/ww/bbc_radio_one_relax/bbc_radio_one_relax.isml/bbc_radio_one_relax-audio%3d96000.norewind.m3u8
#EXTINF:-1,BBC - Radio 2
@seratch
seratch / go.mod
Last active August 14, 2023 16:16
Slack Socket Mode in Go
module socket-mode-app
go 1.15
require github.com/slack-go/slack v0.8.0
@nevesnunes
nevesnunes / set-tmux-title.sh
Created July 6, 2020 12:55 — forked from florianbeer/set-tmux-title
Set tmux pane title to short hostname on ssh connections
ssh() {
# grep -w: match command names such as "tmux-2.1" or "tmux: server"
if ps -p $$ -o ppid= \
| xargs -i ps -p {} -o comm= \
| grep -qw tmux; then
# Note: Options without parameter were hardcoded,
# in order to distinguish an option's parameter from the destination.
#
# s/[[:space:]]*\(\( | spaces before options
# \(-[46AaCfGgKkMNnqsTtVvXxYy]\)\| | option without parameter
# Cluster management tools.
# See https://github.com/grampelberg/k8s-clusters for updates and documentation.
export CLUSTER_NAME ?= $(shell cat tmp/current 2>/dev/null || echo $$(whoami)-dev)
export MACHINE_TYPE ?= n1-standard-2
export DISK_SIZE ?= 100
export MAX_NODES ?= 10
export NETWORK ?= dev
export PROJECT ?= foobar
export VERSION ?= latest
# Maintainer: Jakub Hajek, jakub.hajek@cometari.com
#
# docker stack deploy -c stack-elastic.yml elastic
#
# The stack creates Elasticsearch cluster consiting of
# - 3 dedicated master nodes in order to keep quorum
# - 4 dedicated data nodes to manage CRUD,
# - 2 coordination node acting like kind of load balancer in multi instance environments
#
#
#!/usr/bin/env bash
set -euo pipefail
IFS=$'\n\t'
set +e
ffmpeg -version > /dev/null 2>&1
if [[ $? -ne 0 ]]; then
echo "ffmpeg must be installed"
exit 1
fi