Skip to content

Instantly share code, notes, and snippets.

@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
@abubelinha
abubelinha / isbn_lookup.py
Created February 25, 2023 08:50 — forked from miladkiaee/isbn_lookup.py
A simple ISBN lookup that uses Python and the Google Books API to display basic information about a book.
import urllib.request
import json
## import textwrap
import sqlite3
database = sqlite3.connect(':memory:')
cur = database.cursor()
def pma_import_resubmit(br, sqlfile, target_dbname):
""" To be used in phpmyadmin dump.sql file imports using python-mechanize
as described in <https://github.com/phpmyadmin/phpmyadmin/issues/17423#issuecomment-1268271930>
Only call this function when you have already found a 'timeout_passed=' string in browser response
(so you are sure the page contains a resubmit link)
"""
# https://stackoverflow.com/questions/3569622/python-mechanize-following-link-by-url-and-what-is-the-nr-parameter/3569707#3569707
#link = br.find_link(url = resumeurl)
link = br.find_link(text = "resubmit the same file")
link.absolute_url = link.absolute_url.replace("&amp;","&").replace("?", "?db="+target_dbname+"&")