This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://www.digitalocean.com/community/tutorials/how-to-set-up-jupyter-notebook-with-python-3-on-ubuntu-18-04 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://imgur.com/UN2Cjwj | |
https://imgur.com/a/UzOz3u5 | |
<blockquote class="imgur-embed-pub" lang="en" data-id="a/UzOz3u5" data-context="false" ><a href="//imgur.com/a/UzOz3u5"></a></blockquote><script async src="//s.imgur.com/min/embed.js" charset="utf-8"></script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
It can also be done by using xdg-open filename. | |
Command will open the file with it's default application and it also used to open the urls . |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
= = | |
https://robertheaton.com/2014/02/09/pythons-pass-by-object-reference-as-explained-by-philip-k-dick/ | |
This article makes things complicated. | |
Forget about the box metaphore in it. | |
Variablea are copied to functions by address. | |
Inside a function, while some operations (like .append()) are applied through dereferencing , | |
others like reassignment are done by assigning a new address. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://stackoverflow.com/questions/24815771/python-inverse-function-of-id-built-in-function | |
================================ | |
Is there a reverse or inverse of the id built-in function? | |
I was thinking of using it to encode and decode string without taking too much time or having a lot of overhead like the PyCrypto library. | |
The need for me is quite simple so I don't want to use PyCrypto for a simple encode and decode. | |
Something like: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def ran_check1(num, low, high): | |
return int(num in range(low, high)) | |
def ran_check2(num,low,high): | |
if num in range(low,high): | |
print('{num} is not in the range of {low} and {high}') | |
else: | |
print('{num} is not in the range of {low} and {high}') | |
ran_check1(1,2,3) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://askubuntu.com/questions/92794/how-to-change-critically-low-battery-value | |
I would like my laptop to hibernate itself when the battery level is 10% to be sure it has enough power to complete the operation properly. Actually if I don't pay attention my laptop informs me it will hibernate when it's too late, so instead it brutally shuts down. This kills lithium batteries and is not acceptable. | |
Start dconf-editor | |
Browse to org -> gnome -> settings-daemon -> plugins -> power | |
Change the values of percentage-critical and percentage-action to the level you require |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Unpacking With the Asterisk Operators: * & ** | |
https://realpython.com/python-kwargs-and-args/#unpacking-with-the-asterisk-operators |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> "You get {product} when you multiply {1} with {0}".format(5.5, 3, product=16.5) | |
'You get 16.5 when you multiply 3 with 5.5' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://stackoverflow.com/questions/8452961/convert-string-to-ascii-value-python | |
>>> s = 'hi' | |
>>> [ord(c) for c in s] | |
[104, 105] | |
>>> s = "hello world" | |
>>> ''.join(str(ord(c)) for c in s) | |
'10410110810811132119111114108100' |