Skip to content

Instantly share code, notes, and snippets.

View arbv's full-sized avatar
💭
🇺🇦

Artem Boldariev arbv

💭
🇺🇦
View GitHub Profile
@jadonk
jadonk / epolltest.c
Created May 3, 2012 17:41
Quick test using epoll to wait on GPIO events
#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <stdlib.h>
#include <sys/epoll.h>
#include <sys/types.h>
int main(int argc, char** argv) {
@meghuizen
meghuizen / sysctl-gigabit.txt
Created July 26, 2013 09:33
Linux gigabit tuning
##
## Please make sure to change this according to your own needs/configuration
## Some values won't be helpful for some configurations (like routers or firewalls)
## If you have a normal server, these settings should work fine
##
## Tested on Dell PowerEdge/PowerVault servers with gigabit, iSCSI, multipathing with Citrix XenServer clients
## Large performance improvement on the default settings!
##
## Carefull selected values!
##
@solusipse
solusipse / 01_postfix_installer.md
Last active August 29, 2024 20:43
Postfix + Dovecot + Postgresql + Postfixadmin + Roundcube

Postfix Installer

Following script may be used for configuring complete and secure email server on fresh install of Debian 7. It will probably work on other distributions using apt-get. After minor changes you'll be able to use it on other Linux distros.

Usage

  1. Run postfix.sh script.
  2. Configure postgres to allow connections.
  3. Configure postfix admin. Remember to set these:
@trendels
trendels / rsync_daemon_over_ssh.md
Last active July 25, 2024 20:42
Rsync daemon mode over ssh

rsync daemon mode over ssh

There are several common ways to do rsync backups of hosts over ssh:

  1. As a non-root user. Upsides: very secure. Downside: cannot back up sensitive files.
  2. As root, with a public key. Downsides: Whoever has the private key has full root access to the host being backed up.
  3. As root, with a public key and a "forced command". Upsides: Restricts access to the server. Downsides: Requires either careful matching of rsync options (which might change over time), or "validator" scripts. Neither idea sounds very appealing to me.
  4. Running rsync in daemon mode on the host being backed up. Upsides: Lots of useful options, like read-only mode, running as a different user if required, server-side excludes/includes, etc. Downsides: Opens up a TCP port that has full filesystem read access and is hard to secure (Ideally you could make the rsync daemon use a unix socket instead, that could be secured by filesystem permissions, but I haven't found a way to do that).

Here is another option t

@gdamjan
gdamjan / 50-wifi.link
Last active September 26, 2018 15:21
Home network setup with a bridged wifi (for my libvirt VMs) using systemd-networkd and wpa_supplicant
@daniel-j-h
daniel-j-h / default.nix
Created July 7, 2016 22:47
Nix C++ compiler, CMake, Boost skeleton --- stable ABI
# Nix skeleton for compiler, cmake, boost.
# Dependencies (boost and others you specify) are getting built with selectec compiler (for ABI compatibility).
# Examples:
# nix-shell --argstr compiler gcc5 --run 'mkdir build && cd build && cmake .. && cmake --build .'
# nix-shell --argstr compiler gcc6 --run 'mkdir build && cd build && cmake .. && cmake --build .'
# nix-shell --argstr compiler clang_38 --run 'mkdir build && cd build && cmake .. && cmake --build .'
{ nixpkgs ? import <nixpkgs> {}, compiler ? "gcc6" }:
let
@InsanePrawn
InsanePrawn / container_dhcp.network
Last active March 7, 2024 18:11
block device passthrough into systemd-nspawn for testing the munin smartctl plugin
[Match]
Name=host*
[Network]
DHCP=yes
pki example.com key "/etc/letsencrypt/live/example.com/privkey.pem"
pki example.com certificate "/etc/letsencrypt/live/example.com/fullchain.pem"
listen on lo mask-source
listen on 1.2.3.4 port 25 tls pki example.com auth-optional hostname example.com
listen on 1.2.3.4 port 465 smtps pki example.com auth hostname example.com mask-source
listen on 1.2.3.4 port 587 tls-require pki example.com auth hostname example.com mask-source
table aliases file:/etc/mail/aliases
table domains file:/etc/mail/domains
auth_username_format = %n
imap_idle_notify_interval = 29 mins
lda_mailbox_autocreate = yes
mail_location = maildir:~/mail
mail_plugins = " fts fts_lucene"
plugin {
fts = lucene
fts_autoindex = yes
fts_lucene = whitespace_chars=@.
imapsieve_mailbox1_before = file:/etc/mail/imapsieve/report-spam.sieve
@mjbnz
mjbnz / nginx-rproxy-with-sso.md
Last active November 3, 2024 22:45
Nginx Reverse Proxy with simple SSO

Nginx Reverse Proxy for homelab services using SSO

NOTE: This document has now been added to the nginx-sso wiki, here. Any further updates will be made there.

Using: