Skip to content

Instantly share code, notes, and snippets.

View amotl's full-sized avatar

Andreas Motl amotl

  • $PYTHONPATH
View GitHub Profile
@nuxlli
nuxlli / unix_socket_request.sh
Last active January 25, 2024 04:37
Examples of http request in unix domain socket with shell, using socat, netcat or curl
#!/bin/bash
# References
# http://www.computerhope.com/unix/nc.htm#03
# https://github.com/daniloegea/netcat
# http://unix.stackexchange.com/questions/26715/how-can-i-communicate-with-a-unix-domain-socket-via-the-shell-on-debian-squeeze
# http://unix.stackexchange.com/questions/33924/write-inside-a-socket-open-by-another-process-in-linux/33982#33982
# http://www.linuxjournal.com/content/more-using-bashs-built-devtcp-file-tcpip
# http://www.dest-unreach.org/socat/
# http://stuff.mit.edu/afs/sipb/machine/penguin-lust/src/socat-1.7.1.2/EXAMPLES
@matteobertozzi
matteobertozzi / psql-srv.py
Created November 27, 2013 05:17
postgres "server" wire protocol example
# th30z@u1310:[Desktop]$ psql -h localhost -p 55432
# Password:
# psql (9.1.10, server 0.0.0)
# WARNING: psql version 9.1, server version 0.0.
# Some psql features might not work.
# Type "help" for help.
#
# th30z=> select foo;
# a | b
# ---+---
@simon-weber
simon-weber / logutil.py
Created December 8, 2013 03:48
A context manager to temporarily disable all logging in Python that supports previous calls to logging.disable.
from contextlib import contextmanager
import logging
@contextmanager
def all_logging_disabled(highest_level=logging.CRITICAL):
"""
A context manager that will prevent any logging messages
triggered during the body from being processed.
:param highest_level: the maximum logging level in use.
@marvell
marvell / remove_apt_cache
Created May 18, 2015 15:29
Remove APT cache (for Dockerfile)
apt-get clean autoclean
apt-get autoremove --yes
rm -rf /var/lib/{apt,dpkg,cache,log}/
import boto3
from botocore.handlers import disable_signing
resource = boto3.resource('s3')
resource.meta.client.meta.events.register(
'choose-signer.s3.*', disable_signing)
@derhuerst
derhuerst / _.md
Last active June 9, 2024 10:05
List of HAFAS API Endpoints
@mitaki28
mitaki28 / mini-sqlite.cc
Created October 13, 2015 10:59
Simple wrapper for SQLite3
/*
Simple wrapper for SQLite3
This code is Public Domain
**CAUTION**
1. No Warrantry
2. This code is *NOT* safe against SQL Injection.
3. This code can *NOT* handle BLOB or TEXT including '\0'.
4. You should *NOT* use this for production.
@major
major / ca.py
Last active June 1, 2024 10:43
Making a certificate authority (CA) with python cryptography
from cryptography import x509
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives import hashes, serialization
from cryptography.hazmat.primitives.asymmetric import rsa
from cryptography.x509.oid import NameOID
import datetime
import uuid
one_day = datetime.timedelta(1, 0, 0)
private_key = rsa.generate_private_key(
public_exponent=65537,
@max-mapper
max-mapper / readme.md
Last active March 16, 2023 15:18
Video stabilization using VidStab and FFMPEG (Mac OS X)

Video stabilization using VidStab and FFMPEG

Examples here use the default settings, see the VidStab readme on GitHub for more advanced instructions.

Here's an example video I made

Install ffmpeg with the vidstab plugin from homebrew

brew install ffmpeg --with-libvidstab