Skip to content

Instantly share code, notes, and snippets.

View Lvl4Sword's full-sized avatar
💚
Whatever you do, do it well.

Scott King Lvl4Sword

💚
Whatever you do, do it well.
View GitHub Profile
#!/usr/bin/env python3
# While systemd has the prefixes set in the following way:
# en = ethernet
# wl = wlan
# ww = wwan
# There are still instances where an interface won't have these.
# Which, is why I made this script.
import os
ethernet_interfaces = []
@Lvl4Sword
Lvl4Sword / bmi.py
Last active September 16, 2018 05:22
Body Mass Index ( Imperial AND Metric )
#!/usr/bin/env python3
import sys
complete = False
print('Ctrl+C / Ctrl+D to quit at anytime')
def bmi():
try:
measurement_type = input('(I)mperial or (M)etric?: ')
import requests
get_this = requests.get('https://api.coinmarketcap.com/v1/ticker/?convert=USD&limit=2000')
all_dict = {}
for each in get_this.json():
ticker = each['symbol']
all_dict[ticker] = {}
all_dict[ticker]['rank'] = each['rank']
all_dict[ticker]['price'] = each['price_usd']
#!/usr/bin/env python3
import json
import requests
import sys
band = None
user = None
counter = 0
input_stripped = input('Input a band (or hit enter for user): ').strip()
#!/usr/bin/env python3
import requests
import sys
import time
try:
print('CTRL + D or CTRL + C will close the program at any time.')
stock_names_input = input('Stock names separated by \',\' (AAPL, GOOG, TSLA): ')
stock_prices_input = input('Stock prices you bought in at separated by \',\' (100.00, 23.31, 493.84): ')
import requests
nu_get = []
print('- Downloading https://adaway.org/hosts.txt')
one_get = requests.get('https://adaway.org/hosts.txt')
print('- Done\n')
print('- Downloading https://hosts-file.net/ad_servers.txt')
two_get = requests.get('https://hosts-file.net/ad_servers.txt')
import random
import sys
picked_num = random.randint(1, 10)
counter = 5
def guess_game(counter, picked_num):
while counter:
try:
number = int(input("Please choose a number between 1 and 10: "))
import java.io.*;
import java.util.*;
import com.opencsv.CSVReader ;
import com.opencsv.CSVWriter ;
import java.net.*;
import javax.swing.filechooser.FileFilter;
import javax.swing.filechooser.FileNameExtensionFilter;
import javax.swing.JFileChooser;
import javax.swing.JOptionPane;
@Lvl4Sword
Lvl4Sword / csv.py
Last active December 23, 2016 07:19
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import csv
import Tkinter
import tkFileDialog
import sys
def calc_hours_shift(a_shift):
@Lvl4Sword
Lvl4Sword / random_dashes.py
Last active October 5, 2016 05:23
Generate 16 random characters, with each 4 separated by a dash
import random
import string
characters = string.digits + string.ascii_letters
random_selection = lambda: [random.choice(characters) for x in range(16)]
random_join = ''.join(random_selection())
final_list = []
counter = 1
for each in random_join: