sudo apt install libxcb1-dev libxcb-keysyms1-dev libpango1.0-dev \
libxcb-util0-dev libxcb-icccm4-dev libyajl-dev \
libstartup-notification0-dev libxcb-randr0-dev \
libev-dev libxcb-cursor-dev libxcb-xinerama0-dev \
libxcb-xkb-dev libxkbcommon-dev libxkbcommon-x11-dev \
autoconf libxcb-xrm0 libxcb-xrm-dev automake \
This guide is targetted at intermediate or expert users who want low-level control over their Python environments.
When you're working on multiple coding projects, you might want a couple different version of Python and/or modules installed. This helps keep each workflow in its own sandbox instead of trying to juggle multiple projects (each with different dependencies) on your system's version of Python. The guide here covers one way to handle multiple Python versions and Python environments on your own (i.e., without a package manager like conda
). See the Using the workflow section to view the end result.
adb help // List all comands | |
== Adb Server | |
adb kill-server | |
adb start-server | |
== Adb Reboot | |
adb reboot | |
adb reboot recovery | |
adb reboot-bootloader |
SSSP Algorithm
Problem Used https://leetcode.com/problems/network-delay-time/
Time Complexity Dijkstra - V + ElogE - SSSP Time Complexity of Dijkstra's Algorithm is O(V^2) but due to minheap it drops down Bellman Ford - VE - SSSP : Bellman Ford is to check if there is a negative cycle in the graph, Floyd Warshall - V^3 - MSSP**
Dijkstra
# encoding: utf8 | |
# vigenere cipher | |
# https://stackoverflow.com/a/2490718/1675586 | |
def encode(key, string): | |
encoded_chars = [] | |
for i in range(len(string)): | |
key_c = key[i % len(key)] | |
encoded_c = chr(ord(string[i]) + ord(key_c) % 256) | |
encoded_chars.append(encoded_c) |
I was installing some python libraries that I needed, and this message came up: | |
Traceback (most recent call last): | |
File "/usr/bin/pip3", line 11, in <module> | |
sys.exit(main()) | |
File "/usr/lib/python3/dist-packages/pip/__init__.py", line 215, in main | |
locale.setlocale(locale.LC_ALL, '') | |
File "/usr/lib/python3.5/locale.py", line 594, in setlocale | |
return _setlocale(category, locale) | |
locale.Error: unsupported locale setting |
When hosting our web applications, we often have one public IP
address (i.e., an IP address visible to the outside world)
using which we want to host multiple web apps. For example, one
may wants to host three different web apps respectively for
example1.com
, example2.com
, and example1.com/images
on
the same machine using a single IP address.
How can we do that? Well, the good news is Internet browsers
from functools import cmp_to_key | |
sorted(mylist, key=cmp_to_key(compare)) | |
def compare(item1, item2): | |
if fitness(item1) < fitness(item2): | |
return -1 | |
elif fitness(item1) > fitness(item2): | |
return 1 | |
else: | |
return 0 |