Skip to content

Instantly share code, notes, and snippets.

@FlatKey
FlatKey / gist:10141167459bc026ae38
Created October 31, 2015 00:51
Config snippet for an apache virtualhost configuration to secure the piwik login page against unauthorized access
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/pathtopiwik/?(index.php)?$
RewriteCond %{QUERY_STRING} !^module=CustomOptOut&action=optOut(.*)?$
RewriteCond %{REMOTE_ADDR} !^(192\.168\.0\.1)|(192\.168\.0\.2)$
RewriteRule ^(.*)$ - [F,L]
# Line 3 is the exception for the Opt-Out option
# Line 4 contain the ip addresses with granted access to the login page
@FlatKey
FlatKey / gist:0d3f099de09bd1acaa4d
Created October 31, 2015 13:35
switch pulseaudio output between HDMI and analog Stereo
# switch to HDMI
pactl set-card-profile 0 output:hdmi-stereo
# switch to analog Stereo
pactl set-card-profile 0 output:analog-stereo+input:analog-stereo
@FlatKey
FlatKey / gist:5e344e128b2f25f4332b
Last active March 26, 2016 03:50
Show hard disk information
# Display drive identification
hdparm -i /dev/sda
# Detailed/current information directly from drive
hdparm -I /dev/sda
# Display drive configuration
hdparm /dev/sda
@FlatKey
FlatKey / gist:33618bba8fde4257d3d1
Created March 26, 2016 04:09
Test hard disk read and write speed
# read speed test with hdparm
hdparm -Tt /dev/sda
# read speed test with dd (posibly buffered)
dd if=/path/to/drive/mount/testfile of=/dev/null bs=1M count=1024
# read speed test with dd (flushed buffer)
sysctl -w vm.drop_caches=3
dd if=/path/to/drive/mount/testfile of=/dev/null bs=1M count=1024