Autor - Bartłomiej Gałęzia - liczba wpisów 450

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ść

Grep advanced Kategoria: Linux | Tagi: grep | Autor: Bartłomiej Gałęzia

grep --include=\*.{txt,sas} -rnw '/jakas/sciezka/' -e "fraza"
wyszuka slowa fraza w podanej sciezce ale tylko w plikach txt i sas

Szyfrowanie pliku w VIM Kategoria: Linux | Tagi: vim | Autor: Bartłomiej Gałęzia

vim +X plik

lsblk - dyski w przyjazny sposób Kategoria: Linux | Autor: Bartłomiej Gałęzia

http://manpages.courier-mta.org/htmlman8/lsblk.8.html

Zmiana domyślnego edytora w MC Kategoria: Linux | Tagi: mc, ssh | Autor: Bartłomiej Gałęzia

sudo update-alternatives --config editor

lub

vim .bashrc
export EDITOR=vim

albo http://askubuntu.com/questions/16776/how-to-switch-the-editor-in-mc-midnight-commander-from-nano-to-mcedit

Facebook messenger na Pidginie Kategoria: Linux | Tagi: fb | Autor: Bartłomiej Gałęzia

sudo vim /etc/apt/sources.list
deb http://download.opensuse.org/repositories/home:/jgeboski/xUbuntu_14.04/ ./
wget -O- https://dl.voidium.net/jgeboski/obs.key | sudo apt-key add -
sudo aptitude update
sudo apt-get install purple-facebook

http://www.linux.pl/publikacje/artykuly/93-oprogramowanie/200-pidgin-wlaczenie-obslugi-wiadomosci-facebook

XEN instalacja maszyny wirtualnej Kategoria: Linux | Tagi: lvm, xen | Autor: Bartłomiej Gałęzia

instalacja wolumenu

lvcreate -n nazwa_wolumenu -L 100G nazwa_grupy

ściągamu iso płyty instalacyjnej i kopiujemy z niego kernel i ramdisc

wget -c http://cdimage.debian.org/debian-cd/8.3.0/amd64/iso-cd/debian-8.3.0-amd64-netinst.iso
mount -t iso9660 iso-cd/debian-8.3.0-amd64-netinst.iso /mnt/iso/
cp /mnt/iso/install.amd/vmlinuz /xen/kernels/debian8.3/vmlinuz
cp /mnt/iso/install.amd/initrd.gz /xen/kernels/debian8.3/initrd.gz

Zobacz całość

LVM - zarządzanie Kategoria: Linux | Tagi: lvm, xen | Autor: Bartłomiej Gałęzia

lvdisplay #wyświetl stan wolumenu
vgdisplay #wyświetl grupy wolumenów

lvcreate -n testDebian -L 30G xenvms #tworzy wolumen o rozmiarze 30GB w grupie xenvms

umount /dev/myvg/homevol
lvremove /dev/myvg/homevol #odmontuj i usuń wolumen

Przekierowanie z www na bez www Kategoria: WWW | Tagi: htaccess | Autor: Bartłomiej Gałęzia

.htaccess

RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^ https://%1%{REQUEST_URI} [L,R=301,NE]

 

http://stackoverflow.com/questions/21467329/htaccess-force-https-and-redirect-www-to-non-www-but-no-other-subdomains

Przekierowanie z http na https Kategoria: WWW | Tagi: htaccess | Autor: Bartłomiej Gałęzia

.htaccess

RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

 

http://stackoverflow.com/questions/26620670/apache-httpx-forwarded-proto-in-htaccess-is-causing-redirect-loop-in-dev-envir

PHP object - jak znaleźć jego metody Kategoria: PHP | Autor: Bartłomiej Gałęzia

http://php.net/manual/en/function.get-class-methods.php

 $class_methods = get_class_methods($response);
    print_r($class_methods);