Skip to content

Instantly share code, notes, and snippets.

View ricferr's full-sized avatar

Ricardo Ferreira ricferr

View GitHub Profile
@ricferr
ricferr / gist:90583f608f0b0ae9c3cf6833be04ab85
Created May 24, 2018 09:13
How to create a systemd service for python script with virtualenv
[Unit]
Description=Some description
After=network.target
[Service]
Type=simple
User=user
WorkingDirectory=/home/user/somedir
Environment=PYTHONPATH=/home/user/somedir
ExecStart=/home/user/venv/bin/python script.py
Computer Information:
Manufacturer: Unknown
Model: Unknown
Form Factor: Desktop
No Touch Input Detected
Processor Information:
CPU Vendor: AuthenticAMD
CPU Brand: AMD Ryzen 5 2600X Six-Core Processor
CPU Family: 0x17
@ricferr
ricferr / gist:a3072c6d77743749fb95d7be6eb4ce02
Created May 26, 2020 10:37
Get number of items in memcached
echo -e "stats items\nquit\n" |nc 127.0.0.1 11211|grep "items:.*:number"|awk '{ sum += $3} { print sum }'|tail -1
@ricferr
ricferr / gist:1864e4169c5d08a5d2809ed070604f4e
Created August 21, 2020 13:20
Use rsyslog to redirect UDP syslog to TCP
$ModLoad imtcp
$ModLoad imudp
# Remote Logging
$RuleSet remote
*.* ?RemoteHost
# Send messages we receive to TCP
*.* @@127.0.0.1:1514