Skip to content

Instantly share code, notes, and snippets.

@abubelinha
abubelinha / split_wav.py
Created April 25, 2024 17:09 — forked from rudolfbyker/split_wav.py
Split WAV files at silence
#!/usr/bin/env python
from scipy.io import wavfile
import os
import numpy as np
import argparse
from tqdm import tqdm
# Utility functions
@abubelinha
abubelinha / python2pseudo.py
Created April 21, 2024 23:25 — forked from BlueNexus/python2pseudo.py
Python to Pseudocode converter
import os.path
import re
'''
INSTRUCTIONS
1. Create a file with the following code
2. Put the file you want to convert into the same folder as it, and rename it to "py_file.py"
3. Add a "#F" comment to any lines in the code which have a function call that doesn't assign anything (so no =),
as the program cannot handle these convincingly
4. Run the converter file
@abubelinha
abubelinha / wikidata+pandas.ipynb
Created March 31, 2024 22:49 — forked from sirex/wikidata+pandas.ipynb
Wikidata + Python Pandas.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@abubelinha
abubelinha / Vob2Mp4.bat
Created March 6, 2024 19:16 — forked from andreasbotsikas/Vob2Mp4.bat
Convert DVD to mp4 using ffmpeg
REM Download ffmpeg from https://www.ffmpeg.org/download.html.
REM Place ffmpeg.exe in the folder with the vob files
REM Merge all vob files into one
REM VTS_01_0.VOB is usually the menu which you may not want
if exist VTS_01_7.VOB (
copy /b VTS_01_1.VOB+VTS_01_2.VOB+VTS_01_3.VOB+VTS_01_4.VOB+VTS_01_5.VOB+VTS_01_6.VOB+VTS_01_7.VOB ConCat.vob
) else if exist VTS_01_6.VOB (
copy /b VTS_01_1.VOB+VTS_01_2.VOB+VTS_01_3.VOB+VTS_01_4.VOB+VTS_01_5.VOB+VTS_01_6.VOB ConCat.vob
) else if exist VTS_01_5.VOB (
@abubelinha
abubelinha / annotorious-firebase.html
Created December 16, 2023 20:19 — forked from rsimon/annotorious-firebase.html
Using Firebase as Annotation Backend for Annotorious
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Annotorious | Firebase Demo</title>
<link href="https://fonts.googleapis.com/css?family=Lato&display=swap" rel="stylesheet">
<style>
html, body {
padding:20px;
margin:0px;
@abubelinha
abubelinha / annotorious-opencv-find-contours.js
Created December 16, 2023 20:00 — forked from rsimon/annotorious-opencv-find-contours.js
Sample code for AnnotoriousOSD that automates polygon selection by tracing contours in the selected image section.
import OpenSeadragon from 'openseadragon';
import * as Annotorious from '@recogito/annotorious-openseadragon';
import '@recogito/annotorious-openseadragon/dist/annotorious.min.css';
/*************************************************************************
*
* Basic concept for this is from the official OpenCV docs:
* https://docs.opencv.org/3.4/dc/dcf/tutorial_js_contour_features.html
*
@abubelinha
abubelinha / Caddyfile
Created December 16, 2023 12:45 — forked from jpoehls/Caddyfile
Caddyfile PHP on Windows
# http://caddyserver.com/download
http://localhost:8080 {
startup php.cmd &
fastcgi / 127.0.0.1:9123 php
}
@abubelinha
abubelinha / geojson-test.py
Created November 27, 2023 13:18 — forked from alanorth/geojson-test.py
Checking if GPS points are in a polygon with Shapely
#!/usr/bin/env python
#
# Given the three points below, this code prints:
#
# $ ~/src/geojson-test.py
# True
# True
# False
#
# Requires shapely to be installed in the virtual environment.
@abubelinha
abubelinha / dspace6-post-item-rest.md
Created November 27, 2023 13:15 — forked from alanorth/dspace6-post-item-rest.md
POSTing items to the DSpace 6 REST API

POSTing an item to /collections

First log in to get the JSESSIONID cookie and then post the item (I'm using httpie instead of curl):

$ http -f POST https://dspacetest.cgiar.org/rest/login email=aorth@mjanja.ch password=fuuuu
$ http https://dspacetest.cgiar.org/rest/status Cookie:JSESSIONID=EABAC9EFF942028AA52DFDA16DBCAFDE
$ http POST https://dspacetest.cgiar.org/rest/collections/f10ad667-2746-4705-8b16-4439abe61d22/items Cookie:JSESSIONID=EABAC9EFF942028AA52DFDA16DBCAFDE < item-object.json
HTTP/1.1 200 OK
Connection: keep-alive
Content-Encoding: gzip
@abubelinha
abubelinha / convert-docx-to-html.py
Created April 10, 2023 08:24 — forked from phillipkent/convert-docx-to-html.py
Python code using the python-docx module to convert a DOCX file to HTML
# Converts a docx file with tables and images to (simple) HTML
# ORIGINAL CODE BY DAVID SSALI AT SOURCE: https://medium.com/@dvdssali/docx-to-html-1374eb6491a1
#
# Requires the Python module 'python-docx' <https://python-docx.readthedocs.io>
#
# Example use:
# >>> s = convert('./SOURCEDIR', 'SAMPLE.docx')
# >>> print(s)
# or
# $ python .\convert-docx-to-html.py > temp.html