Skip to content

Instantly share code, notes, and snippets.

View sthagen's full-sized avatar
🏔️
above snow inside ☁️

Stefan Hagen sthagen

🏔️
above snow inside ☁️
View GitHub Profile
@sthagen
sthagen / gist:a8324e078d0b5bffbb788e3ed8b00317
Created January 22, 2023 12:28 — forked from ajakk/gist:f5aece4564079513f09f6066238ed6aa
Communication with MaherAzzouzi in #1 of MaherAzzouzi/CVE-2022-37703
I attempted to get MaherAzzouzi to report their apparent information
disclosure vulnerability to Amanda upstream via an issue in their
CVE-2022-37703 repository. They apparently seemed to think that MITRE
automatically reports issues to upstreams, which is not the
case. Eventually, they deleted the issue after threatening to
irresponsibly disclose two local privilege escalations in Amanda, all
without any apparent attempt to notify upstream. As far as I can tell,
that hasn't happened yet.
I've asked Github to make the content of the issue public for
@sthagen
sthagen / vim_crash_course.md
Created July 16, 2022 09:38 — forked from dmsul/vim_crash_course.md
Vim Crash Course

NOTE: Specific examples given for options, flags, commands variations, etc., are not comprehensive.

NORMAL MODE

Vim has 2 main "modes", that chance the behavior of all your keys. The default mode of Vim is Normal Mode and is mostly used for moving the cursor and navigating the current file.

Some important (or longer) commands begin with ":" and you will see the text you enter next at the bottom left of the screen.

:q[uit] - quit (the current window of) Vim. ("Window" here is internal to Vim, not if you have multiple OS-level windows of Vim open at once.)
:q! - force quit (if the current buffer has been changed since the last save)
:e[dit] {filename} - read file {filename} into a new buffer.

@sthagen
sthagen / spacemacs-keybindings.md
Created May 15, 2022 13:51 — forked from rnwolf/spacemacs-keybindings.md
spacemacs keybindings that i need to learn
@sthagen
sthagen / timed_cache.py
Created March 1, 2022 13:18 — forked from Morreski/timed_cache.py
Python lru_cache with timeout
from datetime import datetime, timedelta
import functools
def timed_cache(**timedelta_kwargs):
def _wrapper(f):
update_delta = timedelta(**timedelta_kwargs)
next_update = datetime.utcnow() + update_delta
# Apply @lru_cache to f with no cache size limit
@sthagen
sthagen / wordle.md
Created February 6, 2022 18:50 — forked from huytd/wordle.md
Wordle in less than 50 lines of Bash

image

How to use:

./wordle.sh

Or try the unlimit mode:

@sthagen
sthagen / max_queue_size_pool.py
Created January 17, 2022 08:47 — forked from noxdafox/max_queue_size_pool.py
This code snippet shows how to wrap a concurrent.futures.Executor class to provide a limited queue size.
from threading import BoundedSemaphore
from concurrent.futures import ProcessPoolExecutor
class MaxQueuePool:
"""This Class wraps a concurrent.futures.Executor
limiting the size of its task queue.
If `max_queue_size` tasks are submitted, the next call to submit will block
until a previously submitted one is completed.
import os
from datetime import datetime, timedelta
from typing import Any, Dict, Generator, List, Union
import requests
# Optional - to connect using OAuth credentials
from oauthlib.oauth1 import SIGNATURE_RSA
class JiraClient:
def __init__(
@sthagen
sthagen / geo_interface.rst
Created March 6, 2020 21:19 — forked from sgillies/geo_interface.rst
A Python Protocol for Geospatial Data

Author: Sean Gillies Version: 1.0

Abstract

This document describes a GeoJSON-like protocol for geo-spatial (GIS) vector data.

Introduction

@sthagen
sthagen / go-shebang-story.md
Created October 5, 2019 07:02 — forked from posener/go-shebang-story.md
Story: Writing Scripts with Go

Story: Writing Scripts with Go

This is a story about how I tried to use Go for scripting. In this story, I’ll discuss the need for a Go script, how we would expect it to behave and the possible implementations; During the discussion I’ll deep dive to scripts, shells, and shebangs. Finally, we’ll discuss solutions that will make Go scripts work.

Why Go is good for scripting?

While python and bash are popular scripting languages, C, C++ and Java are not used for scripts at all, and some languages are somewhere in between.

name: Elixir CI
on: push
jobs:
build:
runs-on: ubuntu-latest
container: