Skip to content

Instantly share code, notes, and snippets.

View un1tz3r0's full-sized avatar
🕶️
acting natural

Victor Condino un1tz3r0

🕶️
acting natural
View GitHub Profile
@un1tz3r0
un1tz3r0 / clipfetch.py
Last active August 15, 2022 01:53
clipfetch
#!/usr/bin/python3
#%pip install click clip-retrieval img2dataset aiomultiprocess aiohttp aiofile
from clip_retrieval.clip_client import ClipClient, Modality
import json, pathlib, functools
import aiomultiprocess, asyncio, aiohttp, aiofile
from aiohttp import request, ClientTimeout
from aiomultiprocess import Pool
import click
@un1tz3r0
un1tz3r0 / exec_notify.py
Created February 17, 2022 18:16 — forked from drdaeman/exec_notify.py
Listening to Netlink process events on x86_64 Linux systems (kludgy)
#!/usr/bin/env python
import socket
import os
import struct
if getattr(socket, "NETLINK_CONNECTOR", None) is None:
socket.NETLINK_CONNECTOR = 11
CN_IDX_PROC = 1
@un1tz3r0
un1tz3r0 / stylegan3_fine_tuning_with_colab_2022_01_01.ipynb
Last active July 30, 2024 20:46
stylegan3_training_and_inference_2024_07_30_updated.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@un1tz3r0
un1tz3r0 / svginfo.py
Created June 19, 2021 17:47
Misc python stuff for searching and comparing SVGs for similarity
import re
def parsesvg(svg_file):
from xml.dom import minidom
#from svg.path import parse_path
#import svg.path
#from shapely import geometry as g
#from shapely import ops
try:
with open(svg_file, "r") as f:
@un1tz3r0
un1tz3r0 / for_each_args.cpp
Created May 20, 2021 10:48 — forked from elbeno/for_each_args.cpp
Functions that work over their arguments
//------------------------------------------------------------------------------
// A function that will apply a function to each argument
#include <initializer_list>
#include <utility>
template <typename F, typename... Ts>
void for_each_arg(F&& f, Ts&&... ts)
{
using I = std::initializer_list<int>;
(void) I { (std::forward<F>(f)(std::forward<Ts>(ts)), 0)... };
@un1tz3r0
un1tz3r0 / reindent.py
Last active January 16, 2023 11:32
reindent.py: Fix Python Indent Errors
#!/usr/bin/python3
'''
reindent.py
this script is a tool for fixing inconsistent indentation when your chosen editor chooses to hose your tabs with a bunch of spaces
'''
import os, sys, argparse
from io import StringIO
@un1tz3r0
un1tz3r0 / catmullFitter.js
Created February 17, 2021 23:48 — forked from nicholaswmin/catmull-rom.js
Catmull Rom Fitting Algorithm in Javascript through a series of X/Y Points
/**
* Interpolates a Catmull-Rom Spline through a series of x/y points
* Converts the CR Spline to Cubic Beziers for use with SVG items
*
* If 'alpha' is 0.5 then the 'Centripetal' variant is used
* If 'alpha' is 1 then the 'Chordal' variant is used
*
*
* @param {Array} data - Array of points, each point in object literal holding x/y values
* @return {String} d - SVG string with cubic bezier curves representing the Catmull-Rom Spline
@un1tz3r0
un1tz3r0 / kmeans_elbow.py
Last active July 27, 2021 04:13
kmeans in pure python
# -------------------------------------------------------------------------------
# a very basic k-means/elbow clustering
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# "wrote this up one day while sitting on the terlet. i do some of my best
# thinking there" - Author - Victor M. Condino - Wednesday, Feb. 3rd, 2020
#
# this is some code to find the optimal clustering of points in a n-dimensional
# dataset, when the number of clusters is not known uses the elbow-method.
#
# (I'd like to dedicate this to my mom, Martha, who knows way more about
@un1tz3r0
un1tz3r0 / youtubemusicdownloader.py
Last active December 28, 2024 10:44
This script uses ytmusicapi and pytube together to download your playlists, history or 'liked' songs as high-quality audio-only streams from Youtube Music.
''' This script uses ytmusicapi and pytube together to download your playlists, history or 'liked' songs as
high-quality audio-only streams from Youtube Music, which are protected by a "signatureCipher" obfuscation scheme.
To use it, first install [ytmusicapi] and [pytube] using pip, then follow the instructions for creating the auth
file from the response in an authenticated session to a watch-page request as found in your browser's dev-tools.
The downloaded files are placed in ~/Music, named with the artist and track metadata, and will be skipped instead
of downloaded again next time it is run, based on the videoIds of the downloaded songs.
Merry Xmas - V.
@un1tz3r0
un1tz3r0 / svgtoshapes.py
Created February 24, 2020 20:27
shapely svg import
''' Read and parse SVG files returning a shapely GeometryCollection containing the paths and primitives found.
Transforms are applied and all shapes are returned in the SVG root elements coordinate space. Primitives (rect,
circle and ellipse) are converted to equivalent paths, and only shape outlines are rendered, stroke properties
have no affect and are discarded.
Curved paths (arc and bezier commands and rounded rect, ellipse and circle elements) are linearized using a
naive approach that attempts to create enough segments to reduce maximum distance to the curve to below a
certain threshold, although this is probably not very efficient and most likely implemented in a fairly
broken way.'''