Skip to content

Instantly share code, notes, and snippets.

Christoph Lühr chluehr

Block or report user

Report or block chluehr

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@chluehr
chluehr / cakeagent.sh
Created Jun 29, 2018
Updated statuscake agent script to better deal with cpu usage and disk space reporting
View cakeagent.sh
#!/bin/bash
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/etc/cakeagent
# Make sure we have some auth information
if [ -f /etc/cakeagent/auth.log ]
then
Authentication=($(cat /etc/cakeagent/auth.log))
else
echo "Something has gone wrong and we can not find your auth credentials. Please reinstall"
exit 1
@chluehr
chluehr / Makefile
Created May 7, 2018
Makefile to fetch(sync) Cloudfront S3 Logs and analyze them with goaccess Logfile Analyzer.
View Makefile
all: fetch report
fetch:
aws s3 sync --exclude "*" --include "*2018-03-*" --include "*2018-04-*" --include "*2018-05-*" s3://$BUCKET/$PATH/ .
report:
find . -name \*.gz | xargs gzcat | goaccess --log-format CLOUDFRONT --date-format CLOUDFRONT --time-format CLOUDFRONT -o ./report.html
@chluehr
chluehr / php-spawn-command-check-processp-status.php
Created Jan 30, 2018
Spawn a shell command from PHP, check Process status, respawn if not running.
View php-spawn-command-check-processp-status.php
<?php
/**
* $ php p.php
* S SPAWNED! RRRRS SPAWNED! RRRRRS SPAWNED! R
*/
function spawn() {
$descriptorspec = array(
@chluehr
chluehr / restic-backup.sh
Created Nov 5, 2017
Backup via restic to Backblaze
View restic-backup.sh
#!/bin/bash
#
# Setup:
# wget https://github.com/restic/restic/releases/download/v0.7.3/restic_0.7.3_linux_amd64.bz2
# bunzip2 restic_0.7.3_linux_amd64.bz2
# mv restic_0.7.3_linux_amd64 /usr/local/bin/restic
# chmod a+x /usr/local/bin/restic
#
# crontab -e
# 0 1 * * * /root/bin/restic-backup.sh 2>&1 >>/var/log/restic-backup.log
@chluehr
chluehr / sample-table-print.html
Created Dec 16, 2016
HTML Example for a printable print CSS with repeating table column headers suitable for wkhtmltopdf
View sample-table-print.html
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
body {
margin: 60px;
}
View test.sh
#!/bin/bash
test
@chluehr
chluehr / 0_reuse_code.js
Created May 2, 2016
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
View pimcore_editmode_wysiwyg.js
/* /website/static/js/editmode/wysiwyg.js */
CKEDITOR.stylesSet.add( 'custom_styles', [
// Paragraph Styles
{ name: 'Regular Text', element: 'p', attributes: { 'class': '' }},
{ name: 'Large Text', element: 'p', attributes: { 'class': 'content__text-L' } }
]);
CKEDITOR.editorConfig = function( config ) {
// add our custom styles
@chluehr
chluehr / find_inode_usage.sh
Created Jun 24, 2015
Finds where all your inodes are being used ..
View find_inode_usage.sh
#!/bin/bash
# see: http://unix.stackexchange.com/questions/117093/find-where-inodes-are-being-used
# show inode usage:
df -i
# find where all those files are (roughly) - starts at /
find / -xdev -printf '%h\n' | sort | uniq -c | sort -k 1 -n
@chluehr
chluehr / purge_old_kernels.sh
Created Jun 16, 2015
Simple Script to delete all old kernels except the last recent 2 (after auto-updates) - use with caution
View purge_old_kernels.sh
#!/bin/bash
OLD=$(ls -tr /boot/vmlinuz-* | head -n -3 | cut -d- -f2- |
awk '{print "linux-image-" $0 " linux-headers-" $0}' )
echo "OLD:"
echo "$OLD"
echo
echo -n "CURRENT: "
uname -r
You can’t perform that action at this time.