Friday, December 4, 2020

circuitpython example with text

Now with some text as well (and I grant this python code to the public domain as well.)

import time

import board
import displayio
import digitalio

import vectorio
import gamepadshift
import terminalio

BUTTON_LEFT = 128
BUTTON_UP = 64
BUTTON_DOWN = 32
BUTTON_RIGHT = 16
BUTTON_SELECT = 8
BUTTON_START = 4
BUTTON_A = 2
BUTTON_B = 1

print('About to begin.')
for i in range(3,0,-1):
    print(i)
    time.sleep(0.2)


circle = vectorio.Circle(10)
circle2 = vectorio.Circle(6)

display = board.DISPLAY

palette = displayio.Palette(2)
palette[0] = 0x000000
palette[1] = 0xFFFFFF
palette.make_transparent(0)

def get_char_tile(c, x, y):
    g = terminalio.FONT.get_glyph(ord(c))
    tile = displayio.TileGrid(g.bitmap, pixel_shader=palette,  tile_width=g.width, tile_height=g.height, default_tile=g.tile_index, x=x, y=y)
    return tile

def get_string_group(s, x, y):
    text_w, text_h = terminalio.FONT.get_bounding_box()
    group = displayio.Group(max_size=len(s))
    for i, c in enumerate(s):
        group.append(get_char_tile(c, x+text_w*i, y))
    return group


palette2 = displayio.Palette(2)
palette2[0] = 0xFF0000
palette2[1] = 0x0000FF
palette2.make_transparent(0)

vect = vectorio.VectorShape(shape=circle, pixel_shader=palette)
vect2 = vectorio.VectorShape(shape=circle2, pixel_shader=palette2, x=5, y=-5)
s = get_string_group("Hey World!",15,0)
vect3 = vectorio.VectorShape(shape=vectorio.Rectangle(2, 10), pixel_shader=palette2)

move_group = displayio.Group()
move_group.append(vect)
move_group.append(vect2)
group = displayio.Group()
group.append(move_group)
group.append(s)
group.append(vect3)


display.show(group)
#display.show(group2)

group.x = 20
group.y = 20

pad = gamepadshift.GamePadShift(digitalio.DigitalInOut(board.BUTTON_CLOCK),
                                digitalio.DigitalInOut(board.BUTTON_OUT),
                                digitalio.DigitalInOut(board.BUTTON_LATCH))
button = 0
while button != BUTTON_START:
    button = pad.get_pressed()
    if button & BUTTON_UP == BUTTON_UP:
        move_group.y += -1
    if button & BUTTON_DOWN == BUTTON_DOWN:
        move_group.y += 1
    if button & BUTTON_LEFT == BUTTON_LEFT:
        move_group.x += -1
    if button & BUTTON_RIGHT == BUTTON_RIGHT:
        move_group.x += 1
    time.sleep(0.01)
    move_group.x %= display.width
    move_group.y %= display.height


Simple pybadge circuitpython code example

I just got a pybadge, and I was trying to find an example that used the display but only used the core libraries. I couldn't find one, so here it is. I grant this code to the public domain.

import time

import board
import displayio
import digitalio

import vectorio
import gamepadshift

BUTTON_LEFT = 128
BUTTON_UP = 64
BUTTON_DOWN = 32
BUTTON_RIGHT = 16
BUTTON_SELECT = 8
BUTTON_START = 4
BUTTON_A = 2
BUTTON_B = 1

print('About to begin.')
for i in range(3,0,-1):
    print(i)
    time.sleep(0.2)

circle = vectorio.Circle(10)
circle2 = vectorio.Circle(6)

palette = displayio.Palette(2)
palette[0] = 0x000000
palette[1] = 0xFFFFFF
palette.make_transparent(0)
palette2 = displayio.Palette(2)
palette2[0] = 0xFF0000
palette2[1] = 0x0000FF
palette2.make_transparent(0)

vect = vectorio.VectorShape(shape=circle, pixel_shader=palette)
vect2 = vectorio.VectorShape(shape=circle2, pixel_shader=palette2, x=5, y=-5)

group = displayio.Group()
group.append(vect)
group.append(vect2)
display = board.DISPLAY

display.show(group)

group.x = 20
group.y = 20

pad = gamepadshift.GamePadShift(digitalio.DigitalInOut(board.BUTTON_CLOCK),
                                digitalio.DigitalInOut(board.BUTTON_OUT),
                                digitalio.DigitalInOut(board.BUTTON_LATCH))
button = 0
while button != BUTTON_START:
    button = pad.get_pressed()
    if button == BUTTON_UP:
        group.y += -1
    elif button == BUTTON_DOWN:
        group.y += 1
    elif button == BUTTON_LEFT:
        group.x += -1
    elif button == BUTTON_RIGHT:
        group.x += 1
    time.sleep(0.01)
    group.x %= display.width
    group.y %= display.height

  

Sunday, November 8, 2020

How Trump Changed America

 "Seeking to understand rather than be understood requires a suppression of ego that takes practice. Lots of us are out of practice."

https://fivethirtyeight.com/features/how-trump-changed-america/

Thursday, October 29, 2020

Don't vote for Trump

In 2016 American voters did not know whom they were getting. Now they do. They would be voting for division and lying. They would be endorsing the trampling of norms and the shrinking of national institutions into personal fiefs. They would be ushering in climate change that threatens not only distant lands but Florida, California and America’s heartlands. They would be signalling that the champion of freedom and democracy for all should be just another big country throwing its weight around. Re-election would put a democratic seal on all the harm Mr Trump has done.

https://www.economist.com/leaders/2020/10/29/why-it-has-to-be-biden

Friday, September 25, 2020

MeWe 400 bad request

I have tried to create an account at MeWe multiple times, on two different ISPs spaced months apart (June and September of 2020), on Firefox, Chromium and Safari on Fedora, Ubuntu and macOS and every single time I get a 400 Bad Request when it tries to access
https://mewe.com/api/v3/auth/register

Posting because this in not in their support page, and no one else seems to have posted about this problem.

Please don't vote for Donald Trump

 I request that you do not vote for Donald Trump.

Since he became president, he has demonstrated in many ways that he is not qualified to be president.

There are three main things that President Trump has done that stand out in my mind.

The first was after Mueller testified in congress about Russian attempts to influence the US 2016 elections.  On July 24, 2019, Mueller said "Over the course of my career, I’ve seen a number of challenges to our democracy. The Russian government’s effort to interfere in our election is among the most serious."  What did Trump do after this?  Did he talk to Mitch McConnell and tell him to have the senate figure out how to fix this?  Did Trump talk to the State Department, the CIA, NSA or FBI on how to fix Russian influence?  No, Trump called up the President of the Ukraine and told him to announce an investigation of Joe Biden.  Trump's response to Mueller's warning about foreign interference was to try and create more foreign interference.  (Note: Even if you say or can prove that Mueller never should have started investigating Trump's campaign, my point still stands, Trump has done very little (he did make EO 13848) about the well documented Russian interference in the 2016 election).

The second was the whole set of Trump comments on Slow Down Testing.  On Saturday, June 20th, 2020 he said: "When you do testing to that extent, you’re going to find more people. You’re going to find more cases. So I said to my people, 'Slow the testing down, please!'"  On June 23rd he said he doesn't kid and posted a related tweet.  One of the better ways to get out of this covid-19 problem is to test as much as possible so we find the cases and we can then isolate the people with covid-19 instead of having to isolate everyone.  So Trump suggested to slow down testing, and then repeated it multiple times over the next few days.  In other words, Trump could not figure out how stupid slowing down testing is despite having days to think about it. Trump should have been asking to speed up testing.

The third is honesty.  Trump lies. From the first day in office when he lied about the number of people attending his inauguration to saying that all of Portland is on fire and has been for decades, Trump lies. (I've been to Portland in the past few years, and the city was not burning then and while the riots have occasionally set fires, they are fairly limited, saying the whole city is ablaze was an outright lie.)

So, please do not vote for Trump.

References:

Mueller Testimony:
https://thehill.com/policy/national-security/454481-read-muellers-opening-statement-about-russia-investigation

Mueller Report:
https://www.justice.gov/storage/report_volume1.pdf

https://www.justice.gov/storage/report_volume2.pdf
https://www.justice.gov/storage/report_appendices.pdf

Whistleblower letter about July 25th phone call:
https://intelligence.house.gov/uploadedfiles/20190812_-_whistleblower_complaint_unclass.pdf

EO 13848, Trump's September 12th, 2018 executive order on Foreign Interference:
https://www.whitehouse.gov/presidential-actions/executive-order-imposing-certain-sanctions-event-foreign-interference-united-states-election/

Review of FISA Applications and Other Aspects of the FBI's Crossfire Hurricane Investigation:
https://www.justice.gov/storage/120919-examination.pdf

Trump quips that he told aides to 'slow the testing down' for coronavirus:
https://thehill.com/homenews/campaign/503758-trump-quips-that-he-told-aides-to-slow-the-testing-down-for-coronavirus

Trump: "I don't kid" on coronavirus testing:
https://thehill.com/homenews/administration/504060-trump-i-dont-kid-on-coronavirus-testing

Donald Trump, June 23, 2020: "Cases are going up in the U.S. because we are testing far more than any other country, and ever expanding. With smaller testing we would show fewer cases!"
https://mobile.twitter.com/realDonaldTrump/status/1275381670561095682


Trump on Inaugural Crowd Size:
https://thehill.com/blogs/blog-briefing-room/news/315484-trump-defends-size-of-his-inaugural-crowd

Trump false claims that Portland is on fire and has been for decades:
https://www.politifact.com/factchecks/2020/sep/01/donald-trump/we-are-not-fire-authorities-dispute-trumps-false-c/

Trump claims the Portland on fire "or a city like Portland, where the entire city is ablaze all the time":
https://www.whitehouse.gov/briefings-statements/remarks-president-trump-press-briefing-august-8-31-2020/

A more complete list of Trump's cruelties, collusions, corruptions, and crimes:
https://www.mcsweeneys.net/columns/reasons-why-donald-trump-is-unfit-to-be-president


Tuesday, September 15, 2020

Trump's statements have zero factual value

"People outside the business may not recognize what a step it is, culturally and professionally, for reporters and editors to act on the implications of this reality—the knowledge that what a president or his senior representatives say has exactly zero factual value. If you are trying to inform the public, you’re better off not reporting what this president says, contends, or does, unless there are external indications that it’s true." The Media Learned Nothing From 2016 - The Atlantic

Monday, May 25, 2020

bash: ./mono: No such file or directory

If you are ever trying to run a mono binary program (such as from GOG) on a 64-bit Ubuntu and get the error:
bash: ./mono: No such file or directory
the cause might be that you are missing the 32 bit libraries.
$ ls -l mono
-rwxr-xr-x 1 bill bill 3025284 May 22 13:58 mono
$ ./mono
bash: ./mono: No such file or directory
$ strace ./mono
execve("./mono", ["./mono"], 0x7ffefde5caa0 /* 21 vars */) = -1 ENOENT (No such file or directory)
fstat(2, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 1), ...}) = 0
write(2, "strace: exec: No such file or di"..., 40strace: exec: No such file or directory
) = 40
getpid() = 28163
exit_group(1) = ?
+++ exited with 1 +++

On Ubuntu 18 this was solved with (but I am guessing that libc6 was the only install required to at least get a better error message):
sudo apt-get install libc6:i386 libasound2:i386 libasound2-data:i386 libasound2-plugins:i386 libcaca0:i386 libjpeg-turbo8:i386 libtiff5:i386 libncurses5:i386 libsqlite3-0:i386 libsdl1.2debian:i386 libsdl-mixer1.2:i386 libsdl-image1.2:i386 libgdiplus:i386

Monday, April 20, 2020

"Python 2.7.18 is the last Python 2.7
release and therefore the last Python 2 release. It's time for the CPython
community to say a fond but firm farewell to Python 2.

Download this unique, commemorative Python release on python.org."
https://pythoninsider.blogspot.com/2020/04/python-2718-last-release-of-python-2.html

Monday, March 23, 2020

Where are the CDC teleconferences?

"Two weeks have now gone by since the US Centers for Disease Control and Prevention has held a press briefing to update the media and the public on the COVID-19 pandemic and the agency's response efforts." https://arstechnica.com/science/2020/03/were-in-a-public-health-crisis-wheres-the-cdc/

FUBAR: Covid-19

"American cities, blinded by the lack of testing data, did little as crucial days went by. On March 7, as the severity of the local outbreak was becoming known, huge events were allowed to go on. More than 30,000 people attended a Seattle Sounders game that night. No one wanted to say what has now become clear: February was our chance to get this right. We lost that entire month. And we now live in a new era of work stoppages, overwhelmed hospitals, dead elders, and a wrecked economy." https://www.theatlantic.com/health/archive/2020/03/how-many-americans-are-sick-lost-february/608521/

Tuesday, March 3, 2020

Trump Corruption

"Bureaucrats never received such public praise as they did during the weeks of the impeachment inquiry. But the hearings left a misleading impression. The Ukraine story, like the Russia story before it, did not represent a morality tale in which truth and honor stood up to calumny and corruption and prevailed. Yovanovitch is gone, and so is her replacement, William Taylor Jr., and so are McKinley and others—Lieutenant Colonel Vindman was marched out of the White House in early February—while Pompeo is still there and, above him, so is the president. Trump is winning."
https://www.theatlantic.com/magazine/archive/2020/04/how-to-destroy-a-government/606793/