Category Archives: Uncategorized

Cmdlog

List bash commands by frequency #!/usr/bin/env python3 import os history_file = os.path.expanduser(“~/.bash_history”) counts = {} with open(history_file, “r”, errors=”ignore”) as f: for line in f: line = line.strip() if not line or line.startswith(“#”): continue cmdline = line.split(“|”, 1)[0].strip() parts = … Continue reading →

Posted in Uncategorized | Leave a comment

Alpha

#!/usr/bin/env python3 “”” Argo Alpha-AUXMOD Performance Calculator Models the docked Alpha capsule and Auxiliary Module in orbit. Calculates: – Combined operating and dry mass – Shared AUXMOD propellant budget – Ideal delta-v available for maneuvering and docking – Theoretical peak … Continue reading →

Posted in Uncategorized | Leave a comment

Rtf2txt

#!/usr/bin/env python3 import sys import re import codecs SKIP_DESTINATIONS = { “fonttbl”, “colortbl”, “stylesheet”, “info”, “pict”, “object”, “objdata”, “header”, “headerl”, “headerr”, “footer”, “footerl”, “footerr”, “filetbl”, “listtable”, “listoverridetable”, “generator”, “xmlnstbl”, “datastore”, “themedata”, “colorschememapping”, “latentstyles”, “rsidtbl”, “revtbl”, “annotation”, “atnauthor”, “atnid”, “atnref”, “atntime”, … Continue reading →

Posted in Uncategorized | Leave a comment

Quadratic

#!/usr/bin/env python3 import math,sys a,b,c=map(float,sys.argv[1:]) d=b*b-4*a*c if d>=0:x1=(-b+math.sqrt(d))/(2*a);x2=(-b-math.sqrt(d))/(2*a) else:r=-b/(2*a);i=math.sqrt(-d)/(2*a);x1,x2=complex(r,i),complex(r,-i) print(“The function has”,”two real roots: {} and {}”.format(x1,x2)if d>0 else “one double root: {}”.format(x1)if d==0 else “two complex roots: {} and {}”.format(x1,x2))

Posted in Uncategorized | Leave a comment

Trig

Trig functions #! /usr/bin/bc -lq define t(x) { return s(x) / c(x) } define y(y) { if (y == -1) return -2 * a(1) /* -pi/2 */ if (y == 1) return 2 * a(1) /* pi/2 */ return a(y … Continue reading →

Posted in Uncategorized | Leave a comment

Pay

#!/usr/bin/env python3 import sys from num2words import num2words def spell_number(my_number): my_number = my_number.strip() if not my_number: return “” result = num2words( float(my_number), to=”currency”, currency=”USD” ) result = result.replace(“,”, “”) result = result.replace(” and “, ” “) result = result.replace(“-“, ” … Continue reading →

Posted in Uncategorized | Leave a comment

Ac

Report statistics of uptime ac -dp –print-year  

Posted in Uncategorized | Leave a comment

Abundant

#!/usr/bin/python3 import sys; beg,end=int(sys.argv[1]),int(sys.argv[2]);[print(f”{n} is “+(“perfect” if (s:=sum(x for x in range(1,1+n//2) if n%x==0))==n else “abundant” if s>n else “deficient”)) for n in range(beg,end+1)]

Posted in Uncategorized | Leave a comment

abcde

abcde for Linux in the off-hand chance you still need to rip a CD.  

Posted in Uncategorized | Leave a comment

Palin

Find all palindromic words in a file #!/usr/bin/python3 def words(fileobj): for line in fileobj: for word in line.split(): yield word with open(“words.txt”) as wordfile: wordgen = words(wordfile) for word in wordgen: if word == word[::-1]: print(word, end=” “) print()

Posted in Uncategorized | Leave a comment