P

Pandas

Get data from clipboard

import pandas as pd
pd.read_clipboard()

Parallel

Calculate parallel resistance (or serial capacitance) for any number of components

#!/usr/bin/python3
import sys
import numpy
elements = sys.argv[1:]
a=numpy.array(elements,dtype=float)
print (str(elements), '->', str(1/sum(1/a)),'\n')

psc

Convert comma-delimited data to sc format:

cat hohmann.csv | psc -d, >hohmann.sc

 

Phi

Use bc to calculate phi (the Golden Mean):

define fibonacci(n) {if((n==1)||(n==0)) {return(n);} else {return(fibonacci(n-1)+fibonacci(n-2));}}

Philemon

 

In the “book” of Philemon, which is just one chapter, Paul seems to have fallen in love with the word “bowels” and uses it multiple times:

[7] For we have great joy and consolation in thy love, because the bowels of the saints are refreshed by thee, brother.

[12] Whom I have sent again: thou therefore receive him, that is, mine own bowels:

[20] Yea, brother, let me have joy of thee in the Lord: refresh my bowels in the Lord.

It reminds me of when Joseph Smith wrote 2 Nephi, and in chapter 3 he fell into the same rut over a different word:

[12] Wherefore, the fruit of thy loins shall write; and the fruit of the loins of Judah shall write; and that which shall be written by the fruit of thy loins, and also that which shall be written by the fruit of the loins of Judah, shall grow together, unto the confounding of false doctrines and laying down of contentions, and establishing peace among the fruit of thy loins, and bringing them to the knowledge of their fathers in the latter days, and also to the knowledge of my covenants, saith the Lord.

The letter is considered by most scholars, academic liberals as well as academic conservatives, to be one of the seven epistles of Paul which are authentic, not forgeries. Onesimus was a slave owned by Philemon who fled after stealing money, but he bumped into Paul and was converted to Christ just as Philemon had been converted earlier. Paul talked the slave into returning to Philemon with this letter, and Paul told Philemon if Onesimus owed any money to put it on his tab, though how Paul was going to swing that while sitting in prison was an open matter.

Calculate pi

#!/bin/bash
echo "scale=$1;a(1)*4" | bc -l

$ for i in {1..25}; do ./pi $i; done

 

Print pi to any number of digits with Python

python3 -c 'from sympy import *;print(str(N(pi,1000)))'

 

Calculate 500 digits of pi starting at the 99,501st digit, with Python

from sympy import * str(N(pi,100000))[-500:]

 

Pie chart

#!/usr/bin/python3
import matplotlib.pyplot as plt
labels = ['Seattle', 'Spokane', 'Tacoma', 'Vancouver', 'Bellevue','Kent', 'Everett', 'Renton', 'Spokane Valley', 'Federal Way', 'Yakima','Kirkland','Bellingham','Auburn']
sizes = [737015, 228989, 219346, 190915, 151854, 136588, 110629, 106785, 102976, 101030,96968,92175,91482,87256]
fig1, ax1 = plt.subplots()
ax1.pie(sizes, labels=labels, autopct='%1.1f%%',
shadow=True, startangle=0)
ax1.axis('equal')
plt.show()

Plot3D

Plot a function in three dimensions with Python

#!/usr/bin/python3
from sympy import symbols,cos,sin
z = symbols('z')
from sympy.plotting import plot3d_parametric_line
plot3d_parametric_line(cos(z)*sin(z/20),sin(z)*sin(z/20),z,(z,-31.41,31.41))

 

 

 

Psalm 88

 

Psalm 88:12 Shall thy wonders be known in the dark? and thy righteousness in the land of forgetfulness?

King David is urging God to listen to him, because at least it’s more interesting than trying to listen to the dead, who are unable to praise God, or declare what a great fellow he is, or to know his wonders and righteousness. And that’s a problem for Christians who believe the dead can do just that.

We have prayer for the same reason we still have the sin of idolatry, it’s a vestige of an earlier theology when there were many gods and heaven was like City Hall. God is omniscient and omnipotent and has the perfect plan, but if the perfect plan isn’t to our own personal liking we can ask for a modification. Don’t let the hurricane hit Pensacola because it will kill Pentecostal true believers. Let it go hit those Catholic libtards in New Orleans.

But when the temple got zapped by the surrounding kingdoms (Babylon, Rome), Yahweh was rebooted to become the only God of the whole Earth. This was done to explain why he would send soldiers of heathens to punish the Chosen with genocide for skipping a Sabbath or two, or helping themselves to some bacon bits. The attacking armies were agents of this larger God even as the Chosen were. Nobody stopped to question why a single real God would be “jealous” when other fake gods received worship.

Television series often have early continuity errors like this before they get their story straight by the third or fourth season. Eventually this newly universalized God was given the attribute of omniscience. Yet we still make requests of this God as though he were just an old school tribal deity.

Prime numbers

python -c 'print([i for i in range(2,5000) if all(i%j !=0 for j in range(2,int(i**0.5)+1))])'

 

Psycho (1960)Studio didn’t want Hitchcock to make it, they wanted another North By Northwest instead. Hitchcock said fuck you, shelled out $807,000 of his own money, shot it on cheap B&W film stock and used the crew from his television show. The movie made $50 million, he cleared $15 million and created the whole slasher genre. Some call it the best film ever made. It’s up there.

Puppy Linux

Running a softsynth

pyhist

Save Python history to file:

import readline
readline.write_history_file('pyhistory.py')

 

—-