• iptables Sperre basierend auf AS-Nummer anlegen

    iptables -N AS_DENY; iptables -I INPUT -j AS_DENY; whois -T route -i origin AS57169 | grep '^route:' | awk '{print $2}' | aggregate -q | xargs -n1 -I% iptables -A AS_DENY -s % -j DROP
    
  • wpCasa Button auf Listings hinzufügen

    if (function_exists("wpptopdfenh_display_icon")) echo wpptopdfenh_display_icon();
    //echo '<div class="title-actions-print"><a href="http://meinlink.com/" class="btn btn-mini"><i class="icon-print"></i> Exposé</a></div>';
    
    
  • Jeden Ordner im aktuellen Verzeichnis so stark wie möglich komprimieren

    for D in *; do [ -d "${D}" ] && tar -cf - $D | xz -9 -c - > $D.tar.xz; done
    
  • Find doubles in SQL

    SELECT Liste.Firma FROM Liste
    INNER JOIN (SELECT Firma FROM Liste
    GROUP BY Firma HAVING count(id) > 1) dup ON Liste.Firma = dup.Firma
    
  • Snippet: Contact Form 7 Post anlegen und Mail versenden

    function wpcf7_to_post($cfdata) {
        // Daten aus der Anfrage auslesen
        $submission = WPCF7_Submission::get_instance();
        if ( $submission ) {
            $formdata = $submission->get_posted_data();
        }
         
        // Post ID des Formulares angeben, welches "abgefangen" werden soll
        if ( $cfdata->id() == '318') {
            $newdraft = array(
                'post_title'=> $formdata['your-name'],
            'post_status' => 'draft', // Status
                'post_type' => 'post', // Post Type
            );
     
            // Eintrag als Entwurf anlegen
            $newpostid = wp_insert_post($newdraft);
     
            // Hier werden zustzlich Customfields befllt
        //    add_post_meta($newpostid, 'customfield01', $formdata['strasse']);
        //    add_post_meta($newpostid, 'customfield02', $formdata['plzort']);
        }
    }
    add_action('wpcf7_before_send_mail', 'wpcf7_to_post',1);
     
      
     
    //http://drwp.de/daten-via-contact-form-7-als-beitrag-speichern/
    
  • Generate multiple dhparam-files at once

    for i in {1..30}; do mkdir $i; openssl dhparam -out $i/dhparam.pem 4096; done