Skip to content

Instantly share code, notes, and snippets.

Roland Tapken Cybso

Block or report user

Report or block Cybso

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
@Cybso
Cybso / sort-access-log
Last active Jun 15, 2018
Sort apache access logs and convert 'common' into 'combined'. The output of this script can be used as input for awffull or webalizer.
View sort-access-log
#!/bin/bash
###
# Sorts the rows of one or multiple apache access_log files
# by date (ascending) and converts them from 'common' log format
# into 'combined' (if you switched the log file format meanwhile).
#
# This is useful when you want to merge multiple log files, e.g. when
# you have different files for HTTP and HTTPS.
#
# Usage:
@Cybso
Cybso / stamp-last-page.sh
Created Apr 3, 2017
Put a stamp on the last page of a PDF document using PDFTK
View stamp-last-page.sh
#!/bin/bash
if [ "$1" == "" -o "$2" == "" -o "$3" == "" -o "$4" != "" -o "$1" == "-h" -o "$1" == "--help" ]; then
echo "Puts a stamp (as PDF file) onto the last page of the input" >&2
echo "file using PDFTK". >&2
echo "" >&2
echo "Usage: $0 INPUT.pdf STAMP.pdf OUTPUT.pdf" >&2
exit 1
fi
@Cybso
Cybso / suspend-on-idle.service
Last active Mar 4, 2017
Suspend system on inactivity
View suspend-on-idle.service
# /etc/systemd/system/suspend-on-idle.service
# call "systemctl daemon-reload" after creation / modification
# call "systemctl status suspend-on-idle.service" to see last log line
# call "journalctl -b0 -u suspend-on-idle" to see all log line
[Unit]
Description=Suspend on idle
Wants=network-online.target
After=network.target network-online.target
[Service]
@Cybso
Cybso / verify_ssha_passwd.py
Last active Jul 17, 2017
PAM helper script in python to allow migration of user accounts stored in LDAP (with SSHA hashed passwords) to regular unix system users. This script will be executed is pam_unix failed and will try to verify the user password stored in /etc/shadow using SSHA algorithm.
View verify_ssha_passwd.py
#!/usr/bin/env python
###
# Takes a username from environment variable PAM_USER, a password from STDIN
# and tries to verify the shadow's password using LDAP's SSHA algorithm:
#
# {SSHA}...base64encodedString...
#
# If used within PAM auth this provides a compatibility layer that allows
# to migrate LDAP user into Unix user accounts. When the user's password
View redmine-ldapsync.py
#!/usr/bin/env python
# syncldap.py - Sync user accounts from an LDAP or Active Directory to Redmine
#
# Usage: syncldap.py <database.yml> [environment]
#
# Where database.yml is the database configuration file for a redmine instance,
# and environment is the rails environment that should be used (defaults to
# 'production').
#
# Author:
View adblock.sh
#!/bin/sh
#Put in /etc/adblock.sh
#Script to grab and sort a list of adservers and malware
#Check proper DHCP config and, if necessary, update it
uci get dhcp.@dnsmasq[0].addnhosts > /dev/null 2>&1 || uci add_list dhcp.@dnsmasq[0].addnhosts=/etc/block.hosts && uci commit
#Leave crontab alone, or add to it
grep -q "/etc/adblock.sh" /etc/crontabs/root || echo "0 4 * * 0,3 sh /etc/adblock.sh" >> /etc/crontabs/root
You can’t perform that action at this time.