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
// example tested at https://tio.run/#cpp-gcc | |
// make a table with modulo calculations | |
#include<iostream> | |
using std::cout; | |
int main() { | |
int dmax = 7; | |
int nmax = 5; | |
cout << "D->"; | |
for (int denominator = 1; denominator < dmax; denominator ++) { |
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
openSession () { | |
# start-tmux-with-several-panes-open-at-the-same-time | |
# input from the command line | |
# usage: | |
# openSession /my_project_directory/name_here my_tmux_session_name | |
# Reference: | |
# https://askubuntu.com/questions/830484/how-to-start-tmux-with-several-panes-open-at-the-same-time#answer-1351351 |
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/bash | |
clear | |
me=$( basename "$0" ) | |
echo "~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ " | |
echo "Running script $me" | |
echo "~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ " | |
# Reference: | |
# https://github.com/freeCodeCamp/chapter |
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/bash | |
# file: my-versions.sh | |
# quick display the versions | |
# to avoid retyping | |
# setup: | |
# chmod 744 my-versions.sh | |
# command prompt usage: |
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 luhn(card_number): | |
def digits_of(n): | |
return [int(d) for d in str(n)] | |
digits = digits_of(card_number) | |
odd_digits = digits[-1::-2] | |
even_digits = digits[-2::-2] | |
checksum = 0 | |
checksum += sum(odd_digits) | |
for d in even_digits: | |
checksum += sum(digits_of(d*2)) |
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
# file: is_cc_valid.py | |
# LUHN Algorithm | |
# Validate credit card number with Luhn algorithm | |
def is_cc_valid(cc_number, given_checksum): | |
# ref: https://en.wikipedia.org/wiki/Luhn_algorithm | |
double_every_other = [] | |
sum_digits = [] | |
minus_nine = [] | |
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
# list installed python modules | |
# > sorted alphabetically | |
import sys | |
import os | |
def list_dict_keys(a_dictionary, list_heading_text): | |
""" | |
Print a heading and a list of dictionary keys | |
to the command line. | |
""" |
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
# add the following to the bottom of the ~/.bashrc file | |
# User specific aliases and functions | |
# # # # | |
altPrompt="$ " | |
#altPrompt="λ " | |
# uhdInfo="\u " # user only | |
#uhdInfo="\w" # working directory only | |
# uhdInfo="\u:\w " # user and working directory |
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
# file: example-class-template.py | |
# A Python starter template for pretesting leetcode.com | |
# solutions offline, prior to submission. | |
# Reference: | |
# Class: | |
# https://docs.python.org/3.7/tutorial/classes.html?highlight=class#classes | |
# https://docs.python.org/3.7/tutorial/classes.html?highlight=class#class-objects |
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
# User: https://gist.github.com/NorthDecoder/ | |
# Filename: probe.py | |
# set probe_environment to | |
# `True` to list resources | |
# `False` to quiet listing, ie no list | |
probe_environment=True | |
# List available packages | |
if probe_environment: |
NewerOlder