Django – set new user password

Show Django user

(virtualenv)$ htapp/django_root$ python shell
>>> from django.contrib.auth.models import User
>>> User.objects.filter(is_superuser=True)

Set new Password

>>> usr = User.objects.get(username='USER')
>>> usr.set_password('PASSWORD')
>>> exit()


 yum install ipset
iptables -I INPUT -m set --match-set blacklist src -j DROP
iptables -A FORWARD -m set --match-set blacklist src -j DROP
 ipset create blacklist hash:ip hashsize 4096
 ipset add blacklist
 ipset add blacklist

Send mails with php mail() and ssmpt

apt-get install ssmtp

vim /etc/ssmtp/ssmtp.conf


grep -n sendmail_path /etc/php/7.0/cli/php.ini

sendmail_path = /usr/sbin/ssmtp -t
$empfaenger = "";
$betreff = "Die Mail-Funktion";
$from = "From: Sender <sender@seo.exor>";
$text = "Data";

mail($empfaenger, $betreff, $text, $from);

Ansible – deploy ssh key

- name: deploy ssh key
  hosts: server
  remote_user: root
  gather_facts: no
  - name: deploy my key
    authorized_key: user=root key="{{ lookup('file', '~/.ssh/') }}"

Mac OS-X – install apache2 php56

install xcode

Einstellungen -> AppStore -> Suche -> XCode
xcode-select --install
brew update; brew doctor
brew install -v git
sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist
brew tap homebrew/dupes
brew tap homebrew/apache
brew -v install homebrew/apache/httpd24 --with-brewed-openssl
brew -v install homebrew/php/php56 --with-apache

vim $(brew –prefix)/etc/apache2/2.4/httpd.conf

<IfModule php5_module>
  <IfModule dir_module>
    DirectoryIndex index.php index.html

  <FilesMatch "\.php$">
    SetHandler application/x-httpd-php
  <FilesMatch "\.phps$">
    SetHandler application/x-httpd-php-source

vim $(brew –prefix)/etc/apache2/2.4/httpd.conf

Listen 80
LoadModule php5_module "/usr/local/php5/" 
sudo brew -v services start homebrew/apache/httpd24
sudo brew -v services stop homebrew/apache/httpd24
sudo cp /System/Library/LaunchDaemons/org.apache.httpd.plist /Library/LaunchDaemons/my.apache.httpd.plist

vim /Library/LaunchDaemons/my.apache.httpd.plist

   <?xml version="1.0" encoding="UTF-8"?>
   <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "">
   <plist version="1.0">
sudo launchctl load -w /Library/LaunchDaemons/my.apache.httpd.plist
apachectl start http24


  • mac-os-x-apache-setup
  • installing-php56-mac-osx/a>
  • Local_Web_Server_on_Mac_OS_X
  • apache-php-and-mysql-homebrew
  • install.unix.apache2
  • wp-cli – wordpress install

    wp core download
    wp core config --dbname=wpdb --dbuser=wpdb --dbpass=geheim
    chmod 644 wp-config.php
    wp core install --title="My Site" --admin_name=wpadmin --admin_password='4Long&Strong1'
    chmod 777 uploads

    Check user passwords

    LOGINUSERS="$(cut -d: -f 1 /etc/passwd)"; for u in $LOGINUSERS; do passwd -S $u | awk '/P|L|NP/ {print $2,$1}'; done | sort
    cat /etc/shadow

    compare two files (diff)

    Lines only in list 01

    comm -23 01.list 02.list

    Lines only in list 02

    comm -13 01.list 02.list

    Lines in list 01 and list 02

    comm -12 01.list 02.list

    curl – htpasswd login

    curl -u "user:pass"

    WordPress – wp-cli: change site name replace

    wp search-replace '' '' --dry-run
    wp option update home ''
    wp option update siteurl ''
    Return top