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 socket | |
def haveInternet(): | |
REMOTE_SERVER = "www.google.com" | |
try: | |
host = socket.gethostbyname(REMOTE_SERVER) | |
s = socket.create_connection((host, 443)) | |
return True | |
except: |
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
if sys.platform.startswith('win'): | |
#Code for windows based | |
elif sys.platform.startswith('linux') or sys.platform.startswith('cygwin'): | |
#Code for linux based systems | |
elif sys.platform.startswith('darwin'): | |
#code for Mac Machines | |
else: | |
raise EnvironmentError('Unsupported platform') | |
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 glob | |
import serial | |
import sys | |
import time | |
BAUDRATE = 115200 | |
TIMEOUT = 0 | |
# Create list of potential ports |
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 | |
dpkg -l | awk ' {print $2} ' > ~/installedPackages.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
#!/bin/bash | |
# Script that finds a type of file in the current directory (recursive) | |
# and copies them into a destination directory | |
# Remember you need to put the absolute path of directories i.e ~/Desktop/... | |
# 1st parameter is the type of file to search | |
# 2nd parameter is the origin directory | |
# 3rd parameter is the destination directory | |
numberOfParameters=3 |
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 | |
#Checks for internet connection, prints the status on the terminal and save a status variable for later. | |
wget -q --tries=5 --timeout=20 --spider http://google.com | |
if [[ $? -eq 0 ]]; then | |
STATUS=true | |
echo "ONLINE | |
else | |
STATUS=false | |
echo "OFFLINE" |
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
#Get only the installed packages | |
apm list --isntalled --bare > packages.list | |
#Install packages from a file | |
apm install --packages-file packages.list | |
#Packages installed (17/11/2016) | |
[email protected] | |
[email protected] | |
[email protected] |
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 | |
# Little Script that deletes the packages contained in a file called packagesToRemove.list | |
packageFile="./packagesToRemove.list" | |
while IFS= read -r package | |
do | |
sudo apt-get -y -q autoremove $package | |
done < "$packageFile" |