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
#!/usr/bin/env python3 | |
import subprocess | |
import optparse | |
def get_arguments(): | |
parser = optparse.OptionParser() | |
parser.add_option("-i", "--interface", dest="interface", help="Interface to change its MAC address") | |
parser.add_option("-m", "--mac", dest="new_mac", help="NEW MAC address") | |
return parser.parse_args() |
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
#!/usr/bin/env python3 | |
import subprocess | |
import optparse | |
def change_mac(interface, new_mac): | |
subprocess.call(["ifconfig", interface, "down"]) | |
subprocess.call(["ifconfig", interface, "hw", "ether", new_mac]) | |
subprocess.call(["ifconfig", interface, "up"]) | |
print("[+] Changing MAC address for " + interface + " to " + new_mac) |
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 nltk | |
from nltk.stem import WordNetLemmatizer | |
lemmatizer = WordNetLemmatizer() | |
import json | |
import pickle | |
import numpy as np | |
from keras.models import Sequential | |
from keras.layers import Dense, Activation, Dropout | |
from keras.optimizers import SGD |
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 isYearLeap(year): | |
if (year % 4) == 0: | |
if (year % 100) == 0: | |
if (year % 400) == 0: | |
return True | |
else: | |
return False | |
else: | |
return True | |
else: |
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
dct = { 'one':'two','three':'one', 'two':'three'} | |
v = dct['three'] | |
for k in range (len(dct)): | |
v = dct[v] | |
print(v) | |
def fun(x): | |
x += 1 | |
return x |
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
school_class = {} | |
while True: | |
name = input("Enter the student's name (or type exit to stop): ") | |
if name == 'exit': | |
break | |
score = int(input("Enter the student's score (0-10): ")) | |
if name in school_class: |
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
dictionary = {"cat" : "chat", "dog" : "chien", "horse" : "cheval"} | |
phone_numbers = {'boss' : 5551234567, 'Suzy' : 22657854310} | |
empty_dictionary = {} | |
words = ['cat', 'lion', 'horse', 'RAT'] | |
for word in words: | |
if word in dictionary: | |
print(word, "->", dictionary[word]) | |
else: | |
print(word, "is not in dictionary") |
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
dictionary = {"cat" : "chat", "dog" : "chien", "horse" : "cheval"} | |
phone_numbers = {'boss' : 5551234567, 'Suzy' : 22657854310} | |
empty_dictionary = {} | |
words = ['cat', 'lion', 'horse', 'RAT'] | |
for word in words: | |
if word in dictionary: | |
print(word, "->", dictionary[word]) | |
else: | |
print(word, "is not in dictionary") |
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 fib(n): | |
if n < 1: | |
return None | |
if n < 3: | |
return 1 | |
elem1 = elem2 = 1 | |
sum = 0 | |
for i in range(3, n + 1): | |
sum = elem1 + elem2 |
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 factorialFun(n): | |
if n < 0: | |
return None | |
if n < 2: | |
return 1 | |
product = 1 | |
for i in range(2, n + 1): | |
product *= i | |
return product |
NewerOlder