Skip to content

Instantly share code, notes, and snippets.

View fabiojmendes's full-sized avatar

Fabio Mendes fabiojmendes

  • Toronto, Canada
View GitHub Profile
@asciipip
asciipip / README.md
Last active February 20, 2022 17:53
ZFS collectd plugin

Put zfs.py into a directory (e.g. /opt/collectd-plugins). Load with, e.g.:

LoadPlugin python
<Plugin "python">
  ModulePath "/opt/collectd-plugins"
  Import "zfs"
</Plugin>

Load zfs.json and zfs_arc.json into Grafana. They assume the data is saved in a Grafana dataset named collectd.

@rojenzaman
rojenzaman / update-cdn.sh
Created September 6, 2020 14:21
firewalld rules for cloudflare cdn IPs (Red Hat, CentOS, Fedora)
#!/bin/bash
curl https://www.cloudflare.com/ips-v4 > .ips-v4
curl https://www.cloudflare.com/ips-v6 > .ips-v6
firewall-cmd --new-zone=cloudflare --permanent
firewall-cmd --reload
for i in `<.ips-v4`; do firewall-cmd --zone=cloudflare --add-source=$i; done
for i in `<.ips-v6`; do firewall-cmd --zone=cloudflare --add-source=$i; done
@nuada
nuada / partslist.py
Last active July 21, 2022 21:33
Parts list script for Fusion 360 - components are aggregated by dimensions
import adsk.core
import adsk.fusion
import csv
import os
import os.path
# Inspired by: https://forums.autodesk.com/t5/fusion-360-design-validate/parts-list-with-dimensions/m-p/9642058/highlight/true#M223047
def run(context):
version: '3'
services:
traefik:
image: traefik:v2.0
container_name: traefik
restart: unless-stopped
security_opt:
- no-new-privileges:true
networks:
@r0l1
r0l1 / README.md
Created February 8, 2018 21:44 — forked from Luzifer/README.md
Running docker-compose as a systemd service

Running docker-compose as a systemd service

Files

File Purpose
/etc/compose/docker-compose.yml Compose file describing what to deploy
/etc/systemd/system/docker-compose.service Service unit to start and manage docker compose
/etc/systemd/system/docker-compose-reload.service Executing unit to trigger reload on docker-compose.service
/etc/systemd/system/docker-compose-reload.timer Timer unit to plan the reloads
@mosquito
mosquito / README.md
Last active November 14, 2024 08:39
Add doker-compose as a systemd unit

Docker compose as a systemd unit

Create file /etc/systemd/system/[email protected]. SystemD calling binaries using an absolute path. In my case is prefixed by /usr/local/bin, you should use paths specific for your environment.

[Unit]
Description=%i service with docker compose
PartOf=docker.service
After=docker.service
@JPvRiel
JPvRiel / journalctl_enable_persistent_storage.md
Last active November 17, 2024 20:29
Enable persistent storage for the systemd journal log

Enable persistent storage for the systemd journal log

Overview

The assumed default setting in /etc/systemd/journald.conf is Storage=auto which implies that systemd journaling will only persist the journal if the expected storage location is available. Otherwise, the journal data is stored in memory and lost between reboots. On Ubuntu 16.04, /var/log/journal does not exist by default. Create it to keep and query events from previous boots.

Considerations:

  • Syslog still provides the persistant log records for Ubuntu 16.04, so enabling persistant systemd journal logging does cause a level of duplicaiton.
  • There are sane defaults:
@yohhoy
yohhoy / cv2ff.cpp
Created February 17, 2016 15:41
Convert from OpenCV image and write movie with FFmpeg
/*
* Convert from OpenCV image and write movie with FFmpeg
*
* Copyright (c) 2016 yohhoy
*/
#include <iostream>
#include <vector>
// FFmpeg
extern "C" {
#include <libavformat/avformat.h>
@fsodogandji
fsodogandji / socat-tips.sh
Last active September 11, 2024 17:39
socat tips & tricks
#To create a classic TCP listening daemon, similar to netcat -l, use a variation of the following command.
socat TCP-LISTEN:8080 stdout
#use remotly a command shell
socat TCP4-LISTEN:1234,reuseaddr,fork 'SYSTEM:/bin/cat /home/infos.txt'
#sslify a server
socat OPENSSL-LISTEN:443,reuse‐addr,pf=ip4,fork,cert=server.pem,cafile=client.crt TCP4-CONNECT:localhost:80