This file contains hidden or 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 urllib import urlopen | |
from xml.etree.ElementTree import parse | |
rss_url = urlopen('http://www.dropsql.com/feed') | |
xml = parse(rss_url) | |
f = open('dropsql-feeds.txt', 'w') | |
# Looks for all item elements under channel tag | |
for item in xml.iterfind('channel/item'): |
This file contains hidden or 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 library | |
import socket | |
# Import hexlify for ip address conversion | |
from binascii import hexlify | |
# Use NTP protocol | |
import ntplib | |
from time import ctime | |
# Print hostname | |
hostname = socket.gethostname() |
This file contains hidden or 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 geocoder | |
def company(name): | |
results = geocoder.google(name) | |
print ("Coordinates: Latitude - %s, Longitude - %s" %(results.lat, results.lng)) | |
print ("Address: %s" % results.address) | |
if __name__ == '__main__': | |
print ("Type name of the place:") | |
name = raw_input() |
This file contains hidden or 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 bs4 import BeautifulSoup | |
import csv | |
import re | |
import requests | |
# Copy URL you wanna crawl | |
print ("Copy the link you wanna scrap:") | |
url = raw_input("->") | |
# Fetch url | |
request = requests.get(url) |
This file contains hidden or 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 quicksort(list): | |
# Define lists | |
less = [] | |
equal = [] | |
greater = [] | |
if len(list) > 1: # Check if list have more than 1 element | |
pivot = list[0] # This is now pivot value | |
for number in list: # Go through numbers in list |
This file contains hidden or 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 urllib | |
import json | |
# Define url you wanna fetch | |
url = "http://api.openweathermap.org/data/2.5/find?q=London&units=metric" | |
# Fetch url | |
response = urllib.urlopen(url) | |
# Load url response to json |
This file contains hidden or 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 gcd(a,b): # Define function with two parameters | |
while b != 0: # Run loop till 'b' value is 0 | |
if a > b: # 'a' value must be larger than 'b' | |
r = a % b # Remainder value | |
a = b # Assign 'b' to 'a' | |
b = r # Asign remainder value to 'b' | |
return a # Return result |
This file contains hidden or 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
Time: /bin/date | |
Login: users | awk '{print $1}' | |
Architecture: uname -m | |
Kernel version: uname -v -r | |
Processor: cat /proc/cpuinfo | grep \"name\" | cut -d : -f2 | uniq | |
Operating system: cat /etc/*-release | grep \"PRETTY_NAME\" | cut -d \"=\" -f2 | uniq | |
Interfaces: ip link show | grep 'eth\|wlan' | awk '{print $1,$2}' | |
IP addresses: ip a | grep 'eth\|wlan' | awk '{print $1,$2}' | |
Transmitted: /sbin/ifconfig eth0 | grep 'TX bytes' | awk '{print $7,$8}' | |
Recieved: /sbin/ifconfig eth0 | grep 'RX bytes' | awk '{print $3,$4}' |
This file contains hidden or 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
# Backup your packages list | |
# Get a packages list | |
dpkg --get-selections > ~/Package.list | |
# Copy list of repositories | |
sudo cp /etc/apt/sources.list ~/sources.list | |
# Export repo keys | |
sudo apt-key exportall > ~/Repo.keys |
This file contains hidden or 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
#!/usr/bin/env python3.0 | |
import hashlib | |
import sys | |
algorithm = dict( | |
sha256 = lambda x: hashlib.sha256(x).hexdigest() | |
) | |
def usage(): |
NewerOlder