Skip to content

Instantly share code, notes, and snippets.

View sauercrowd's full-sized avatar
🏗️
Building things

Jonas Otten sauercrowd

🏗️
Building things
View GitHub Profile
@sauercrowd
sauercrowd / setup_integration.py
Created October 22, 2024 09:16
Langfuse - llamaindex integrations
# 1. https://docs.llamaindex.ai/en/v0.10.23/examples/callbacks/LangfuseCallbackHandler/#option-1-set-global-llamaindex-handler
from llama_index.core import global_handler, set_global_handler
set_global_handler("langfuse")
langfuse_callback_handler = global_handler
# 2. https://docs.llamaindex.ai/en/v0.10.23/examples/callbacks/LangfuseCallbackHandler/#option-2-use-langfuse-callback-directly
from llama_index.core import Settings
from llama_index.core.callbacks import CallbackManager
from langfuse.llama_index import LlamaIndexCallbackHandler
@sauercrowd
sauercrowd / main.rs
Last active May 18, 2020 21:58
Rust Lua
use rlua::{Function, Lua, Table};
fn main(){
let lua = Lua::new();
lua.context(|lua_ctx| {
let contents = std::fs::read_to_string("parser.lua").expect("Something went wrong reading the file");
// load chunk
lua_ctx.load(&contents).set_name("parser")?.exec()?;
@sauercrowd
sauercrowd / index.html
Last active May 11, 2020 08:36
D3 Earth rotation
<html>
<head>
<script src="https://d3js.org/d3.v5.min.js"></script>
<script src="https://d3js.org/d3-scale-chromatic.v1.min.js"></script>
<script src="https://d3js.org/d3-geo-projection.v2.min.js"></script>
</head>
<body>
<svg id="svg_map" width="1200" height="1000" />
</body>
<script>
@sauercrowd
sauercrowd / gist:f89d81496358a7ed133ddc75362a9b70
Created April 20, 2020 16:03 — forked from kgrz/gist:2880883
Steve Yegge's SOA post

From: https://raw.github.com/gist/933cc4f7df97d553ed89/24386c6a79bb4b31fb818b70b34c5eab7f12e1ff/gistfile1.txt

Stevey's Google Platforms Rant

I was at Amazon for about six and a half years, and now I've been at Google for that long. One thing that struck me immediately about the two companies -- an impression that has been reinforced almost daily -- is that Amazon does everything wrong, and Google does everything right. Sure, it's a sweeping generalization, but a surprisingly accurate one. It's pretty crazy. There are probably a hundred or even two hundred different ways you can compare the two companies, and Google is superior in all but three of them, if I recall correctly. I actually did a spreadsheet at one point but Legal wouldn't let me show it to anyone, even though recruiting loved it.

call plug#begin('~/.vim/plugged') [36/884]
Plug 'airblade/vim-gitgutter', {'do': 'UpdateRemotePlugins'}
Plug 'evanleck/vim-svelte'
Plug 'sakhnik/nvim-gdb', { 'do': ':!./install.sh \| UpdateRemotePlugins' }
Plug 'vim-scripts/taglist.vim'
Plug 'autozimu/LanguageClient-neovim', {
\ 'branch': 'next',
\ 'do': 'bash install.sh',
@sauercrowd
sauercrowd / check.py
Created August 29, 2019 18:47
PyQuil qvm/quilc check
import socket
from pyquil.api import ForestConnection
x = ForestConnection()
# try to connect to qvm port
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
try:
s.connect(('127.0.0.1', 5000))
@sauercrowd
sauercrowd / plot.py
Created April 9, 2018 20:47
Plot dataframe with bokeh
from bokeh.models import ColumnDataSource
from bokeh.palettes import viridis
from bokeh.io import output_notebook, show
def plot(df, title='Prices'):
p = figure(title=title, plot_height=700, plot_width=1300)
output_notebook()
source = ColumnDataSource(df)
positions = df.columns
colors = viridis(len(positions))
@sauercrowd
sauercrowd / nix.sh
Last active March 9, 2018 11:15
Build nix
sudo apt-get install -y build-essential pkg-config libssl-dev libbz2-dev libsqlite3-dev libcurl4-openssl-dev liblzma-dev libseccomp-dev bison flex docbook5-xml
@sauercrowd
sauercrowd / install-broadcom.sh
Last active December 19, 2020 14:56
Install broadcom driver in fedora VM for qubes OS
#!/bin/bash
FEDORA_VERSION=26
wget -O kmod-wl.rpm "https://rpmfind.net/linux/rpmfusion/nonfree/fedora/releases/$FEDORA_VERSION/Everything/x86_64/os/Packages/k/kmod-wl-6.30.223.271-11.fc26.x86_64.rpm"
wget -O broadcom-wl.rpm "https://rpmfind.net/linux/rpmfusion/nonfree/fedora/releases/$FEDORA_VERSION/Everything/x86_64/os/Packages/b/broadcom-wl-6.30.223.271-2.fc26.noarch.rpm"
wget -O akmod-wl.rpm "http://rpmfind.net/linux/rpmfusion/nonfree/fedora/releases/$FEDORA_VERSION/Everything/x86_64/os/Packages/a/akmod-wl-6.30.223.271-11.fc26.x86_64.rpm"
sudo dnf install ./kmod-wl.rpm ./broadcom-wl.rpm ./akmod-wl.rpm
rm ./kmod-wl.rpm ./broadcom-wl.rpm ./akmod-wl.rpm
[
{
"name":"1Live",
"url":"https://www1.wdr.de/radio/1live/index.html",
"image_url":"http://www.janprimke.de//files/1live.png",
"stream_url":"https://wdr-1live-live.sslcast.addradio.de/wdr/1live/live/mp3/128/stream.mp3"
},
{
"name":"Deutschland Radio",
"url":"http://www.deutschlandradio.de/",