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
#! /bin/nodejs | |
/* Calculate dice roll probability. | |
n1 = sum of die values | |
n2 = how many dice */ | |
function rolldiceSumProb(n1, n2) { | |
lo = ('1').repeat(n2) // ones, e.g. '111' | |
hi = ('6').repeat(n2) // sixes, e.g. '666' | |
combos = [] // dice combinations | |
matches = [] // matching combinations |
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
#! /bin/python3 | |
'''`set_bg_img` module contains `set_img()` method which sets image URI and display mode. | |
$ python3 set_bg_img.py''' | |
from subprocess import run | |
from click import command | |
from click import option | |
from click import Choice | |
@command() # command options |
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
#! /bin/python3 | |
'''Execute raw Gist code (Python code) locally.''' | |
import pycurl | |
from io import BytesIO | |
bytes_io = BytesIO() # init bytesio obj | |
_curl = pycurl.Curl() # init curl obj | |
# set raw gist URL | |
_curl.setopt(_curl.URL, 'https://gist.githubusercontent.com/nick3499/7202dfe86ba7ee0d7e214392fdbdab59/raw/4aa37582274f98ffffd776a69aa08ab6c738beac/convert2nato.py') |
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
#! /bin/python3 | |
'''`roll_dice` module contains `roll_dice` method which returns random \ | |
results of two rolled dice.''' | |
from random import randrange | |
def roll_dice(): | |
'''`roll_dice()` method returns random results of two dice.''' | |
die_segments = { | |
'top' : '┌───────┐', |
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
#! /bin/python3 | |
'''`gm_resize` module contains `gm_resize()` method for resizing an image.''' | |
from os import chdir | |
from os import listdir | |
from PIL import Image | |
def gm_resize(): | |
'''A dimensional comparison is used to determine whether an image should \ | |
be resized based on image width or image height.''' |
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
#! /bin/python3 | |
'''After Dark Sky joined Apple, free API subscriptions closed. Enter the web \ | |
scraper.''' | |
from lxml import html | |
from requests import get | |
_geo = '37.778,-122.4313' # San Francisco | |
_page = get(f'https://darksky.net/forecast/{_geo}/us12/en') | |
tree = html.fromstring(_page.content) |
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
#! /bin/python3 | |
'''`random_hostname` module contains the `rand_hostname()` method \ | |
which generates a pseudo-random hostname.''' | |
from random import randrange | |
from subprocess import run | |
def rand_hostname(): | |
'''`rand_hostname()` method generates a pseudo-random hostname.''' | |
# alphanumeric collection |
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
#! /bin/python3 | |
'''`scifi_wallpaper` module contains methods for setting background image. | |
Along with the display mode. Help: $ python3 scifi_wallpaper.py | |
opensource.org/licenses/MIT''' | |
from os import listdir | |
from datetime import date | |
from subprocess import run | |
import click | |
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
:::::::.. :::. :::::::-. ::: ... | |
;;;;``;;;; ;;`;; ;;, `';,;;; .;;;;;;;. | |
[[[,/[[[' ,[[ '[[, `[[ [[[[[,[[ \[[, | |
$$$$$$c c$$$cc$$$c $$, $$$$$$$$, $$$ | |
888b "88bo,888 888,888_,o8P'888"888,_ _,88P | |
MMMM "W" YMM ""` MMMMP"` MMM "YMMMMMP" |
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
#! /bin/python3 | |
'''`pythag_convert` module contains `pythag_convert()` method which converts \ | |
text string to Pythagorean number system.''' | |
from sys import argv | |
def pythag_convert(): | |
'''pythag_convert() converts text string to Pythagorean numerology system. | |
$ python3 ~/scripts_path/pythag_convert.py Foo''' | |
pythag = { |