jQuery



\!h Click onclick 

--- когда элемент есть всегда ---
jQuery('.your-class').on('click', function(){
	console.log(this)
});

--- когда элемент появляется не сразу, генерится джеесом ---
jQuery(document).on('click', '.your-class' , function(){
	console.log(this)
});

Add a user to sudoer

sudo nano /etc/sudoers

##
## User privilege specification
##
root ALL=(ALL) ALL
%admin  ALL=(ALL) ALL
eric.nahon ALL=(ALL) ALL
eric.nahon-dev ALL=(ALL) ALL

sudo cat /etc/sudoers

#Change user password
sudo passwd username

SFTP users

sudo nano  /etc/ssh/sshd_config

# Comment out and add a line like below

#Subsystem sftp /usr/lib/openssh/sftp-server
Subsystem sftp internal-sftp
Add at the last

Match Group sftp_users
  X11Forwarding no
  AllowTcpForwarding no
  ChrootDirectory /ftpusers
  ForceCommand internal-sftp
  
Match User ftpCo@chN1m3s
  ChrootDirectory %h
  ForceCommand internal-sftp
  AllowTCPForwarding no
  X11Forwarding no
  

Subsystem sftp internal-sftp -f AUTH -l VERBOSE
UsePAM yes

Match group sftp
  ChrootDirectory %h
  ForceCommand internal-sftp
  AllowTcpForwarding no
  
# create group sftp:
groupadd sftp
# Create directory
sudo mkdir /ftpusers
sudo mkdir /ftpusers/HomeFolder

# Create user directly with new sftp group attached:
sudo useradd -d /ftpusers/coachnimes -m cvid@l -g sftp_users -s /bin/false
sudo passwd cvid@l
!co@chN1m3s!

sudo useradd -d /ftpusers/coachnimes -g sftp_users -s /bin/false ftpCo@chN1m3s
sudo passwd ftpCo@chN1m3s
!cvid@l2016!

# or
sudo usermod -G sftp_users ftpCo@chN1m3s

Lancer un serveur Minecraft avec screen

screen -dmS minecraft_server java -Xms1024M -Xmx1024M -jar minecraft_server.jar
screen -list
screen -r

# to detach from screen
ctrl ad

# To de-attach without killing the server, hit CTRL+A+D.
# To kill the server, hit CTRL+C.

Installer zip et créer une archive zip

sudo apt-get install zip unzip
zip radiabat.zip radiabat.sql

Available disk space

df -h

Create SSL certificate

# Your SSL key and certificate and key must be concatenated into a single file.
# The order is important: key then certificate.
# For the default snakeoil certificate referenced in the example configuration above:

apt-get install ssl-cert
make-ssl-cert generate-default-snakeoil --force-overwrite
cd /etc/ssl
cat private/ssl-cert-snakeoil.key certs/ssl-cert-snakeoil.pem > snakeoil.pem

Unpack a rar archive

# unrar archive
tar xvzf myarchive.tar.gz

Connexion SSH avec pem file

ssh -i /Volumes/Work/Dropbox/Documents/AWS/.ssh/acist.pem ubuntu@54.244.235.61

Rendre un fichier exécutable

# Rendre un fichier exécutable
sudo chmod +x /path/to/script.sh

# To launch the script
sudo ./path/to/script.sh

Check USB Serial port

lsusb
dmesg

Installing 32bits libraries

sudo apt-get install ia32-libs

Tester le port 3306

nmap -p 3306 10.181.195.53

Copy folder (recursive)

cp -Ri /home/acist/Documents/radiabat/RadiabatServer /home/acist/Documents/radiabat/Backups/RadiabatServer_v1.06

Goto home folder

cd ~

Convert .iso to .img

hdiutil convert -format UDRW -o ~/path/to/target.img ~/path/to/ubuntu.iso