from json import loads
from pendulum import parse
from requests import get
from os import environ
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/python3 | |
'''Count word total in text file.''' | |
from os import listdir | |
print(listdir()) # optional | |
inp = input('Enter filename: ') | |
with open(inp) as file: | |
text = file.read() |
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/python3 | |
''' | |
generate password based on hex pattern | |
93b44021-a479-5fc2-4037-08b690031c73 | |
xxxx-xx-xx-xx-xxxxxx | |
''' | |
from random import randrange | |
patt = [4, 2, 2, 2, 6] | |
hex_sets = [] |
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/sh | |
# Create Chromium URL-as-app launcher given name of video and URL | |
# Example: | |
# $ sh launcher-gen.sh 'Dark Drum and Bass - VOL 2' https://www.youtube.com/watch?v=55kZd_JDrfI | |
NAME="$1" | |
URL=$2 | |
echo '[Desktop Entry]\nVersion=1.0\nType=Application' > /home/$USER/Desktop/$NAME.desktop | |
echo "Name=$NAME" >> /home/$USER/Desktop/$NAME.desktop |
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/python3 | |
'''Countdown Timer | |
`$ python3 countdown.py 15` <-- 15 min timer example''' | |
from time import sleep | |
from sys import argv | |
tot_secs = int(argv[1]) * 60 # convert minute(s) string | |
def countdown(tot_secs): |
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/python3 | |
'''Get data from IPGeolocation’s Astronomy API.''' | |
from json import loads | |
from requests import get | |
from pendulum import parse | |
from pendulum.parsing import ParserError | |
API_KEY: str = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' | |
LATITUDE: str = '00.000000' | |
LONGITUDE: str = '-00.000000' |
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/python3 | |
'''Scrape embed link from white hat Web page.''' | |
from requests import get | |
from subprocess import run | |
from bs4 import BeautifulSoup | |
# color codes | |
orng = '\x1b[33m' | |
rset = '\x1b[0m' |
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
p = {3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97} | |
n = 7775460 | |
l = [] | |
n1 = 0 | |
while n not in p: | |
if n % 2 == 0: | |
n = n // 2 | |
l.append(2) | |
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
#!/bin/python3 | |
'''Use encoding to disguise message by converting vowels to numbers.''' | |
# Permission granted under “The MIT License” (open source) | |
def encode(s: str) -> str: | |
enc = { 'a': '1', 'e': '2', 'i': '3', 'o': '4', 'u': '5' } | |
return ''.join(enc[x] if x in enc else x for x in s) | |
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/python3 | |
'''Print Web-safe color table.''' | |
def print_table(): | |
'''Print table.''' | |
ws_rgb = ['0', '51', '102', '153', '255'] | |
print('\x1b[31m Web-safe Color Table\x1b[0m') |
NewerOlder