Skip to content

Instantly share code, notes, and snippets.

@mdpuma
mdpuma / lftp.conf
Last active May 26, 2017 04:42 — forked from fxthomas/lftp.conf
Lftp Configuration & mirror including all dot/hidden files
## some useful aliases
alias ls "ls -h"
alias dir ls
alias less more
alias zless zmore
alias bzless bzmore
alias mirror "mirror -v"
alias sync "mirror -R -v -n"
alias reconnect "close; cache flush; cd ."
alias edit "eval -f \"get $0 -o ~/.lftp/edit.tmp.$$ && shell \\\"cp -p ~/.lftp/edit.tmp.$$ ~/.lftp/edit.tmp.$$.orig && $EDITOR ~/.lftp/edit.tmp.$$ && test ~/.lftp/edit.tmp.$$ -nt ~/.lftp/edit.tmp.$$.orig\\\" && put ~/.lftp/edit.tmp.$$ -o $0; shell rm -f ~/.lftp/edit.tmp.$$*\""
@mdpuma
mdpuma / kill_long_queries.sh
Created June 4, 2017 09:41 — forked from julcap/kill_long_queries.sh
Kill long MySQL queries
##################################################
# Kill long queries #
# This shell script will kill queries that have #
# passed the $MAX execution time. #
# Julian Capilla-krumbak #
# [email protected] #
# 21-05-2014 #
##################################################
#!/bin/bash
@mdpuma
mdpuma / firefox
Created September 23, 2017 10:27
Intel GPU screen tearing fix
To check if OpenGL OMTC is enabled, go to about:support and under the "Graphics" section look for "GPU Accelerated Windows". If it reports "0/1 Basic (OMTC)" (possibly 0/2), OpenGL OMTC is disabled; if it reports "1/1 OpenGL (OMTC)" (possibly 1/2 or 2/2) it is enabled.
To enable OpenGL OMTC go to about:config and set:
layers.acceleration.force-enabled true
layers.offmainthreadcomposition.enabled true (default)
Restart Firefox for changes to take effect.
@mdpuma
mdpuma / gist:49ee0e1938ff887c2c299cf076dd755a
Created October 14, 2017 17:55
tcpdump filter traffic by vlan (live)
#!/bin/bash
# reference https://serverfault.com/questions/544651/vlan-tags-not-shown-in-packet-capture-linux-via-tcpdump
tcpdump -i eth0 -Uw - arp | tcpdump -en -r - vlan 804
@mdpuma
mdpuma / gist:082c06fea56dbeccec1453553f7376c0
Created November 9, 2017 19:18
Cisco model description
# this may be possible mistakes
WS-C2960-24TT-L
WS-C2960-24LC
WS-C2960j-mmnnn-o
j = is gigabit or not
G - gigabit ethernets
@mdpuma
mdpuma / gist1.sh
Created November 9, 2017 19:21
get_drive_temp.sh
#!/bin/bash
raid=cciss
maxdisks=7
for i in {0..7}; do
temp=$(smartctl -a -d $raid,$i /dev/sda | grep "Current Drive Temperature:" | awk -F: '{ print $2}')
[ -z "$temp" ] && temp=$(smartctl -a -d $raid,$i /dev/sda | grep "Temperature_Celsius" | grep -oE "[0-9]+" | xargs | cut -d ' ' -f7);
[ -n "$temp" ] && echo slot $i: $temp;
done
@mdpuma
mdpuma / .lftprc
Last active August 10, 2018 06:34
lftp optimal settings
set ftp:list-options '-a'
set ftp:ssl-allow false
@mdpuma
mdpuma / gist:9332fbac671ca362348bc4a6b027189b
Created November 19, 2017 14:44
renew letsencrypt ssl certificate solusvm
#!/bin/bash -e
DOMAIN=solusvm
/root/certbot-auto renew
cat /etc/letsencrypt/live/$DOMAIN/{privkey,cert}.pem > /usr/local/solusvm/ssl/cert.pem
/etc/init.d/solusvm restart
@mdpuma
mdpuma / root-ro
Created December 9, 2017 17:40 — forked from kidapu/root-ro
Read-only Root-FS with overlayfs for Raspian
#!/bin/sh
#
# Read-only Root-FS for Raspian
#
# Modified 2016 by Stefan Bonfert to make it compatible with Raspbian
# Jessie (vanilla).
#
# Modified 2015 by Pascal Rosin to work on raspian-ua-netinst with
# overlayfs integrated in Linux Kernel >= 3.18.
#
@mdpuma
mdpuma / bridge_vlan_aware
Last active November 22, 2025 07:37
proxmox snippers
# cat /etc/network/interfaces
auto vmbr0
iface vmbr0 inet manual
bridge-ports eno1
bridge-stp off
bridge-fd 0
bridge_vlan_aware yes
bridge_vids 610 # not supported multiple vlans, only range 2-4094
post-up bridge vlan add dev eno1 vid 610; bridge vlan add dev eno1 vid 802