This file contains hidden or 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
| a = 'abcdef' | |
| for x in 2,3,6: | |
| print(f'{x} : {a[x-1]}') |
This file contains hidden or 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
| import requests | |
| # from pathlib import Path | |
| from pprint import pprint | |
| road = 'A1' | |
| url = f'http://www.trafficengland.com/api/events/getByRoad?road={road}&events=CONGESTION,INCIDENT,ROADWORKS,MAJOR_ORGANISED_EVENTS,ABNORMAL_LOADS&direction=all&includeUnconfirmedRoadworks=true' | |
| r = requests.get(url) | |
| for event in r.json(): | |
| print(event) |
This file contains hidden or 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
| # https://sigrok.org/wiki/BG7TBL | |
| import serial | |
| ser = serial.Serial('/dev/ttyUSB0', 57600, timeout=1) # Linux first tty | |
| # ser.write(b'\x8fv') | |
| # print("Version is " + ser.read()) | |
| cmd = f'{int(1e9+26000/10):09d}' # ~ 1GHz |
This file contains hidden or 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
| find . -type d -empty -not -path '*/\.*' -delete |
This file contains hidden or 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 importlib import reload | |
| import recycling | |
| time.sleep(60) # time to edit recycling | |
| reload(recycling) # reload recycling | |
| recycling.get_recycling() # make use of the module | |
| # https://stackoverflow.com/questions/1254370/reimport-a-module-in-python-while-interactive |
This file contains hidden or 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 python | |
| from pathlib import Path | |
| from pprint import pprint | |
| from requests_html import HTMLSession | |
| import toml | |
| import schedule | |
| from time import sleep | |
This file contains hidden or 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
| find . -name "$1" -exec grep -Hn "$2" '{}' \; |
This file contains hidden or 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
| import math | |
| import pandas as pd | |
| import numpy as np | |
| def measurementfunction(columns=['Input', 'Output']): | |
| # Inital call of next() runs the init/setup | |
| print('Init/Setup of Instrument') | |
| buffer = {} | |
| # A initial call of next(generatorobject) will get to this point | |
| x = yield # Where first input is outside the while loop |
This file contains hidden or 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
| sudo chown root:$USER /dev/sdb && qemu-kvm -hda LibreELEC*.img -m 4096 -drive format=raw,file=/dev/sdb ; sudo chown root:disk /dev/sdb |
This file contains hidden or 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 pathlib import Path | |
| older, newer = sorted(list(Path('.').glob('prefix_????-??-??.ext')))[-2:] # last 2 files |