Skip to content

Instantly share code, notes, and snippets.

View oliworx's full-sized avatar

Oliver Kurmis oliworx

View GitHub Profile
@oliworx
oliworx / etag.php
Last active July 27, 2022 12:25
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();
@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 / 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 / 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 / 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
#!/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 / 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

@oliworx
oliworx / new-mysql-db-and-user.sql
Last active June 20, 2023 03:23
Create a New DB and User in MySQL
CREATE DATABAESE MYNEWDB;
CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON MYNEWDB.* TO 'newuser'@'localhost';
FLUSH PRIVILEGES;
@oliworx
oliworx / fix-chrome-gnkome-keyring.sh
Created April 15, 2017 14:35
Fix the high CPU usage when starting Google chrome on Ubuntu Linux
#!/bin/sh
sudo chmod -x /usr/bin/gnome-keyring-daemon
@oliworx
oliworx / HANA-tenant-db.sql
Created April 21, 2017 22:31
How to create and dropa SAP HANA tenant database
-- source: https://blogs.sap.com/2016/10/27/create-tenant-database-sap-hana-express-sap-hana-academy/
-- create a tenant
CREATE DATABASE TESTDB SYSTEM USER PASSWORD Initial1;
-- add the script server service
ALTER DATABASE TESTDB ADD 'scriptserver'
-- or hit two birds with one stone
CREATE DATABASE TESTDB ADD 'scriptserver' SYSTEM USER PASSWORD Initial1;
-- Tenants by default start automatically, but can be started and stopped manually as well