Skip to content

Instantly share code, notes, and snippets.

View JKatzwinkel's full-sized avatar

JKatzwinkel

  • @staatsbibliothekBerlin
  • Berlin
View GitHub Profile
@thesamesam
thesamesam / xz-backdoor.md
Last active July 25, 2024 09:00
xz-utils backdoor situation (CVE-2024-3094)

FAQ on the xz-utils backdoor (CVE-2024-3094)

This is a living document. Everything in this document is made in good faith of being accurate, but like I just said; we don't yet know everything about what's going on.

Background

On March 29th, 2024, a backdoor was discovered in xz-utils, a suite of software that

ZSH CheatSheet

This is a cheat sheet for how to perform various actions to ZSH, which can be tricky to find on the web as the syntax is not intuitive and it is generally not very well-documented.

Strings

Description Syntax
Get the length of a string ${#VARNAME}
Get a single character ${VARNAME[index]}

WSL 2 Cisco AnyConnect Networking Workaround

Overview

WSL 2 uses a Hyper-V Virtual Network adapter. Network connectivity works without any issue when a VPN is not in use. However when a Cisco AnyConnect VPN session is established Firewall Rules and Routes are added which breaks connectivity within the WSL 2 VM. This issue is tracked WSL/issues/4277

Below outline steps to automatically configure the Interface metric on VPN connect and update DNS settings (/etc/resolv.conf) on connect/disconnect.

Manual Configuration

Set Interface Metrics

@magnetikonline
magnetikonline / README.md
Last active June 11, 2024 01:05
Creating a 'run once' systemd unit.

Creating a 'run once' systemd unit

Systemd unit template which calls a script exactly once upon startup and keeps unit status active after script finishes.

Unit file placed in /etc/systemd/system and enabled with:

$ sudo systemctl enable runonce.service
$ sudo systemctl start runonce.service
@alukach
alukach / app.yaml
Last active July 24, 2024 13:54
An example Github Actions for Python + Pipenv + Postgres + Pyright
# .github/workflows/app.yaml
name: My Python Project
on: push
jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: 10
services:
@thebouv
thebouv / gzip-flask.py
Created December 30, 2019 00:40
python flask gzip example
import gzip, functools
from io import BytesIO as IO
from flask import after_this_request, request
def gzipped(f):
@functools.wraps(f)
def view_func(*args, **kwargs):
@after_this_request
def zipper(response):
accept_encoding = request.headers.get('Accept-Encoding', '')
@phattv
phattv / gcp_deploy.md
Created November 30, 2019 19:43
How to use Docker to deploy an image to Google Cloud Platform
@mikegerber
mikegerber / jpageviewer-profile.sh
Last active July 13, 2021 15:18
jpageviewer alias/function that looks for a mets.xml, i.e. in a OCR-D workspace. For use in `~/.zshrc` or similiar.
_jpageviewer_jar=~/opt/jpageviewer/JPageViewer.jar
if [ -e "$_jpageviewer_jar" ]; then
jpageviewer() {
# --resolve-dir defaults to the file's directory
_jpageviewer_resolve_dir=`dirname "$1"`
# ... unless a mets.xml file exists one directory down (OCR-D workspace)
if [ -e "$_jpageviewer_resolve_dir"/../mets.xml ]; then
_jpageviewer_resolve_dir="$_jpageviewer_resolve_dir"/..
fi
@marchpig
marchpig / JacocoPrinter.groovy
Last active March 21, 2021 21:29
How to display Jacoco summary in Maven console output
def reportFile = new File("target/site/jacoco/index.html")
if (!reportFile.exists() || !reportFile.canRead()) {
println "[JacocoPrinter] Skipped due to missing report file."
return
}
reportFile.withReader('UTF-8') { reader ->
def html = getParser().parseText(reader.readLine())
def totalRow = html.body.table.tfoot.tr

Screen Quick Reference

Wait a minute, why would anyone use 'screen', and what is it anyway?

Well, because it's both AWESOME and FUN!!

It lets you keep your own session running on all the servers you already use, and chances are, it's probably already installed and waiting for you! (since 1987!)

Basic

| Description | Command |