Skip to content

Instantly share code, notes, and snippets.

View sloev's full-sized avatar
https://www.buymeacoffee.com/sloev

sloev / Johannes Valbjørn sloev

https://www.buymeacoffee.com/sloev
View GitHub Profile
@sloev
sloev / tree.gd
Created February 12, 2023 19:57
godot parallax
extends TextureRect
var shader_material
var screen_size
func _ready():
screen_size = OS.get_screen_size()
shader_material = self.material
set_process_input(true)
@sloev
sloev / mejeriet.lua
Created October 26, 2022 22:26
vjing with loaf and chataigne
-- create new images
vPlayer1 = of.VideoPlayer()
outputFbo = of.Fbo()
serverTemp = syphon.Server()
serverOutput = syphon.Server()
outputWidth = 1280
outputHeight = 720
previewWidth = 400
@sloev
sloev / hub.go
Created March 1, 2022 09:03
single file broadcast webserver in golang
package hub
import (
"bytes"
"log"
"net/http"
"sync"
"time"
"github.com/gorilla/websocket"
@sloev
sloev / README.md
Last active March 8, 2022 12:03
gpspipe log time with micros and lat lon, python3 only
curl 'https://gist.githubusercontent.com/sloev/5de3ed6bc5d3e78f656029071eb16409/raw/728aee9e9a88281d7bcb398f2408aa5051632c1d/gpslog.py' > ~/gpslog.py 
    
curl 'https://gist.githubusercontent.com/sloev/5de3ed6bc5d3e78f656029071eb16409/raw/728aee9e9a88281d7bcb398f2408aa5051632c1d/gpslog.sh' > ~/gpslog.sh 
    
curl 'https://gist.githubusercontent.com/sloev/5de3ed6bc5d3e78f656029071eb16409/raw/728aee9e9a88281d7bcb398f2408aa5051632c1d/gpslog.service' > ~/gpslog.service

sudo cp ~/gpslog.service /etc/systemd/system/gpslog.service
sudo systemctl enable gpslog.service
@sloev
sloev / kv_store.sh
Created November 25, 2021 07:25
bash key value store using jq
#!/bin/bash
# append-only kv-store using jq as querying mechanism
# author: sloev.github.io
# declare kv store as string
kv_store=""
# append some json to
@sloev
sloev / README.md
Last active November 25, 2021 07:57
highlight psql error

debug psql statements

when you get stuff like this:

5 UTC [1] LOG:  database system is ready to accept connections
db_1                | 2021-11-24 09:58:49.133 UTC [83] ERROR:  invalid input value for enum task_status: "ready" at character 339
db_1                | 2021-11-24 09:58:49.133 UTC [83] STATEMENT:  BEGIN;

its nice to be able to quickly figure out where the error is in the input sql file.

@sloev
sloev / split_videos.py
Last active November 26, 2021 12:33
split_video_and_concat_data
from multiprocessing.dummy import Pool
import subprocess
import tempfile
import logging
import time
import random
import os
from base64 import urlsafe_b64encode
import uuid
import cv2
import csv
import numpy as np
img = cv2.imread("img.png")
data_file = open("data.data", "wb")
csv_file = open("data.csv", "w")
@sloev
sloev / README.md
Last active August 5, 2021 13:11
rtsp -> python opencv -> rtsp
  1. replace INPUT_RTSP_STREAMLINK and OUTPUT_RTSP_STREAMLINK with rtsp://yadayada
  2. pip install opencv-python numpy tqdm
  3. python process_rtsp_to_image.py
  4. bash publish_image_to_rtsp.sh
@sloev
sloev / git_pre_push_hook_to_prevent_master_push_by_accident.md
Last active February 28, 2022 20:10 — forked from ColCh/README.md
Git pre-push hook to confirm pushing to master

Git pre-push hook

It will check if current branch is master, then ask a confirmation, in case of master branch

install

  1. install a recent version of git (https://git-scm.com/download/mac) eg:

$ brew install git