Skip to content

Instantly share code, notes, and snippets.

View kitusmark's full-sized avatar

Marc kitusmark

View GitHub Profile
@kitusmark
kitusmark / removePackages.sh
Created December 15, 2016 15:01
Little Script that deletes the packages contained in a file called packagesToRemove.list
#!/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"
@kitusmark
kitusmark / getInstalledPackages.sh
Last active November 17, 2016 10:14
Gets all packages installed in Atom Editor
#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)
atom-html-preview@0.1.22
autocomplete-clang@0.10.0
autocomplete-python@1.8.12
@kitusmark
kitusmark / checkInternet.sh
Created January 21, 2016 14:00
Checks for internet connection, prints the status on the terminal and save a status variable for later.
#!/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"
@kitusmark
kitusmark / findandcopy.sh
Last active December 23, 2015 19:50
finds the specified type of file in a directory and copies them in the destination directory
#!/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
@kitusmark
kitusmark / InstalledPackages.sh
Created December 21, 2015 10:19
Save the list of installed packages to a file
#! bin/bash
dpkg -l | awk ' {print $2} ' > ~/installedPackages.txt
@kitusmark
kitusmark / serial_scanner.py
Created December 16, 2015 16:27
Python program to list all the serial ports connected to the computer
import glob
import serial
import sys
import time
BAUDRATE = 115200
TIMEOUT = 0
# Create list of potential ports
@kitusmark
kitusmark / crossPlatform.py
Created December 15, 2015 17:22
If statement for applications for windows, linux and Mac
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')
@kitusmark
kitusmark / haveInternet.py
Created December 15, 2015 17:09 — forked from rayansostenes/haveInternet.py
A python method to check if the system have a active connection to the internet
import socket
def haveInternet():
REMOTE_SERVER = "www.google.com"
try:
host = socket.gethostbyname(REMOTE_SERVER)
s = socket.create_connection((host, 443))
return True
except: