Thursday, August 30, 2018

Linux: mount folder to different folders

Code:
mount -o bind /media/disk1/pictures /home/user1/pictures
mount -o bind /media/disk1/pictures /home/user2/pictures
for add a fstab entry to auto-mount at startup.


Code:
/media/disk1/pictures /home/add1cker/pictures none defaults,bind 0 0

Sunday, August 26, 2018

Tuesday, August 21, 2018

Raspberry pi 3


1) user and passwords:
Distribution   | Username   | Password
---------------|------------|-------------
Debian Squeeze | pi         | raspberry
Arch           | root       | root
QtonPi         | root       | rootme
Raspbian       | pi         | raspberry
OpenElec       | root       | openelec
Pidora         | root       | raspberrypi
RISC OS        | n/a        | n/a
raspbmc        | pi         | raspberry
 
2) add users

$sudo adduser username
$usermod -aG sudo username
 
3) Ports
 
$lsof -nP -i | grep LISTEN
$netstat -tlpn | grep LISTEN
 
4) vncserver (reinstall, by default sometime doesn't works)
$sudo apt-get install tightvncserver 

5) Firewalls

iptables -I INPUT -p tcp --dport 5900 -j ACCEPT
iptables -I INPUT -p tcp --dport 5901 -j ACCEPT

Resources:
[1] https://www.digitalocean.com/community/tutorials/how-to-create-a-sudo-user-on-ubuntu-quickstart
[2] direct way https://www.shellhacks.com/how-to-grant-root-access-user-root-privileges-linux/
[3] vncserver https://quaintproject.wordpress.com/2013/03/24/establish-a-vnc-connection-to-your-raspberry-pi-from-a-linux-pc/
 
 
 

Thursday, August 16, 2018

Optimize code C/C++

If you are using linux: use getchar_unlocked() and putchar_unlocked() for taking fast single character I/O.
In Windows the equivalent is getchar() and puchar() repectively



Resources:
[1] fast input/output https://ideone.com/BrsDz4


Enteprise solutions:
[1] http://www.fastformat.org/

Thursday, August 09, 2018

Programming online C++ and others

Online programming tools

Resources:
[1] C++, Python  https://repl.it/@melhorum


[2] Multi Language Support https://code.dcoder.tech/

[3] Account for C/C++, C#, Java  http://rextester.com
[4] http://www.onlinegdb.com/


Wednesday, August 01, 2018

Store on EEUU for Buy


Stores:
[1] https://www.shipito.com/pt/shipito-pricing

Python 2.7 pip


Resolving error on python 2.7 using pip: ImportError: No module named _internal



$wget https://pypi.python.org/packages/e7/a8/7556133689add8d1a54c0b14aeff0acb03c64707ce100ecd53934da1aa13/pip-8.1.2.tar.gz
$tar -xzvf pip-8.1.2.tar.gz
$cd pip-8.1.2
$sudo python setup.py install
 
 
 

Firefox open multiple private window

    /opt/firefox/firefox-bin --profile $(mktemp -d) --private-window www.google.com www.bing.com