Skip to content

Instantly share code, notes, and snippets.

View Schnouki's full-sized avatar
🏠
Working from home

Thomas Jost Schnouki

🏠
Working from home
View GitHub Profile
@Schnouki
Schnouki / comfy-auth.lua
Created August 13, 2014 07:20
SSL client certificate / HTTP basic auth -- dual-method authentication for lighttpd
-- comfy-auth.lua
-- Copyright (c) 2014, Thomas Jost <[email protected]>
--
-- Permission to use, copy, modify, and/or distribute this software for any
-- purpose with or without fee is hereby granted, provided that the above
-- copyright notice and this permission notice appear in all copies.
--
-- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
-- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
-- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
@Schnouki
Schnouki / popcorntime-vpn.sh
Last active November 12, 2024 00:33
OpenVPN for a single application using network namespaces -- helper scripts
#!/usr/bin/env zsh
# Initialize VPN
sudo vpnns up
sudo vpnns start_vpn
# Popcorn time!
sudo ip netns exec frootvpn sudo -u $USER popcorntime
# Cleanup
@Schnouki
Schnouki / git-branch-last-commit.zsh
Created July 28, 2015 09:58
A script to show the last commit in each branch.
#!/usr/bin/env zsh
git branch "$@" | grep --line-buffered -v '/HEAD' | while read branch; do
git log -n1 --format="format:%C(auto)%D%Creset - %s %Cgreen(%ar)%Creset %C(bold blue)<%an>%n" "${branch/* /}"
done
@Schnouki
Schnouki / middleware.py
Last active February 10, 2021 02:39
WhiteNoiseMiddleware that restrics access to sourcemaps to authorized users
import fnmatch
from django.conf import settings
from django.http import HttpResponseForbidden
from whitenoise.middleware import WhiteNoiseMiddleware
class AuthenticatedWhiteNoiseMiddleware(WhiteNoiseMiddleware):
def __init__(self, *args, **kwargs):
@Schnouki
Schnouki / start-gitlab-runner.service
Created October 25, 2018 07:31
Start and stop gitlab-runner with systemd timers
[Unit]
Description=Start gitlab-runner every morning
[Service]
Type=oneshot
ExecStart=/usr/bin/systemctl start gitlab-runner.service
diff --git src/goaccess.c src/goaccess.c
index 9cd14bb..1057acb 100644
--- src/goaccess.c
+++ src/goaccess.c
@@ -1262,36 +1262,45 @@ set_pipe_stdin (void)
{
char *term = NULL;
FILE *pipe = stdin;
- int fd1, fd2;
+ int term_fd = -1;
@Schnouki
Schnouki / check.py
Created April 26, 2023 12:47
sqs-worker-pool healthcheck test scripts
#!/usr/bin/env python
import socket
import sys
def main():
socket_path = sys.argv[1]
with socket.socket(socket.AF_UNIX) as s:
s.connect(socket_path)