Skip to content

Instantly share code, notes, and snippets.

View rachmadaniHaryono's full-sized avatar

rachmadani haryono rachmadaniHaryono

  • Germany
View GitHub Profile
"""
require face_recognition, tqdm, pillow, pigeon-jupyter, jupyter
access_key = 'HYDRUS_ACCESS_KEY'
fa = FaceAnnotation(access_key)
annotations = fa.annotate('tag request', ['option1', 'option2])
"""
import io
import os
import face_recognition
@rachmadaniHaryono
rachmadaniHaryono / hydrus_face_recognition_knn.py
Created August 5, 2019 07:59
hydrus face recognition knn
"""hydrus face recognition knn
modified from https://github.com/ageitgey/face_recognition/blob/master/examples/face_recognition_knn.py
"""
import re
import io
from hydrus import Client
import face_recognition
from tqdm import tqdm
@rachmadaniHaryono
rachmadaniHaryono / face_count_and_color.py
Created June 25, 2019 12:28
tag image using face_recognition, animeface, and color detector
#!/usr/bin/env python3
from tempfile import NamedTemporaryFile
from typing import List
import logging
from PIL import Image, ImageStat # type: ignore
from tqdm import tqdm # type: ignore
import animeface as af # type: ignore
import click
import face_recognition as fr # type: ignore
@rachmadaniHaryono
rachmadaniHaryono / hydrus_script.py
Last active March 7, 2022 21:08
hydrus script to replace namespace
""""
this script will replace hydrus namespace based on given parameter and hydrus tag count
tag file is hydrus tag with count number
example:
$ # replace 'https' namespace with 'url'
$ # "https://example.com" -> 'url:https://example.com'
$ hydrus_script.py replace-namespace --access_key 1234_acces_key --tag_file hydrus.txt 'https' 'url:https:'
@rachmadaniHaryono
rachmadaniHaryono / youtube_wl.py
Created January 16, 2019 06:10
parse youtube watch later
#!/usr/bin/env python
import re
import json
from bs4 import BeautifulSoup
def parse(html_file):
"""parse youtube watch later html source.
>>> html_file = "youtube_wl.html"
>>> parse(html_file)
#!/usr/bin/env python
"""based on this article
https://www.pyimagesearch.com/2017/06/19/image-difference-with-opencv-and-python/
tested on python 3.6.2, ubuntu 18.10 with following package
imutils==0.5.2
matplotlib==3.0.2
opencv-python==3.4.3.18
scikit-image==0.14.1
@rachmadaniHaryono
rachmadaniHaryono / yt_beets.py
Last active December 10, 2021 06:47
youtube + beets
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""simple script for download youtube mp3 and add to beets.
workflow
- search title/artist or both from beets
- search youtube query
- choose and download youtube video
- import to beets
@rachmadaniHaryono
rachmadaniHaryono / yiff_party_hydrus.json
Created April 6, 2018 08:52
hydrus parser config for yiff party
[58, "yiff.party api parser", 2, ["yiff.party api parser", "1d2b9ef06c1906b4c0de3d948caf7a06d48db8d4c656f0b9f732991bb061b084", [55, 1, [[], "https://yiff.party/2885342.json"]], [[[31, 1, [["posts", null], 1, [51, 1, [3, "", null, null, "example string"]], [55, 1, [[], "parsed information"]]]], [58, "posts", 2, ["posts", "5e0b0fe24397f162858602daf41ba8130443d220524d70c344d11f82f5862b94", [55, 1, [[], "example string"]], [[[31, 1, [["attachments", null], 1, [51, 1, [3, "", null, null, "example string"]], [55, 1, [[], "parsed information"]]]], [58, "attachments parser", 2, ["attachments parser", "b2d5a4f20f4bb9b05696df1623a31dbfe58cde6e77e10130972a8e221971b01f", [55, 1, [[], "example string"]], [], [26, 1, [[30, 2, ["attachment file url", 7, [31, 1, [["file_url"], 0, [51, 1, [3, "", null, null, "example string"]], [55, 1, [[], "parsed information"]]]], [2, 0]]], [30, 2, ["attachment filename tag", 0, [31, 1, [["file_name"], 0, [51, 1, [3, "", null, null, "example string"]], [55, 1, [[[9, ["\\.[^.]+$", ""]]], "1.
# part 1 import
import inspect
import os
from gallery_dl import extractor as gallery_dl_extractor
from gallery_dl.job import Job
from yapsy.PluginManager import PluginManager
import structlog
###############################################################################
# part 2 import
#!/usr/bin/python3
from urllib.parse import urljoin
import json
import bs4
import click
import aiohttp
import asyncio
import async_timeout