Skip to content

Instantly share code, notes, and snippets.

View DasLampe's full-sized avatar
🍻

André Flemming DasLampe

🍻
View GitHub Profile
@DasLampe
DasLampe / doorman.sh
Created November 22, 2012 13:26 — forked from franciscodavid/doorman.sh
Port Knocking, client and server configuration files
#!/bin/bash
#
# Port Knocking server configuration. It closes all ports but the webserver one.
# When the correct sequence of ports is detected (1000. 2000. 3000. 4000), the
# SSH port is opened for 5 seconds to allow connections.
#
# Erase all the rules
iptables -F
@DasLampe
DasLampe / saveRemoteHDDtoLocal.sh
Last active December 12, 2015 06:09
Copy whole remote HDD-Image to local computer. In some cases you need dump the whole image of an remote HDD, e.g. you migrate an server and would backup all data. The problem, you can't save the image on the server, because there is no space left. One option is copy the image to another server, but who has a server with enough space. Otherwiess …
ssh [email protected] 'dd if=/dev/sdX | gzip -c | gpg -r [userid] -e' | pv | cat > ~/image_sdaX.gz.gpg
@DasLampe
DasLampe / imap-fsockopen.class.php
Last active March 5, 2024 06:30
A small IMAP class to connect via fsockopen with SSL. Helpful for e.g. gmail.com. (Be careful! Scripted in 2010)
<?php
// +----------------------------------------------------------------------+
// | Copyright (c) 2010 DasLampe <[email protected]> |
// | Encoding: UTF-8 |
// +----------------------------------------------------------------------+
class IMAP
{
var $sock;
var $host;
var $port;
@DasLampe
DasLampe / m3u7z.sh
Created April 26, 2013 17:20
Create 7z archive from m3u file.
#!/bin/bash
###################################################
#### (c) DasLampe <[email protected]> 2013
#### Description: Read m3u file and create an 7z archiv with all files.
#### Important: Replace ^M in line 40 with special character!
####
#### Licence Information:
#### This program is free software: you can redistribute it and/or modify
#### it under the terms of the GNU General Public License as published by
#### the Free Software Foundation, either version 3 of the License, or any later version.
@DasLampe
DasLampe / mysqlbackup.sh
Last active December 19, 2015 00:09 — forked from Ditti4/mysqlbackup.sh
#!/bin/bash
# This file is licensed under the DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE Version 2, December 2004
# See http://www.wtfpl.net/txt/copying/
password=''
mail=''
date=$(date +%m_%d_%Y%H_%M_%S)
if [ ! -d /backup/sql -o ! -w /backup/sql ]; then
@DasLampe
DasLampe / download_directory listing.sh
Created August 28, 2013 22:14
Small script to download multiple files (e.g. series), when you only have an directory listing from an apache.
#!/bin/bash
#############################################
# license: CC-NC http://www.tldrlegal.com/l/CC-NC
# author: DasLampe <[email protected]>
# Description: Small script to download multiple files (e.g. series), when you only have an directory Listing.
# This script search recursivly for files without text/html mime-type & download this.
# If required create folders to arrange files.
#############################################
url=$1
@DasLampe
DasLampe / index.php
Created January 30, 2014 14:59
Automatic include piwik tracking code to HTML code via nginx
<?php
// +----------------------------------------------------------------------+
// | Copyright (c) 2012 DasLampe <[email protected]> |
// | Encoding: UTF-8 |
// +----------------------------------------------------------------------+
if(!preg_match("/^piwik$!", $_SERVER['SERVER_NAME'])) {
$url = $_SERVER['SERVER_NAME'];
if(substr_count($url, '.') >= 2)
{