Skip to content

Instantly share code, notes, and snippets.

View korc's full-sized avatar

Lauri Korts-Pärn korc

View GitHub Profile
@korc
korc / .gitignore
Last active October 14, 2024 09:28
Start a simple dockerized stack of ollama / code-server. Run with `docker compose up` and access with browser via http://127.0.0.1:8080
.env
@korc
korc / Dockerfile
Created May 12, 2024 17:02
web interface to sane
FROM python AS builder
RUN apt-get update && \
apt-get install --no-install-recommends -y python-dev-is-python3 libsane-dev && \
find /var/lib/apt/ /var/cache/apt -type f -delete
WORKDIR /src/
RUN pip wheel python-sane
FROM python
@korc
korc / ssh-askpass-pinentry.py
Created August 9, 2023 10:28
ssh-agent wrapper for pinentry
#!/usr/bin/env python3
import subprocess, sys, re
from urllib.parse import quote, unquote
proc = subprocess.Popen(
["pinentry"], stdout=subprocess.PIPE, stdin=subprocess.PIPE, text=True, bufsize=1
)
@korc
korc / pre-install-extension.py
Last active October 22, 2022 08:05
Set up Chrome master_preferences file for Pre-installed Extensions. Cf. https://www.chromium.org/administrators/pre-installed-extensions/
#!/usr/bin/env python3
import sys
import os
import json
args = sys.argv[1:]
if not args:
print(
#!/bin/sh
remote="$1"
test -d "$2" || {
echo "Usage: ${0##*/} <host:port> <cert_dirs..>" >&2
exit 1
}
shift
@korc
korc / i3status-more.sh
Created December 19, 2020 12:16
i3 status bar (cpu) temperature display enhancement
#!/bin/sh
# colorize hardware temperatures for i3status (more red as temp gets closer to crit)
# (shell internal commands only)
## this script expects i3status to give output in the format of "i3bar",
## and having a placeholder with string "TEMPERATURE"
## .config/i3status/config should contain something like this:
# general {
# output_format = "i3bar"
@korc
korc / pkcs11-tls-proxy.go
Last active December 21, 2023 02:46
PKCS11-authenticated TLS socket proxy
package main
import (
"crypto/tls"
"flag"
"fmt"
"io"
"log"
"net"
"net/textproto"
@korc
korc / smtpd-front.go
Created July 4, 2020 03:21
SMTP front-end daemon (w/ SPF check with -spf option)
package main
import (
"crypto/tls"
"flag"
"fmt"
"io"
"log"
"net"
"os"
@korc
korc / qr.html
Last active May 20, 2020 14:39
QR-Code tool
<html>
<head>
<title>QR code tool</title>
<meta
name="viewport"
content="width=device-width, initial-scale=1, shrink-to-fit=no"
/>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/vue.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/jsQR.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/qrcode.js"></script>
@korc
korc / s3proxy.go
Last active April 21, 2020 02:00
S3 proxy test
package main
import (
"bytes"
"crypto/tls"
"crypto/x509"
"flag"
"fmt"
"io"
"io/ioutil"