Wednesday, December 14, 2016

Blockstack Guide

https://blockstack.org/articles/browser-beta
:https://github.com/blockstack/blockstack-cli
:pip install --upgrade setuptools pip
:apt-get install libffi-dev
brew install libffi openssl
virtualenv -p /usr/bin/python2.7 blockstack-cli-venv
source blockstack-cli-venv/bin/activate
pip install --upgrade pip
pip install --upgrade blockstack

$ sudo pip install virtualenv
$ virtualenv /tmp/blockstack-install
$ cd /tmp/blockstack-install
$ source bin/activate
(blockstack-install) $ pip install blockstack

Friday, September 16, 2016

Summary of my SMSbots

mm-1.4.2.tar.gz

sudo make clean
sudo chmod +x *.*


sudo apt-get install virtualbox-guest-utils virtualbox-guest-x11 virtualbox-guest-dkms
sudo reboot
sudo apt-get install virtualbox-guest-utils virtualbox-guest-x11 virtualbox-guest-dkms
sudo reboot
sudo apt-get install build-essential manpages-dev
nano /etc/hosts
sudo nano /etc/hosts
sudo nano /etc/hostname
sudo apt-get update
sudo apt-get install gcc
sudo apt-get install build-essential
sudo reboot now
ls
cd Downloads/
ls
cd smstools3/
ls
cd scripts/
ls
cat README
cd ..
sudo ./install.sh
sudo make -s install
nano /etc/smsd.conf
ls
cd ..
ls
cd mm-1.4.2/
ls
sudo ./configure
ls
sudo make
sudo make install
cd ~
sudo tail -f /var/log/syslog
sudo apt-get install usb-modeswitch gsm-utils
sudo apt-get install usb-modeswitch gsm-utils --fix-missing
sudo apt-get install usb-modeswitch
lsusb
ls
cd Downloads/
ls
cd usb-modeswitch-2.3.0/
ls
sudo make
sudo make install
sudo tail -f /var/log/syslog
sudo apt-get install usb-modeswitch gsm-utils
sudo tail -f /var/log/syslog
sudo reboot now
gksu nautilus
sudo tail -f /var/log/syslog
lsusb
sudo apt-get install usb-modeswitch gsm-utils
sudo tail -f /var/log/syslog
cd /sys/class/tty/
readlink ttyUSBn
cd /sys/devices
find -name "ttyUSB0"
cd ~
lsdev
sudo apt-get install procinfo
lsdev
ls -l /dev/tty*
dmesg
sudo echo "SMS Test Message" | gsmsendsms -d /dev/ttyUSB0 -b 19200 +601120209999
sudo echo "SMS Test Message" | gsmsendsms -d /dev/ttyUSB1 -b 19200 +601120209999
sudo echo "SMS Test Message" | gsmsendsms -d /dev/ttyUSB3 -b 19200 +601120209999
udevadm info -a -p /sys/bus/usb-serial/devices/ttyUSB0/
screen /dev/ttyUSB0
sudo apt-get install screen
screen /dev/ttyUSB0
screen /dev/ttyUSB1
screen /dev/ttyUSB2
ls -l /dev/ttyUSB0
ls -l /dev/ttyUSB1
ls -l /dev/ttyUSB2
ls -l /dev/ttyUSB3
ls -l /dev/ttyUSB4
ls -l /dev/ttyUSB5
ls -l /dev/ttyUSB01
dmseg
dmsg
dmesg
ls -l /dev/
pppd call huaweiparam
ls -l /dev/ttyUSB*
sudo ls -l /dev/ttyUSB*
sudo su
udevadm info --query all -name /dev/ttyUSB0 --attribute-walk
sudo udevadm info --query all -name /dev/ttyUSB0 --attribute-walk
ls -l /sys/bus/usb-serial/devices
sudo ls -l /sys/bus/usb-serial/devices
/usr/local/bin/smsd -s
sudo /etc/init.d/sms3 start
sudo /usr/local/bin/smsd -s
sendsms 601120209999 'Hello, how are you'
sudo sendsms 601120209999 'Hello, how are you'
cat /var/spool/sms/outgoing
sudo cat /var/spool/sms/outgoing
cd /var/spool/sms/outgoing
sudo cd /var/spool/sms/outgoing
cd /var/spool/sms/
sudo su
sudo /etc/init.d/sms3 stop
wget ftp://ftp.ossp.org/pkg/lib/mm/mm-1.4.2.tar.gz
ls
cd Downloads/
ls
cd mm-1.4.2/
ls
sudo make install
cd /usr/local/bin/smsd -s
sudo /usr/local/bin/smsd -s
sudo cat /var/log/smsd.log
cd /usr/local/src
ls
cd mm-1.4.2/
ls
sudo ./configure
sudo make
sudo make install
sudo nano /etc/ld.so.conf
cd ~
ls
cd Downloads/
ls
cd smstools3/
ls
sudo /etc/init.d/sms3 start
sudo /etc/init.d/sms3 stop
sudo /usr/local/bin/smsd -s
sudo nano /etc/ld.so.conf
sudo /usr/local/bin/smsd -s
sudo nano /etc/ld.so.conf
ldconfig
sudo ldconfig
sudo /usr/local/bin/smsd -s
sudo nano /etc/ld.so.conf
sudo ldconfig
sudo /usr/local/bin/smsd -s
sudo nano /etc/ld.so.conf
sudo ldconfig
whereis smsd.conf.full,
whereis smsd.conf.full
cat /etc/smsd.conf
lsdev
lsusb
sudo tail -f -n1 /var/log/smsd.status
sudo apt-get install gnome-system-tools
lsusb
lsdev
dmesg
sudo /etc/init.d/sms3 start
sudo sendsms 601120209999 'Hello, how are you'
sudo tail -f -n1 /var/log/smsd.status
sudo cat /var/log/smsd.log
dmesg | grep ttyS
dmesg | grep tty
dmesg | grep usb
ls -l /dev/ttyUSB*
dmesg
lsusb
sudo modprobe usbserial vendor=0x12d1 product=0x14db
dmesg
ls -l /dev/ttyUSB*
sudo ls -l /dev/ttyUSB*
sync
reboot now
sudo reboot now
dmesg
sudo usbserial vendor=0x12d1 product=0x14db
usbserial vendor=0x12d1 product=0x14db
sudo modprobe usbserial vendor=0x12d1 product=0x14db
dmesg
lsusb
lsdev
sudo ls -l /dev/ttyUSB*
sudo ls -l /dev/tty*
cd /etc/modules
sudo nano /etc/modules
sudo reboot now
gksu nautilus
sudo ls -l /dev/tty*
lsdev
sudo ls -l /dev/ttyUSB*
dmesg
sudo /etc/init.d/sms3 start
sudo sendsms 601120209999 'Hello, how are you'
sudo tail -f -n1 /var/log/smsd.status
sudo cat /var/log/smsd.log
sudo nano /etc/smsd.conf
sudo /etc/init.d/sms3 stop
sudo nano /etc/smsd.conf
sudo /etc/init.d/sms3 start
sudo sendsms 601120209999 'Hello, how are you'
sudo cat /var/log/smsd.log
sudo /etc/init.d/sms3 stop
dmesg
sudo /etc/init.d/sms3 start
sudo sendsms 601120209999 'Hello, how are you'
sudo cat /var/log/smsd.log
sudo /etc/init.d/sms3 stop
lsusb
dmesg

gksu nautilus


# Example smsd.conf. Read the manual for a description

devices = GSM1
logfile = /var/log/smsd.log
loglevel = 7

[GSM1]
device = /dev/ttyUSB0
incoming = yes
pin = 0123
baudrate = 19200

Saturday, April 23, 2016

Summary of my Telebots

echo -ne "\033[9;0]" >> /etc/issue
sudo vi /etc/apt/sources.list
sudo nano /etc/ssh/sshd_config
sudo nano /etc/ssh/ssh_config
sudo service ssh restart
sudo reload ssh
sudo apt-get install openssh-server

sudo apt-get install git
sudo git clone addressurl
sudo apt-get install python3-pip
python3 --version
pip3 install python-telegram-bot
pip3 install future
python3 -c "import telegram;print(telegram.__version__)"

sudo ssh-keygen -t rsa
sudo ssh-copy-id username@server
sudo rsync -a bot.sqlite -e "ssh -p 1234" username@server:/home/admin/Backup
echo "1234" | sudo -S rsync -a /home/username/python-telegram/bot.sqlite -e "ssh -p 1234" username@server:/home/username/Backup/??/bot-1m.sqlite


https://pypi.python.org/pypi/python-telegram-bot/1.4
https://pypi.python.org/pypi/python-telegram-bot#downloads
Newbie Guide - https://python-telegram-bot.org/
TempSend - http://tempsend.com/

Friday, April 22, 2016

rsync Tips

sudo rsync -a bot.sqlite -e "ssh -p 1234" admin@server:/home/admin/Backup

Tuesday, April 12, 2016

Python Version

Python2 is the default Python version in Ubuntu. To change to python3, you can use the following command:

alias python=python3

This will change the default version to Python3.

To revert back:

alias python=python2

Saturday, April 9, 2016

How to setup crontab ubuntu server terminal without sudo?

I won't get into how much this is a bad idea; simply put, running sudoin crontab requires your password to be stored somewhere in plaintext.
It's a bad idea.

The following is the preferred method of running administrative tasks through cron. Since you don't really need to write sudo in the crontab, if you are modifying root's crontab.

Use root's crontab

Run the following command:
sudo crontab -e
This opens up root's crontab. sudo is not necessary to run your command in this context, since it'll be invoked as root anyway.
Therefore, you would simply append the following to root's crontab.
@hourly rm somefile

Now, if you absolutely want to be unsafe and take risks with your password, the following will run your command from your own crontab, and enter your password automatically when prompted by sudo.
Again, this is not recommended.

In your own crontab, write your command like so:
@hourly echo "password" | sudo -S rm somefile
The obvious disadvantage here is that, should anyone ever access your crontab, your password will be readable in plaintext.
You shouldn't do this.
shareimprove this answer
   
I got it, thanks a lot – sayem siam Aug 9 '12 at 18:11
1 
Glad it works! Just be wary of any security holes you leave behind.. They might come back later to haunt you. – SirCharlo Aug 9 '12 at 18:15
1 
@SirCharlo Why use root's user crontab instead of the systemwide crontab /etc/crontab? – Eliah Kagan Aug 10 '12 at 3:47
1 
@Elijah why not? – SirCharlo Aug 11 '12 at 4:43
If you are putting the script from one of the cron directories (/etc/cron.*) then you don't need to use sudo as that is running as root.
If you are using crontab, then you will want to use root's crontab. This will run it as root, and also not need sudo.
sudo crontab -e
shareimprove this answer
   
I would also place the command in /etc/cron.hourly/something. That's what these directories are for. – John S Gruber Aug 23 '12 at 15:37
2 
No. You could put it in /etc/cron.SOMETHING/SCRIPT, but I wouldn't do both. Both would give roughly the same function, although using crontab you would have a bit more power over how often/when things run. – tgm4883 Aug 23 '12 at 17:40
   
I should have made clear that I meant that as an alternative. Thanks. – John S Gruber Aug 23 '12 at 17:43

Run following command in terminal
sudo visudo
Added the following line to the end of the file:
vidyadhar  ALL= NOPASSWD: /bin/rm
In the above example vidyadhar is the username and it will not ask for password if you are running rm command through vidyadhar.

How to disable blank screensaver on Ubuntu Server?

Prevent screen from turning off

You can run this command:
$ setterm -blank 0 -powerdown 0
Alternatively you can disable console blanking permanently using the following command:
# echo -ne "\033[9;0]" >> /etc/issue


Type setterm -blank 0 on any shell to disable blanking out of tty consoles.
Type sudo xset s 0 0
0 disables blanking, any value greater than 0 is the time in minutes. Default is 10.
To permanently enable this you can add this line to your ~/.bashrc config.