Skip to content

Instantly share code, notes, and snippets.

@jkullick
jkullick / enable-nginx-logs-goaccess.md
Created Mar 27, 2017
Enable Nginx Logs in Goaccess
View enable-nginx-logs-goaccess.md

Add to /etc/goaccess.conf:

time-format %T
date-format %d/%b/%Y
log-format %h %^[%d:%t %^] "%r" %s %b "%R" "%u"
@jkullick
jkullick / remove-all-but-newest-folder-directory-linux.md
Created Mar 21, 2017
Remove All but x Newest Folders in Directory on Linux
View remove-all-but-newest-folder-directory-linux.md
KEEP=5
rm -rf `ls -td $PATH_TO_FILES/*/ | tail -n +$(($KEEP+1))`
@jkullick
jkullick / backup-whole-linux-system-ssh.md
Created Mar 12, 2017
Backup & Restore whole Linux System over SSH
View backup-whole-linux-system-ssh.md
# Backup
ssh root@$SSH_HOST "tar cpf - / --exclude=/sys --exclude=/proc --exclude=/dev" | pv | gzip | cat > backup.tar.gz

# Restore
cat backup.tar.gz | ssh root@$SSH_HOST "pv | tar zxvf - -C /"
View iptables-rate-limit.md
iptables -N LOGGING
iptables -A LOGGING -m limit --limit 2/min -j LOG --log-prefix "IPTables-Dropped: " --log-level 4

iptables -A INPUT -p tcp --dport 80 -m state --state NEW -m recent --set
iptables -A INPUT -p tcp --dport 80 -m state --state NEW -m recent --update --seconds 60 --hitcount 20 -j LOGGING

iptables -A LOGGING -j DROP
@jkullick
jkullick / convert-serialized-php-json.md
Last active Feb 28, 2017
Convert Serialized PHP to JSON
View convert-serialized-php-json.md
cat $SERIALIZED_PHP_FILE | php -r 'echo json_encode(unserialize(file_get_contents("php://stdin")));'
@jkullick
jkullick / pgp-sign-all-old-git-commits.md
Created Feb 16, 2017
PGP Sign all old Git Commits
View pgp-sign-all-old-git-commits.md
git filter-branch -f --commit-filter 'git commit-tree -S "$@"' HEAD

Source

@jkullick
jkullick / fix-jira-upgrade-error-agile.md
Last active Jan 24, 2017
Fix JIRA Upgrade Error ("JIRA Agile is currently unavailable")
View fix-jira-upgrade-error-agile.md
  1. Stop JIRA

  2. Execute Database Queries:

UPDATE propertynumber SET propertyvalue = 47 
WHERE id = (SELECT id FROM propertyentry WHERE property_key = 'GreenHopper.Upgrade.Latest.Upgraded.Version');
UPDATE propertystring SET propertyvalue = '47' 
WHERE id = (SELECT id FROM propertyentry WHERE property_key = 'com.pyxis.greenhopper.jira:build');
@jkullick
jkullick / reset-mysql-auto-increment-value-after-delete.md
Last active Jan 18, 2017
Reset MySQL Auto Increment Value after Delete
View reset-mysql-auto-increment-value-after-delete.md
SELECT @max := MAX(ID)+ 1 FROM ABC; 

PREPARE stmt FROM 'ALTER TABLE ABC AUTO_INCREMENT = ?';
EXECUTE stmt USING @max;

DEALLOCATE PREPARE stmt;

@jkullick
jkullick / check-cpu-hardware-virtualization-support-linux.md
Created Jan 17, 2017
Check if CPU supports Hardware Virtualization on Linux
@jkullick
jkullick / s25r-anti-spam-system-postfix.md
Last active Jan 17, 2017
S25R Anti-Spam-System in Postfix
View s25r-anti-spam-system-postfix.md
postconf -e "smtpd_client_restrictions = check_client_access regexp:/etc/postfix/client_restrictions"

cat > /etc/postfix/client_restrictions << EOF
/^(dhcp|dialup|ppp|adsl|pool)[^.]*[0-9]/  550 S25R6 check
EOF

postfix reload
You can’t perform that action at this time.