Skip to content

Instantly share code, notes, and snippets.

View ricleal's full-sized avatar
☢️
Coding the World a Better Place

Ricardo Ferraz Leal ricleal

☢️
Coding the World a Better Place
View GitHub Profile
@ricleal
ricleal / README-setup-socket-activated-systemd-service.md
Last active January 18, 2023 15:32 — forked from drmalex07/README-setup-socket-activated-systemd-service.md
An example inetd-like socket-activated service. #systemd #inetd #systemd.socket

Linux sockets and system d

Define a socket unit

The key point here is to specify Accept=yes, which will make the socket accept connections (behaving like inetd) and pass only the resulting connection socket to the service handler.

Create /etc/systemd/system/baz.socket:

[Unit]
@ricleal
ricleal / tornado_mongo.py
Created July 15, 2016 14:17 — forked from bootandy/tornado_mongo.py
Very simple sample code of tornado and mongodb
from datetime import datetime
from pymongo.connection import Connection
import tornado.httpserver
import tornado.ioloop
import tornado.options
import tornado.web
from tornado.options import define, options