Skip to content

Instantly share code, notes, and snippets.

View habi's full-sized avatar

David Haberthür habi

View GitHub Profile
@habi
habi / checkstyle.sh
Last active September 11, 2024 06:47
`pycodestyle` all Jupyter notebooks in a folder
for i in *.ipynb
# Tell us what we are doing
do echo Checking $i
# Convert the Jupyter notebook to .py and run through pycodestyle
jupyter nbconvert $i --to script && pycodestyle *.py --ignore=E501,E402,W391,W503 --show-source;
# Remove the converted file, thanks to https://stackoverflow.com/a/12152997
echo Removing "${i%.*}.py"
rm "${i%.*}.py"
done
@habi
habi / arrow
Created September 6, 2024 11:40
def ourarrow(x, y, linestyle='solid', yaw='left', pitch='up', color='white'):
# usually, the arrow points to the left
horizontaldisplacement = 75
verticaldisplacement = horizontaldisplacement
if 'right' in yaw:
horizontaldisplacement = horizontaldisplacement * -1
if 'down' in pitch:
verticaldisplacement = verticaldisplacement * -1
plt.gca().annotate('', xy=(x, y),
xytext=(x + horizontaldisplacement, y + verticaldisplacement),
@habi
habi / function.py
Created September 5, 2024 14:05
Orthoslicer in Python
def orthoslicer(stack, direction, coordinates, verbose=False):
'''Works like "orthogonal view" (CTRL+Shift+H in ImageJ'''
if verbose:
print('The input stack has a size of %s x %s x %s px' % (stack.shape[0],
stack.shape[1],
stack.shape[2]))
print('Extracting a slice centered %s, %s, %s px in direction %s' % (coordinates[0],
coordinates[1],
coordinates[2],
direction))
@habi
habi / fever.opml
Last active March 4, 2025 20:07
Am OPML file
<?xml version="1.0" encoding="UTF-8"?>
<opml version="1.0">
<!-- OPML generated by Fever -->
<head><title>Fever</title></head>
<body>
<outline text="Kindling">
<outline type="rss" text="www.woz.ch/taeglich/feed" title="www.woz.ch/taeglich/feed" xmlUrl="www.woz.ch/taeglich/feed" htmlUrl=""/>
<outline type="rss" text="500 Internal Server Error" title="500 Internal Server Error" xmlUrl="https://www.biorxiv.org/alerts?destination=alerts/search/add&amp;search_query=haberth%25C3%25BCr" htmlUrl="https://www.biorxiv.org/alerts?destination=alerts/search/add&amp;search_query=haberth%25C3%25BCr"/>
<outline type="rss" text="Andrew Janowczyk" title="Andrew Janowczyk" xmlUrl="http://www.andrewjanowczyk.com/feed" htmlUrl="https://andrewjanowczyk.com"/>
<outline type="rss" text="Arq Backup Blog" title="Arq Backup Blog" xmlUrl="https://www.arqbackup.com/blog/feed" htmlUrl="https://www.arqbackup.com/blog"/>
@habi
habi / laengstepisten.geojson
Created February 23, 2024 21:31
./osm-lump-ways -i switzerland-latest.osm.pbf -f piste:type=downhill -f area≠yes -o laengstepisten.geojson
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@habi
habi / proof.md
Created January 17, 2024 13:13
Keyoxide proof

aspe:keyoxide.org:SANRZ2DWCGCATM22OQ26RWURBI

@habi
habi / 1944_OSS_Simple_Sabotage_Field_Manual.md
Last active October 16, 2023 03:28 — forked from kennwhite/1944_OSS_Simple_Sabotage_Field_Manual.md
1944 OSS Simple Sabotage Field Manual
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@habi
habi / Imread.ipynb
Last active June 22, 2021 08:35
Issues with different `imreads`
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.