Skip to content

Instantly share code, notes, and snippets.

View oliworx's full-sized avatar

Oliver Kurmis oliworx

View GitHub Profile
@oliworx
oliworx / Linux-cheat-sheet.md
Last active May 13, 2021 13:06
Linux-cheat-sheet

My Linux Cheat Sheets

Create a Backup of the home partition

sudo xfsdump -l 0 -L "Backup level 0 of /home `date`" -M Full  - /home | lzop > /media/oli/Seagate_4TB/Backup/vostro/xfsdump/home-xfsdump-`date +%Y-%m-%d`.lzo

ISO date in bash

DATE=`date +%Y-%m-%d`

check open ports

netstat -tulpn

#!/bin/sh
# from https://lebkowski.name/docker-volumes/
# remove unused images
docker images --no-trunc | grep '<none>' | awk '{ print $3 }' | xargs -r docker rmi
# remove finished containers and their volumes
docker ps --filter status=dead --filter status=exited -aq | xargs docker rm -v
@oliworx
oliworx / full-xfs-backup
Created March 25, 2016 11:57
very fast full backup of XFS partition with xfdump and lzo compression
sudo xfsdump -L KW12 -M FullBackup -J - / |lzop > /media/oli/465GB/Backup/Oli/Vostro/Linux-xfsdump-2016-03-26.lzo
## Explanation:
# sudo xfsdump
# -> start the xfsdump programm with root privileges
# -L KW12
# -> gives the Backup the label KW12
# -M FullBackup
@oliworx
oliworx / create_mysql_backup_user.sql
Created February 10, 2016 09:16
Create MySQL user to backup databases
CREATE USER 'dbbackup'@'localhost' IDENTIFIED BY '***';
GRANT SELECT ,
RELOAD ,
FILE ,
SUPER ,
LOCK TABLES ,
SHOW VIEW ON * . * TO 'dbbackup'@'localhost' IDENTIFIED BY '***'
WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0 ;
@oliworx
oliworx / cpuinfo
Created June 21, 2015 08:40
fix PAE on Pentium M (to upgrade Linux kernel on Ubuntu)
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 13
model name : Intel(R) Pentium(R) M processor 1.50GHz
stepping : 6
microcode : 0x17
cpu MHz : 600.000
cache size : 2048 KB
physical id : 0
@oliworx
oliworx / gist:62566e27f7dbff9ec439
Created April 7, 2015 23:56
.htaccess to redirect all requests to index.php with original request as query string
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?$1 [L,PT]
@oliworx
oliworx / etag.php
Last active February 6, 2025 10:23
Browser caching with Etag and PHP: this saves bandwith and speeds up the loading for the visitor, very useful for mobile pages
ob_start(); // collect all outputs in a buffer
/*
put the normal PHP-Code here
if the resulting html code ($sContent) is the same, and so the md5 hash is the same,
it will not be sent so the client once more
because the client already has this html page in the cache, identified by the md5 hash Etag
*/
$sContent = ob_get_contents(); // collect all outputs in a variable
ob_clean();