Sometimes you're doing the same routine over and over again. As you can see in our first example. We copy a Website from one place to another. And in the case of Wordpress we must change the URL's in the Database. So this page is for all who are working with dry (don't repeat yourself). If you have any suggestions to make, feel free to write me (dh@creatin-g.de) some words.

No Data* will be stored.

All Input-Fields use Angular.js to bring you the Code-Snippet. *Except the usual Piwik Analytics for my personal Interest.

iFrame-Redirect for Landingpages

Link to

1. Make a new File "index.html"

2. Copy & paste the following


        <html>
        <head>
        <meta name="robots" content="noindex,follow">
        <meta charset="utf8" />
        <meta name="description" content="{{html_redirect_description}}">
        <meta name="keywords" content="{{html_redirect_keywords}}">
        <title>{{ html_redirect_title }}
        </head>
        <frameset rows="100%" frameborder=0 framespacing=0 border=0>
        <frame src="{{ html_redirect_to }}" name="{{ html_redirect_title }}" noresize>
        <noframes><a href="{{ html_redirect_to }}">{{ html_redirect_text }}</a></noframes>
        </frameset>
        </html>
      

WP CLI

Download
MySQL-Data
Your WP-Data

1. Download Wordpress


          wp core download --path={{wpcli_path}} --locale={{wpcli_locale}}
      

2. configure config.php


        wp core config --dbname={{wpcli_datenbank}} --dbuser={{wpcli_username}} --dbpass={{wpcli_password}}
      

2. configure config.php


       wp core install --url={{ wpcli_simpleValSecure2 }}://{{ wpcli_domain }} --title="{{wpcli_title}}" --admin_user="{{ wpcli_user }}" --admin_password="{{ wpcli_usrpassword }}" --admin_email={{ wpcli_email }}
      

Wordpress change Domain for MySQL

old domain
new domain
table prefix

Copy the following in your SQL-App (for Example: phpMyadmin / Adminer or Chive)


          UPDATE {{ prefix }}options SET option_value = replace(option_value, '{{ simpleValSecure1 }}://{{ olddomain }}', '{{simpleValSecure2}}://{{ newdomain }}') WHERE option_name = 'home' OR option_name = 'siteurl';
          UPDATE {{ prefix }}posts SET guid = replace(guid, '{{ simpleValSecure1 }}://{{ olddomain }}','{{simpleValSecure2}}://{{ newdomain }}');
          UPDATE {{ prefix }}posts SET post_content = replace(post_content, '{{ simpleValSecure1 }}://{{ olddomain }}', '{{simpleValSecure2}}://{{ newdomain }}');
      

The following paste at the end of the wp-config.php and give you access to the backend doesn't matter wich URL is in the Database


        define( 'WP_HOME', '{{ simpleValSecure2 }}://{{ newdomain }}');
        define( 'WP_SITEURL', WP_HOME);
      

Make WP-Child-Theme

Child-Theme

Make a Folder in wp-content/themes/your-new-theme. Then make a new file called style.css and copy the following into it:


          /*
          Theme Name:   {{ child_thme_name }}
          Description:  {{ child_description   }} | created with coder.aufnkaffee.de
          Author:       {{ child_author   }}
          Author URI:   {{ child_author_uri  }}
          Template:     {{ child_parent  }}
          Version:      {{ child_version  }}
          Tags:         {{ child_tags }}
          */
          @import url("../{{ child_parent }}/style.css");
      

Add Admin-User via SQL-Query

Child-Theme

1. Step -> Copy the following in PhpMyAdmin, Chive, Adminer or any other SQL-Tool


          INSERT INTO
            wp_users
          SET
            user_login='{{wpaddadmin_name}}',
            user_pass=md5('{{wpaddadmin_pswd}}'),
            user_nicename='{{wpaddadmin_nicename}}',
            user_email='{{wpaddadmin_usr_email}}',
            user_registered=now(),
            user_status='0',
            display_name='{{wpaddadmin_name}}';
      

2. -> Check the User-ID with the following SQL-Command. In the first row you see the ID.


                      SELECT * FROM wp_users WHERE user_login='{{wpaddadmin_name}}';

      

3. -> Step Copy the following in the same tool. (It sets a bunch of Metadata, like Permissions)


          INSERT INTO
            `wp_usermeta`
            (`umeta_id`, `user_id`, `meta_key`, `meta_value`)
          VALUES
            (NULL, '{{wpaddadmin_usr_id}}', 'wp_capabilities', 'a:1:{s:13:"administrator";s:1:"1";}');

          INSERT INTO
            `wp_usermeta`
            (`umeta_id`, `user_id`, `meta_key`, `meta_value`)
          VALUES
            (NULL, '{{wpaddadmin_usr_id}}', 'wp_user_level', '10');
      
(via)

Make a MySQL-Dump with SSH

MySQL-Data

Copy the following in your Terminal backup your database


        mysqldump -u'{{username}}' -p'{{password}}' {{datenbank}} > {{dateiname}}.sql
      

Copy the following in your Terminal restore your database


        mysql -u'{{username}}' -p'{{password}}' {{datenbank}} < {{dateiname}}.sql
      

Copy Data with ncftp, wget or curlftpfs

FTP-Data

If you have an @ in the username, use %40 instead.

With wget copy this


        wget --ftp-user={{ftp_username}} --ftp-password={{ftp_password}} -r -directory-prefix=/{{ftp_folder}} -l inf ftp://{{ftp_server}}
      

With ncftp first login on the server. Second: Put or Get Data from it.


        ncftp ftp://{{ftp_username}}:{{ftp_password}}@{{ftp_server}}
        get -R {{ftp_folder}}
        put -R {{ftp_folder}}
      

With curlftps


        curlftpfs '{{ftp_username}}:{{ftp_password}}@{{ftp_server}}' ~/srv/mountpoint
      

Amazon

Hier eine Grob-Kalkulation für Amazon. Bitte Komma-Zahlen mit Punkt trennen (2.05 anstatt 2,05)

Label Eingabe Ergebnis Prozente Kommentar
Verkaufspreis brutto {{ az_sp }}
MwSt. % {{az_VATValue = 1 + (az_vat / 100);""}} {{az_VATValue_no = az_sp - (az_sp / az_VATValue);"" }} {{az_VATValue_no | number : fractionSize}} {{ az_vat }}
Verkaufspreis netto {{az_NettoPrice = az_sp / az_VATValue;"" }} {{az_NettoPrice | number : fractionSize}}
Einkaufspreis netto {{ az_pc }}
Deckungsbeitrag I {{az_db1 = az_NettoPrice - az_pc;"" }} {{az_db1 | number : fractionSize}} {{az_db1_perc = (az_db1 / az_NettoPrice)*100;"" }} {{az_db1_perc | number : fractionSize}}
Versandkosten in € {{az_verskost}}
Verpackungskosten in € {{az_verpkost}}
Amazon-Gebühr % {{az_FeeValue = 1 + (az_azfee / 100);""}} {{az_FeeValue_no = az_sp - (az_sp / az_FeeValue);"" }} {{az_FeeValue_no | number : fractionSize}} {{az_azfee}}
Deckungsbeitrag II {{az_db2 = az_db1 - az_verskost - az_verpkost - az_FeeValue_no;"" }} {{az_db2 | number : fractionSize}} {{az_db2_perc = (az_db2 / az_NettoPrice)*100;"" }} {{az_db2_perc | number : fractionSize}}
Retourenquote in % {{az_retoure_avrg}}
Versandkosten Retoure {{az_retoure_kost}}
Kosten Retouren in € {{az_retoure_kost_value = az_retoure_avrg * az_retoure_kost;"" }} {{az_retoure_kost_value | number : fractionSize}}
Aussschussquote in % {{az_ausschuss_avrg}}
Abschreibung auf Ausschuss {{az_ausschuss_absch}}
Kosten Ausschuss {{az_ausschuss_absch_value = az_ausschuss_avrg * az_ausschuss_absch * az_pc;"" }} {{az_ausschuss_absch_value | number : fractionSize}}
Reklamationsquote in % {{az_reklamation_avrg}}
Abschreibung auf Reklamation
Kosten Reklamation {{az_reklamation_absch_value = az_reklamation_avrg * az_reklamation_absch * az_pc;"" }} {{az_reklamation_absch_value | number : fractionSize}}
Deckungsbeitrag III {{az_db3 = az_db2 - (az_reklamation_absch_value + az_ausschuss_absch_value + az_retoure_kost_value);"" }} {{az_db3 | number : fractionSize}} {{az_db3_perc = (az_db3 / az_NettoPrice)*100;"" }} {{az_db3_perc | number : fractionSize}}

Nextcloud

Nextcloud-Domain Username

Copy the following to use your contacts Birthdays in CalDAV.


            http(s)://{{oc_domain}}/remote.php/caldav/calendars/{{oc_user}}/contact_birthdays
      
(via)

.htaccess Stuff

Old Domain New Domain

Redirect to another Domain


        RewriteCond %{HTTP_HOST} ^{{ht_old_domain}}$ [OR]
        RewriteCond %{HTTP_HOST} ^www.{{ht_old_domain}}$ [OR]
        RewriteCond %{HTTP_HOST} ^{{ht_new_domain}}
        RewriteRule (.*)$ http://www.{{ht_new_domain}}/$1 [R=301,L]
      

T-Online in Fritz.box

Zugangsdaten

Data for the Fritz.box


        {{to_anschlusskennung}}{{to_nummer}}#{{to_mitbenutzer}}@t-online.de
      

Brutto-Preis Steuern Netto Menge Aufschlag (%)
{{VATValue = 1 + (VATPrice / 100);""}} {{NettoPrice = BruttoPrice / VATValue;"" }} {{NettoPrice | number : fractionSize}}
Ergebnis p.Stck. netto Ergebnis Gesamt netto Ergebnis p.Stck. brutto Ergebnis Gesamt brutto Diff.
{{ NettoPstck = NettoPrice * SurchargeValue / Quantity;""}} {{ NettoPstck | number : fractionSize}} {{SurchargeValue = 1 + (Surcharge /100 );""}} {{ NettoPrice * SurchargeValue | number : fractionSize}} {{ ((NettoPrice * SurchargeValue) / Quantity) * VATValue | number : fractionSize}} {{SurchargeValue = 1 + (Surcharge /100 );""}} {{ NettoPrice * SurchargeValue * VATValue | number : fractionSize}} {{ NettoPstck - (NettoPrice / Quantity) | number : fractionSize }}