Skip to content

Instantly share code, notes, and snippets.

View alexryan's full-sized avatar

Alex Ryan alexryan

  • Mountain View, CA
View GitHub Profile
@drmalex07
drmalex07 / README-python-service-on-systemd-activated-socket.md
Last active January 13, 2024 12:53
An example network service with systemd-activated socket in Python. #systemd #python #socket #socket-activation

README

The example below creates a TCP server listening on a stream (i.e. SOCK_STREAM) socket. A similar approach can be followed to create a UDP server on a datagram (i.e. SOCK_DGRAM) socket. See man systemd.socket for details.

An example server

Create an simple echo server at /opt/foo/serve.py.

@openfly
openfly / PS1 Example
Created April 4, 2013 03:36
A cool bash shell prompt that displays emoticons that match up to exit status of last ran command.
#!/bin/bash
function __RETURN_CODE {
RETCODE=$?
case $RETCODE in
0) RETSTR=" 😈 " ;;
1) RETSTR=" 😭 " ;;
2) RETSTR=" 😱 " ;;