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
from sys import stdin | |
from operator import sub | |
input_data = [ (int(a),int(b)) for a,b in (line.split() for line in stdin)] | |
print( sum( map(lambda a: abs(sub(*a)), | |
zip(sorted(a for a,b in input_data), | |
sorted(b for a,b in input_data)) ))) |
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
swing states | |
PA 19 | |
GA 16 | |
NC 16 | |
MI 15 | |
AZ 11 | |
WI 10 | |
NV 6 | |
Democrats (226 baseline) |
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/env python3 | |
# Take a AWS transcribe json file with speaker labels from stdin and | |
# print out a plain text transcript with the speaker_label items at the | |
# start of line with a colon | |
# Copyright Mark Jenkins <mark@markjenkins.ca> | |
# | |
# Copying and distribution of this file, with or without modification, | |
# are permitted in any medium without royalty provided the copyright |
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
#!/bin/sh | |
opusenc $1 `basename -s .wav $1`.opus |
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
rem VIC-20 basic program to act as a tone | |
rem generator for morse code practice | |
rem author Mark Jenkins <mark@parit.ca> | |
rem checks portB pin 0 e.g. pin "C" | |
rem hardware connected to user-port | |
rem should short that pin to ground when a | |
rem switch is closed. | |
rem |
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
UNIXPW_DISABLE_SSL=1 x11vnc -display :0 -forever -localhost -unixpw |
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
#!/bin/sh | |
# for IQ511 | |
# $1 is the last octet of the ipv4 address | |
# created files are not cleaned up | |
# regarding /now.jpg urls | |
# snap=spush0.25 means camera push a frame every 0.25 seconds | |
# ds=2 downsample by a factor of 2 (half size) | |
# |
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/env python3 | |
# https://adventofcode.com/2022/day/1 Parts 1 and 2 with constant memory | |
# Mark Jenkins | |
from heapq import nlargest | |
def gen_elf_lines(): | |
"""a generator of consecutive elf lines, converted to int |
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/env python3 | |
EOFDEPTH = -1 | |
def read_depth_line(): | |
try: | |
line = input() | |
return int(line) | |
except EOFError: | |
return EOFDEPTH |
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
While connected to a PC without drivers (such as GNU/Linux) over USB, the GoPro sets itself up as a USB Ethernet card and runs a DHCP server to assign your PC an address. Doesn't mess with my default route, so regular path to the internet still works. In my case the GoPro assigned me 172.23.177.54 and nmap helped me discover the GoPro was on 172.23.177.51. | |
I had to ask the GoPro to start streaming by visiting http://172.23.177.51/gp/gpWebcam/START?res=1080p | |
the result returned JSON with | |
{ | |
"status": 2, | |
"error": 0 | |
} |
NewerOlder