Skip to content

Instantly share code, notes, and snippets.

View chluehr's full-sized avatar

Christoph Lühr chluehr

View GitHub Profile
@chluehr
chluehr / php_pimcore_event_replace.php
Created June 15, 2015 21:36
Sample: Replace Backend Pimcore Search Hooks - Detach ZF1 EventManager Listeners / Callbacks
<?php
namespace ElasticFind;
use Pimcore\API\Plugin as PluginLib;
class Plugin extends PluginLib\AbstractPlugin implements PluginLib\PluginInterface {
public function init() {
@chluehr
chluehr / 70-u2f.rules
Created December 25, 2014 21:28
Activate YubiCorp YubiKey FIDO Security Key / Linux
ACTION!="add|change", GOTO="u2f_end"
KERNEL=="hidraw*", SUBSYSTEM=="hidraw", ATTRS{idVendor}=="1050", ATTRS{idProduct}=="0113|0114|0115|0116|0120|0402|0403|0406|0407|0410", TAG+="uaccess"
LABEL="u2f_end"
@chluehr
chluehr / high_open_files_limit.txt
Created November 28, 2014 13:16
Set high limits on limit of open files for server tuning
/etc/security/limits.conf:
* soft nproc 65535
* hard nproc 65535
* soft nofile 65535
* hard nofile 65535
sysctl.conf:
fs.file-max = 65536
@chluehr
chluehr / 90-u2f-securitykey.rules
Created November 12, 2014 15:08
Activate PlugUp FIDO Security Key
# Activate Plug-Up Security Key by creating: /etc/udev/rules.d/90-u2f-securitykey.rules anlegt
# (as root):
ATTRS{idVendor}=="2581", ATTRS{idProduct}=="f1d0", TAG+="uaccess"
ATTRS{idVendor}=="2581", ATTRS{idProduct}=="f1d0", GROUP="plugdev", MODE="0660"
@chluehr
chluehr / purge_clean_unused_kernels_in_boot.sh
Created October 24, 2014 12:33
removes/uninstalls/cleans all unused kernes from a system. use with caution!
#!/bin/bash
dpkg -l linux-{image,headers}-"[0-9]*" | awk '/ii/{print $2}' | grep -ve $kernelver |xargs sudo apt-get purge -y
@chluehr
chluehr / mysql-view-definer-change.sh
Last active January 15, 2016 09:34
A shell script to change all the security definers of a mysql view
#!/bin/bash
# Usage: mysql-view-definer-change.sh MYSQLDUMP.sql
sed -i 's/DEFINER=[^*]*\*/\*/g' $1
@chluehr
chluehr / firewall_timestamp_fix.sh
Created April 23, 2014 12:32
Work around a misconfigured firewall by disabling TCP window scaling and TCP timestamps.
# http://prowiki.isc.upenn.edu/wiki/TCP_tuning_for_broken_firewalls
echo 0 | sudo tee /proc/sys/net/ipv4/tcp_timestamps
echo 0 | sudo tee /proc/sys/net/ipv4/tcp_window_scaling
# or add to sysctl.conf:
# net.ipv4.tcp_window_scaling=0
# net.ipv4.tcp_timestamps=0
@chluehr
chluehr / varnishclear.sh
Created December 3, 2013 10:04
Bash script to clear all resources / files / path of a (sub-) domain in a varnish cache.
#/!bin/bash
cmd="sudo varnishadm -T 127.0.0.1:6082 -S /etc/varnish/secret"
site=$(echo $1 | sed -r 's|https?://||;s|/(.*)||;')
page=$(echo $1 | awk -F'/' -v OFS='/' '{sub(/https?:\/\//, ""); $1=""; print $0}')
if [ -z "$1" ]; then
echo "ERROR: please provide a URL to purge.."
echo "USAGE: "
@chluehr
chluehr / ox_set_password.sql
Created October 10, 2013 07:50
Reset/Change OXID Password via SQL
update oxuser set oxpassword = MD5( CONCAT( 'pass', UNHEX( oxpasssalt ) ) ) where oxusername='myusername';
@chluehr
chluehr / oxid_modules_off.sql
Created October 9, 2013 17:47
Disable OXID modules
DELETE FROM oxconfig WHERE oxvarname IN ("aDisabledModules", "aLegacyModules",
"aModuleFiles", "aModulePaths", "aModules", "aModuleTemplates");