This file contains 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
# For Windows users# Note: <> denotes changes to be made | |
#Create a conda environment | |
conda create --name <environment-name> python=<version:2.7/3.5> | |
#To create a requirements.txt file: | |
conda list #Gives you list of packages used for the environment | |
conda list -e > requirements.txt #Save all the info about packages to your folder |
This file contains 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
conda install -c anaconda pillow | |
conda install -c conda-forge tensorflow=1.1 | |
conda install jupyter | |
conda install tqdm | |
conda install matplotlib |
This file contains 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 bubble_sort(a_list): | |
for number in range(len(a_list)-1,0,-1): | |
for index in range(number): | |
if a_list[index]>a_list[index+1]: | |
temp_list = a_list[index] | |
a_list[index] = a_list[index+1] | |
a_list[index+1] = temp_list | |
my_list = [99,45,13,78,33,85,7,99,21] | |
bubble_sort(my_list) |
This file contains 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
#!/bin/bash | |
# Stop all containers | |
docker stop $(docker ps -a -q) | |
# Delete all containers | |
docker rm $(docker ps -a -q) | |
# Delete all images | |
docker rmi $(docker images -q) |
This file contains 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
from gpiozero import Button | |
import subprocess | |
from signal import pause | |
def shutdown(): | |
print("Halting system...") | |
subprocess.check_call(['sudo', 'poweroff']) | |
def kill_pico8(): | |
print("Killing PICO-8...") |
This file contains 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
# Install Docker - Xenial 16.04 and newer | |
apt-get install apt-transport-https ca-certificates curl software-properties-common -y | |
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - | |
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | |
apt-get update | |
apt-get install docker-ce | |
docker run hello-world |
This file contains 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
sudo docker build -t myimage . | |
sudo docker run -p 80:80 myimage |
This file contains 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
appendToQueryString = function (param, val) { | |
var queryString = window.location.search.replace("?", ""); | |
var parameterListRaw = queryString == "" ? [] : queryString.split("&"); | |
var parameterList = {}; | |
for (var i = 0; i < parameterListRaw.length; i++) { | |
var parameter = parameterListRaw[i].split("="); | |
parameterList[parameter[0]] = parameter[1]; | |
} | |
parameterList[param] = val; |
This file contains 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
# Here's a simple animation to understand how linear and binary search work | |
# http://www.davidenastri.it/files/binary-and-linear-search-animations.gif | |
data = [1,22,31,44,57,61,73,89,900] | |
target = 22 | |
def linear_search(data, target): | |
for index in range(len(data)): | |
if data[index] == target: | |
return index |
This file contains 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
import base64 | |
import paramiko | |
key = paramiko.RSAKey(data=base64.b64decode(b'AAA...')) | |
client = paramiko.SSHClient() | |
client.get_host_keys().add('ssh.example.com', 'ssh-rsa', key) | |
client.connect('ssh.example.com', username='THE_USER', password='THE_PASSWORD') | |
stdin, stdout, stderr = client.exec_command('which solsql') | |
for line in stdout: | |
print('... ' + line.strip('\n')) | |
client.close() |