Nodimm - Raspbian Kategoria: Linux | Autor: Bartłomiej Gałęzia

https://www.raspberrypi.org/forums/viewtopic.php?t=57552 - nie działa

sudo aptitude install xscreensaver
vim /home/pi/.xscreensaver
mode:           off

PHP Virtualbox installation Kategoria: PHP | Tagi: Virtualbox | Autor: Bartłomiej Gałęzia

https://www.howtoforge.com/managing-a-headless-virtualbox-installation-with-phpvirtualbox-on-ubuntu-...

useradd -m vbox -G vboxusers
passwd vbox
vi /etc/default/virtualbox
VBOXWEB_USER=vbox
update-rc.d vboxweb-service defaults
service vboxweb-service start
apt-get install apache2-mpm-prefork apache2-utils apache2.2-bin  apache2 apache2-doc apache2-suexec libapache2-mod-php5 libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap libapr1 php5-common php5-mysql  php-pear wget
service apache2 restart
cd /var/www/html
wget http://downloads.sourceforge.net/project/phpvirtualbox/phpvirtualbox-4.3-1.zip
unzip phpvirtualbox-4.3-1.zip
mv phpvirtualbox-4.3-1 phpvirtualbox
cd /var/www/html/phpvirtualbox/
cp config.php-example config.php
vi config.php
var $username = 'vbox';
var $password = 'secret';

http://www.example.com/phpvirtualbox/

Błąd podczas instalacji Windows 7 na Virtualboxie.

Kod błędu: 0xc0000225

Rozwiązanie:

Zmiana ustawień maszyny w Virtualboxie:

chipset from PIIX3 to ICH9
enabled IO APIC

https://forums.virtualbox.org/viewtopic.php?f=2&t=37628

Dodawanie nowego Virtual Hosta w Apache 2 Kategoria: Linux | Tagi: apache2 | Autor: Bartłomiej Gałęzia

https://www.digitalocean.com/community/tutorials/how-to-set-up-apache-virtual-hosts-on-ubuntu-14-04-lts


Najpierw tworzymy nowy katalog na pliki strony

sudo mkdir -p /var/www/example.com/public_html


I nadajemy odpowiednie uprawnienia

sudo chown -R $USER:$USER /var/www/example.com/public_html
sudo chmod -R 755 /var/www


Dodajemy nowy plik konfiguracyjny w katalogu /etc/apache2/sites-available

sudo nano /etc/apache2/sites-available/example.com.conf
<VirtualHost *:80>
ServerAdmin admin@example.com
    ServerName example.com
    ServerAlias www.example.com
    DocumentRoot /var/www/example.com/public_html
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

Aktywujemy nową stronę i restartujemy apache

sudo a2ensite example.com.conf
sudo service apache2 restart

Redmine konfiguracja powiadomień e-mail SMTP Kategoria: Linux | Autor: Bartłomiej Gałęzia

vim /usr/share/redmine/config/configuration.yml
# default configuration options for all environments
default:
  # Outgoing emails configuration (see examples above)
  email_delivery:
    delivery_method: :smtp
    smtp_settings:
      address: smtp.domain.com
      port: 587
      domain: domain.com
      authentication: :login
      user_name: "redmine@domain.com"
      password: "password"
cp /usr/share/redmine/config/configuration.yml /etc/redmine/configuration.yml

W wersji 4+

vim /opt/redmine/config/configuration.yml
# default configuration options for all environments
production:
  delivery_method: :smtp
  smtp_settings:
          #    tls: true
    enable_starttls_auto: true
    address: smtp.domain.com
    port: 587
    domain: domain.com
    authentication: :plain
    user_name: "redmine@domain.com"
    password: "redmine_password"
service apache2 restart

OwnCloud - prywatny dropbox Kategoria: Linux | Autor: Bartłomiej Gałęzia

https://owncloud.org/install/

 

aptitude install mc vim nmap screen
 
aptitude install apache2 mysql-server php5 phpmyadmin php5-curl  libqt4-sql-sqlite
 
 
 
mysql -uroot -p
 
CREATE DATABASE owndb;
 
 
 
https://owncloud.org/install/#install-clients

PHP preg_match walidacja kodu pocztowego PL Kategoria: PHP | Tagi: preg_match | Autor: Bartłomiej Gałęzia

$zipcode = '12-312';

preg_match("/^([0-9]{2})[-]?([0-9]{3})?$/i", $zipcode) // true/false


Mount - w bardziej przejrzystej postaci Kategoria: Linux | Autor: Bartłomiej Gałęzia

vim ~/.bashrc
alias mount='mount |column -t'
/dev/sda1         on  /                         type  ext4                   (rw,errors=remount-ro)
proc              on  /proc                     type  proc                   (rw,noexec,nosuid,nodev)
sysfs             on  /sys                      type  sysfs                  (rw,noexec,nosuid,nodev)
none              on  /sys/fs/fuse/connections  type  fusectl                (rw)
none              on  /sys/kernel/debug         type  debugfs                (rw)
none              on  /sys/kernel/security      type  securityfs             (rw)
udev              on  /dev                      type  devtmpfs               (rw,mode=0755)
devpts            on  /dev/pts                  type  devpts                 (rw,noexec,nosuid,gid=5,mode=0620)
tmpfs             on  /run                      type  tmpfs                  (rw,noexec,nosuid,size=10%,mode=0755)
none              on  /run/lock                 type  tmpfs                  (rw,noexec,nosuid,nodev,size=5242880)
none              on  /run/shm                  type  tmpfs                  (rw,nosuid,nodev)

Scroll Out - email firewall Kategoria: Linux | Tagi: email, firewall, postfix | Autor: Bartłomiej Gałęzia

Adminer - one-file phpmyadmin Kategoria: PHP | Tagi: mysql, phpmyadmin | Autor: Bartłomiej Gałęzia

SSH - wymiana kluczy - automatyczne logowanie Kategoria: Linux | Tagi: ssh | Autor: Bartłomiej Gałęzia

https://www.digitalocean.com/community/tutorials/how-to-set-up-ssh-keys--2

ssh-keygen
ssh-copy-id user@11.22.33.44 //remote machine
ssh user@11.22.33.44 //nopassword

Rsync - tutorial Kategoria: Linux | Tagi: Rsync | Autor: Bartłomiej Gałęzia

http://linux.die.net/man/1/rsync

http://www.thegeekstuff.com/2010/09/rsync-command-examples/

 

sudo aptitude install rsync

rsync -av root@10.20.30.1:/home/* /mnt/home

 

-a option is a combination flag. It stands for "archive" and syncs recursively and preserves symbolic links, special and device files, modification times, group, owner, and permissions.

-z If you are transferring files that have not already been compressed, like text files, you can reduce the network transfer by adding compression with the -z option:

-P flag is very helpful. It combines the flags --progress and --partial. The first of these gives you a progress bar for the transfers and the second allows you to resume interrupted transfers

Samba Domain - Remove machine Kategoria: Linux | Tagi: samba | Autor: Bartłomiej Gałęzia

http://superuser.com/questions/446603/samba-domain-controller-remove-1-windows-client

pdbedit -L -w | grep '\[[WI]'  //lista komputerów podłączonych do domeny
pdbedit -L -w | grep '\[[WI]' | grep machine_name
pdbedit -x -m machine_name //usuń komputer

Postfix diagnozowanie SPAMu Kategoria: Linux | Tagi: mail, postfix | Autor: Bartłomiej Gałęzia

http://www.tech-g.com/2012/07/15/inspecting-postfixs-email-queue/

postqueue -p //sprawdz kolejkę maili

postcat -vq XXXXXXXXXX //pokaż wiadomość z kolejki wg ID

postqueue -f //wykonaj bierzącą kolejkę - flush

postsuper -d ALL //usuń całą kolejkę


znajdź adresata SPAMu:
regular_text: (Authenticated sender: user@domena.pl)

i zmień mu hasło / zablokuj konto

http://stackoverflow.com/questions/23136947/javascript-regex-to-return-letters-only

var matches = sequence.match(/[a-zA-Z0-9]+/g);

matches = matches.toString(); //musi być przekonwertowany na string inaczej replace() to nie obsłuży

matches = matches.replace(/,/g,''); //2 zawiasy kwadratowe dają przecinek który trzeba usunąć

matches = matches.toLowerCase();

Redmine instalacja - Debian 10 Kategoria: WWW | Tagi: redmine | Autor: Bartłomiej Gałęzia

Required packages

aptitude install build-essential ruby-dev libxslt1-dev libmariadb-dev libxml2-dev zlib1g-dev imagemagick libmagickwand-dev curl vim sudo apache2 libapache2-mod-passenger ufw subversion mariadb-server mariadb-client
aptitude install php php-mysql # jeśli potrzebujemy php do phpmyadmin lub adminer

Test

ruby -v
useradd -r -m -d /opt/redmine -s /usr/bin/bash redmine
usermod -aG redmine www-data

Zobacz całość