Skip to content

Instantly share code, notes, and snippets.

View DasLampe's full-sized avatar
🍻

André Flemming DasLampe

🍻
View GitHub Profile
@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)
{
@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 / 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 / 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 / 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 / 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 / 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 / spotlight_bugfix.sh
Created October 22, 2012 21:15
[Mac OS X] Fix broken permissions and stop spotlight reindexing
#! /bin/bash
########################################################
#Copright: 2012, DasLampe <[email protected]>
#Original Source: https://gist.github.com/gists/3934414/
#
#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.
#This program is distributed in the hope that it will be useful,
@DasLampe
DasLampe / gist:1420919
Created December 2, 2011 00:19
Find emailaddresses, make clickable and encode with base64
/********Code based on https://gist.github.com/907604 *********
The code find email addresses and proteceds for bots.
Make the addresses clickable with webtoolkit.base64.js and the following code (JQuery requiered):
$('a').each(function() {
var href, mailaddress;
href = $(this).attr('href');
if(href.search(/mailto:/) != -1)
{
@DasLampe
DasLampe / gist:1275652
Created October 10, 2011 15:47
JQuery select block before current main block
/**HTML CODE
<div class="edit_content_options"><a class="edit_link">Edit</a></div>
<div>
<div>Edit block, with event</div>
</div>*/
function find_parent(current_block)
{
var parent, searchblock, edit_option;