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
AlertDialog alertDialog = new AlertDialog.Builder(MainActivity.this).create(); | |
alertDialog.setTitle("Alert"); | |
alertDialog.setMessage("Alert message to be shown"); | |
alertDialog.setButton(AlertDialog.BUTTON_NEUTRAL, "OK", | |
new DialogInterface.OnClickListener() { | |
public void onClick(DialogInterface dialog, int which) { | |
dialog.dismiss(); | |
} | |
}); | |
alertDialog.show(); |
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
# How to freeze pip requirements | |
pip freeze > requirements.txt |
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
DISPLAY=:0 firefox http://www.google.com |
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 |