Skip to content

Instantly share code, notes, and snippets.

View Schnouki's full-sized avatar

Thomas Jost Schnouki

View GitHub Profile
@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)
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 / 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
@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 / 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 / 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 / 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,

Keybase proof

I hereby claim:

  • I am schnouki on github.
  • I am schnouki (https://keybase.io/schnouki) on keybase.
  • I have a public key whose fingerprint is 0E06 6C82 4146 7232 6FB0 61CB 3E0B 0C49 C047 8597

To claim this, I am signing this object:

@Schnouki
Schnouki / movmd.py
Created February 25, 2013 08:20
.mov/.mp4 metadata (date/time) editor
#!/usr/bin/env python3
# -*- mode: python -*-
# This program is free software. It comes without any warranty, to the extent
# permitted by applicable law. You can redistribute it and/or modify it under
# the terms of the Do What The Fuck You Want To Public License, Version 2, as
# published by Sam Hocevar. See http://sam.zoy.org/wtfpl/COPYING for more
# details.
# Some useful resources:
@Schnouki
Schnouki / bc-contributors-per-project.py
Created May 23, 2012 11:37
buddycloud contributors stats
#!/usr/bin/env python3
#%# family=contrib
#%# capabilities=autoconf
from urllib.request import urlopen
import json
import re
import sys