Skip to content

Instantly share code, notes, and snippets.

@dreiggy
dreiggy / mdadm-lvm-cheat.md
Created December 7, 2015 20:09 — forked from plepe/gist:52ecc9f18efb32c68d18
MDADM and LVM cheat sheet

mdadm

Glossary:

  • md: multiple devices
command description
cat /proc/mdstat show status of all raids
mdadm --detail /dev/md0 detailed status of raid md0
@dreiggy
dreiggy / Midnight Commander MacOS shortcuts
Last active August 19, 2017 09:31 — forked from sgergely/gist:3793166
Midnight Commander Keyboard Shortcuts for Mac OSX
----- Esc -----
Quick change directory: Esc + c
Quick change directory history: Esc + c and then Esc + h
Quick change directory previous entry: Esc + c and then Esc + p
Command line history: Esc + h
Command line previous command: Esc + p
View change: Esc + t (each time you do this shortcut a new directory view will appear)
Print current working directory in command line: Esc + a
Switch between background command line and MC: Ctrl + o
Search/Go to directory in active panel: Esc + s / Ctrl + s then start typing directory name
@dreiggy
dreiggy / Documentation.md
Created January 18, 2018 09:21 — forked from KartikTalwar/Documentation.md
Rsync over SSH - (40MB/s over 1GB NICs)

The fastest remote directory rsync over ssh archival I can muster (40MB/s over 1gb NICs)

This creates an archive that does the following:

rsync (Everyone seems to like -z, but it is much slower for me)

  • a: archive mode - rescursive, preserves owner, preserves permissions, preserves modification times, preserves group, copies symlinks as symlinks, preserves device files.
  • H: preserves hard-links
  • A: preserves ACLs
@dreiggy
dreiggy / db-connect-test.php
Created May 11, 2018 12:02 — forked from chales/db-connect-test.php
Script for a quick PHP MySQL DB connection test.
<?php
# Fill our vars and run on cli
# $ php -f db-connect-test.php
$dbname = 'name';
$dbuser = 'user';
$dbpass = 'pass';
$dbhost = 'host';
$connect = mysql_connect($dbhost, $dbuser, $dbpass) or die("Unable to Connect to '$dbhost'");
@dreiggy
dreiggy / lazycron.bash
Created June 20, 2018 06:28 — forked from coderofsalvation/lazycron.bash
start process if not running, else ignore. Prevents cronjob overlap
#!/bin/bash
# portable way to ensure :
#
# * only one process at the time (prevents process-overlap, handy for cron workers)
# * reverse cron's email behaviour (only emails on error)
# * ultraportable: only reliest on flock, not on debians 'start-stop-daemon' or centos 'daemon'
# * readable process names in top
#
# usage: ./lazycron <my-unique-id> <application> [args]
# example: ./lazycron cron-my-process php foo.php
@dreiggy
dreiggy / rsync.sh
Last active September 3, 2018 18:59 — forked from macmladen/rsync.sh
rsync exclude patterns
# /dir/ means exclude the root folder /dir
# /dir/* means get the root folder /dir but not the contents
# dir/ means exclude any folder anywhere where the name contains dir/
# Examples excluded: /dir/, /usr/share/mydir/, /var/spool/dir/
# /dir means exclude any folder anywhere where the name contains /dir
# Examples excluded: /dir/, /usr/share/directory/, /var/spool/dir/
# /var/spool/lpd//cf means skip files that start with cf within any folder within /var/spool/lpd
#
# include, +
# exclude, -
@dreiggy
dreiggy / strace-fpm.sh
Created October 9, 2018 11:40 — forked from ajbonner/strace-fpm.sh
Strace all running php-fpm processes to file with timestamps and pid
sudo strace -f -tt -o /tmp/php.trace -s1024 -p `pgrep -f php-fpm | tr '\n' ','`
@dreiggy
dreiggy / xfce-shortcuts-screenshot.md
Created November 21, 2018 21:43 — forked from dianjuar/xfce-shortcuts-screenshot.md
My xfce shortcuts to take screenshots
Command Shortcut
xfce4-screenshooter --fullscreen --clipboard Ctrl + PrtScrn
xfce4-screenshooter --fullscreen --save /home/dianjuar/Pictures PrtScrn
xfce4-screenshooter --region --clipboard Ctrl + Shift + PrtScrn
xfce4-screenshooter --region --save /home/dianjuar/Pictures Shift + PrtScrn
xfce4-screenshooter --window --clipboard Ctrl + Super + PrtScrn
xfce4-screenshooter --window --save /home/dianjuar/Pictures Super + PrtScrn
@dreiggy
dreiggy / rspamd-lists.md
Created March 31, 2019 17:12 — forked from kvaps/rspamd-lists.md
Howto create local whitelists and blacklists for Rspamd

Local whitelists and blacklists for Rspamd

  • cd /etc/rspamd
  • create rspamd.conf.local
  • create lists:
touch local_bl_from.map.inc local_bl_ip.map.inc local_bl_rcpt.map.inc \
local_wl_from.map.inc local_wl_ip.map.inc local_wl_rcpt.map.inc
  • change permissions:
@dreiggy
dreiggy / prometheus.md
Created October 2, 2019 05:54 — forked from petarnikolovski/prometheus.md
Prometheus 2.x installation on Ubuntu 16.04 server.

Installing Prometheus on Ubuntu 16.04

This gist is a compilation of two tutorials. You can find the original tutorials here and here. What should you know before using this? Everything can be executed from the home folder. For easier cleanup at the end you can make directory where you'll download everything, and then just use rm -rf .. Although, you should be careful. If some strange bugs arise unexpectedly somewhere sometimes, just keep in mind that some user names have underscores in them (this is probably nothing to worry about).

Create Users

sudo adduser --no-create-home --disabled-login --shell /bin/false --gecos "Prometheus Monitoring User" prometheus
sudo adduser --no-create-home --disabled-login --shell /bin/false --gecos "Node Exporter User" node_exporter
sudo adduser --no-create-home --disabled-login --shell /bin/false --gecos "Alertm