Re-download with wget
's -c (--continue):
wget -c https://ftp.fastsite.edu/images/bigimage.iso
- ۰ نظر
- ۰۵ اسفند ۰۲ ، ۲۳:۳۱
Re-download with wget
's -c (--continue):
wget -c https://ftp.fastsite.edu/images/bigimage.iso
Open a terminal and run sudo umount /tmp
or, if that fails, sudo umount -l /tmp
and then:
sudo mount -t tmpfs -o size=7G,mode=1777 overflow /tmp
sudo mount -t tmpfs -o size=7G,mode=1777 overflow /dev/tmp
or
mount -o remount,size=5G /tmp/
print size of /tmp:
df -h /tmp
Connect your phone to PC via USB and then open a CMD (asume adb is installed):
List devices:
adb devices
To list all packages:adb shell pm list packages
For remove a package:
adb shell pm uninstall -k --user 0 com.android.chrome
or
adb uninstall --user 0 com.android.chrome
To open an ADB shell:
adb shell
List all of the currently installed packages:
pm list packages
Uninstall the app(s):
pm uninstall -k --user 0 package name
ex:
pm uninstall -k --user 0 com.google.android.youtube
Change directory:
cd /storage/self/primary/Download
Install an apk:pm install -r --user 0 com.android.chrome.apk
واسط ارتباطی بین برنامه ها و سیستم عامل در Android را ABI گویند که دو مورد از مهمترین ABI ها : arm64-v8a و armeabi-v7a می باشد.
گوشی Xiaomi Redmi 4 (4X) از نوع arm64-v8a می باشد.
برای نمایش درست فارسی در خروجی ها بهتر است فایل launch.json را بشکل زیر تغییر داد:
{ "version": "0.2.0", "configurations": [ { "name": "Python: Current File", "type": "python", "request": "launch", "program": "${file}", //"console": "integratedTerminal", "console": "internalConsole", "justMyCode": false, } ] }
please update your PCI ID database with:
sudo update-pciids
And use the following command in your terminal:
lspci -nn | grep '\[03'
From the comment:
sudo update-alternatives --config python
Will show you an error:
update-alternatives: error: no alternatives for python3
You need to update your update-alternatives
, then you will be able to set your default python version.
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.4 1
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.6 2
Then run :
sudo update-alternatives --config python
Set python3.6 as default.
Or use the following command to set python3.6 as default:
sudo update-alternatives --set python /usr/bin/python3.6
ضریب همبستگی پیرسون یا Pearson correlation coefficient :
ضریب همبستگی ابزاری آماری برای تعیین نوع و درجهٔ رابطهٔ یک متغیر کمی با متغیر کمی دیگر است. ضریب همبستگی، یکی از معیارهای مورد استفاده در تعیین همبستگی دو متغیر است. ضریب همبستگی شدت رابطه و همچنین نوع رابطه (مستقیم یا معکوس) را نشان میدهد. این ضریب بین ۱ تا ۱- است و در صورت عدم وجود رابطه بین دو متغیر، برابر صفر است.
If you want to run a python script in the background you can use an ampersand(&). But at first, we need to prepare our script for this.
For example, we have a python file my_script.py
. At first, we need to add execution permission for this file using the next command:
chmod +x my_script.py
Then I recommend adding a shebang line to the top of this file. This allowed you don't indicate in the terminal that it is a python script.
#!/usr/bin/env python3
Now we need some logic that will show us that the script is running in the background. For example, a simple script that will have been printing time during the next ten seconds.
Script content:
#!/usr/bin/env python3 from datetime import datetime start_time = datetime.now() print(f"Start time: {datetime.now().strftime('%H:%M:%S')}") interval = 10 while interval != 0: if (datetime.now() - start_time).seconds == 1: start_time = datetime.now() print(f"Current time: {datetime.now().strftime('%H:%M:%S')}") interval -= 1
For running the script use the next command:
your/path/my_script.py > output.log &
We save the script's output to the log file, so after running this command we will get output like this in the terminal:
[1] 3010186
This is a process id (PID). If you want to stop the script before its ending you can use the kill command:
kill PID
It is also possible to kill the process by using pkill command. If you run a few scripts with the same name they all will be stopped.
pkill -f my_script.py
We can see our process using the next command:
ps ax | grep my_script.py
Command output:
3010186 pts/0 R 0:03 python3 ./my_script.py 3012286 pts/1 S+ 0:00 grep --color=auto my_script.py
After finishing the process all script output will be saved to output.log. It has the next content:
Start time: 10:46:21 Current time: 10:46:22 Current time: 10:46:23 Current time: 10:46:24 Current time: 10:46:25 Current time: 10:46:26 Current time: 10:46:27 Current time: 10:46:28 Current time: 10:46:29 Current time: 10:46:30 Current time: 10:46:31
The background script seems to work perfectly, but it's not quite true. For example, if you use ssh session connection, the disconnect will stop our script. As a solution, you could use nohup or a better screen. This allows us to return to the script after reconnecting the session.
At first, you need to install the screen. Use the next command for this:
sudo apt install screen
Now we can run our script using the screen command. We need a little to modify the command for the identical logging as in the previous heading. For that, we need to add the next keys: -L for resolving logging and -Logfile path/to/filename.log to indicate log file (by default screenlog.0)
screen -L -Logfile ./output.log ./my_script.py &
Despite the screen output, logging still saves to our log file.
Let's check the process list during performing the screen command using the next command:
ps ax | grep my_script.py
Command output:
3038184 pts/0 S 0:00 screen -L -Logfile ./output.log ./my_script.py 3038185 ? Ss 0:00 SCREEN -L -Logfile ./output.log ./my_script.py 3038186 pts/3 Rs+ 0:03 python3 ./my_script.py 3038214 pts/1 S+ 0:00 grep --color=auto my_script.py
You can also detach the screen using Ctrl + a and also return back to the screen using the command screen -r.
استفاده ستاره در پارامتر های ارسالی:
def foo(a, b, c): return(a, b, c) t = (1, 4, 6) print('Output tuple unpacking: ',foo(*t)) d = {'a': 10, 'b': 20, 'c': 30} print('Output dictionary unpacking: ',foo(*d)) print('Output dictionary unpacking: ',foo(**d))
خروجی:
Output tuple unpacking: (1, 4, 6) Output dictionary unpacking: ('a', 'b', 'c') Output dictionary unpacking: (10, 20, 30)
استفاده در آرگمان:
def test_var_args(farg, *args): print ("formal arg:", farg) for arg in args: print ("another arg:", arg) test_var_args(1, "two", 3) def test_var_kwargs(farg, **kwargs): print ("formal arg:", farg) for key in kwargs: print ("another keyword arg: %s: %s" % (key, kwargs[key])) test_var_kwargs(farg=1, myarg2="two", myarg3=3)
خروجی:
formal arg: 1 another arg: two another arg: 3 formal arg: 1 another keyword arg: myarg2: two another keyword arg: myarg3: 3