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 / 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/vue@2.6.11/dist/vue.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/jsqr@1.3.1/dist/jsQR.js"></script>
<script src="https://cdn.jsdelivr.net/npm/qrcode-generator@1.4.4/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"
@korc
korc / README.md
Last active April 17, 2020 20:16
Video chat/screenshare web app over IRC

Video chat/screenshare web app over IRC

  • alpha release, expect bugs, like
    • can't join to on-going session
    • if video receive fails (for example due to frame drop), need to restart video at source
    • no audio
    • others

suggested setup

@korc
korc / enc_http_payload.go
Last active November 26, 2019 21:37
Encrypt HTTP (ex PUT/POST) payload
package main
import (
"bytes"
"flag"
"io"
"log"
"net/http"
"net/http/httputil"
"net/url"
@korc
korc / build-esteid-lxc.sh
Last active June 1, 2019 00:56
Building Estonian ID card capable Ubuntu/Bionic LXC container on Debian (stretch)
#!/bin/sh
set -e
test "$(id -u)" = "0" || exec sudo "$0" "$@"
: "${SUDO_UID:=1000}" "${SUDO_GID:=1000}"
: "${dist:=bionic}"
: "${lxc_name:=esteid-$dist}"
: "${rootfs:=/var/lib/lxc/$lxc_name/rootfs}"
#!/bin/sh
find_scanner() {
echo -n "Scanning for scanners.." >&2
scanimage -f %d
echo "OK." >&2
}
test ! "x$1" = "x-h" || {
echo "Usage: ${0##*/} [<scanner>]" >&2
<!DOCTYPE html>
<html>
<head>
<title>Encrypt and Share</title>
<script src="https://unpkg.com/ace-builds@1.3.3/src-noconflict/ace.js" charset="utf-8"></script>
<script src="https://unpkg.com/ace-builds@1.3.3/src-noconflict/mode-markdown.js" charset="utf-8"></script>
<script src="https://unpkg.com/qrcode@1.2.0/build/qrcode.js" charset="utf-8"></script>
<script>
"use strict";
@korc
korc / run1.sh
Last active May 11, 2018 18:54
Usage: go run websrv.go -listen :8080 # -help for more options.
#!/bin/bash
wget https://gist.githubusercontent.com/korc/a4e77451825737ef1fd2c491bd74246e/raw/websrv.go
go get -u golang.org/x/{crypto/acme/autocert,net/{webdav,websocket}}
go build websrv.go
sudo setcap cap_net_bind_service,cap_sys_chroot=ep websrv
mkdir -p data/uploads
./websrv -map /=file:/var/www/html -map /data/=webdav:$PWD/data/uploads -auth Basic:dGVzdDp0ZXN0

Build SFS-bootable linux files from sources

Requirements for building

  • aufs support (grep -w aufs /proc/filesystems)
    • might be included in linux-image-extra-* packages
  • To build SFS files you need:
    • python and python-crypto
    • lxc-start, lxc-info and friends (lxc or lxc1 package)
  • mksquashfs (squashfs-tools package)