Skip to content

Instantly share code, notes, and snippets.

@flxai
flxai / cam.py
Created January 7, 2021 23:53
Python stub for testing DIY remote release for Lumix GH2
#!/usr/bin/env python3
from gpiozero import LED
from time import sleep
pin_trigger = LED('BOARD13')
pin_focus = LED('BOARD11')
sleep_min = .1
def trigger():
@flxai
flxai / dfget.py
Created November 21, 2020 00:07
Download URL, select table and have interactive IPython shell with defined DataFrame
#!/usr/bin/env python
# dfget gets URL and interprets interactively selected table as Pandas DataFrame
import inquirer
import requests
import sys
import IPython
import pandas as pd
@flxai
flxai / dfget.py
Created October 7, 2020 21:12
dfget
#!/usr/bin/env python
# dfget gets URL and interprets interactively selected table as Pandas DataFrame
import inquirer
import requests
import sys
import IPython
import pandas as pd
@flxai
flxai / 30d.svg
Created September 20, 2020 19:07
Comparison of flipdot chat activity by protocol
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Plot COVID-19 data on the city of Kassel. Data source is the city's own dedicated website which was scraped from a bot who posted changes in IRC. These changes have then been scraped again using some regexes:

echo 'day,time,county,total,total_rel,recovered,recovered_rel,infected,infected_rel,dead,dead_rel' > covid-ks-$(date -I).csv
grep -E 'Kassel (Stadt|Land):.+tot$' ~/.weechat/logs/irc.freenode.\#flipdot.weechatlog | sed -re 's/(,|\[psa\]|insgesamt|genesen|infiziert|tot|\)|\+|Kassel)//g' -e 's/@flipbot//' -e 's/(: )/ /g' -e 's/Stadt/0/' -e 's/Land/1/g' -e 's/(\s|\t|\(| )+/,/g' -e 's/,$//' >> covid-ks-$(date -I).csv

To see interactive plots, download the necessary libraries first:

#!/usr/bin/env python3
# Send stuff to the landscape flipdot panel
from socket import *
from time import sleep
FD_ADDRESS = ('192.168.1.132', 1234)
SLEEP_S = 1.5
TEXT = ["1 flipdot", "2 hacker", "3 space", "4 kassel"]
while True:
@flxai
flxai / carpet.sh
Last active February 10, 2020 17:05
#!/bin/bash
# Draws an endless carpet
# carpet [REPETITION] [FLICKER_MODE]
[[ $# -gt 0 ]] && s="$1" || s=4
[[ $# -gt 1 ]] && m="$2" || m=0
while :; do
if [[ -z "$b" ]]; then
p=$(pyceau -m "$m" -r 18+18 -d $(tput cols)x1 -s "$s")
else
p=$(pyceau -m "$m" -r 18+18 -d $(tput cols)x1 -s "$s" -b $b)
@flxai
flxai / grab.py
Created December 9, 2019 13:21
Grab data for a category from Geizhals
#!/usr/bin/env python3
import re
import requests
import sys
import time
from bs4 import BeautifulSoup
from matplotlib.lines import Line2D
import numpy as np
@flxai
flxai / PrimeFactorCount.ipynb
Last active October 20, 2019 21:07
Prime factor count
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@flxai
flxai / box.svg
Last active September 29, 2019 21:49
Talk to Clippy
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.