Skip to content

Instantly share code, notes, and snippets.

View mikel-zhobro's full-sized avatar
🦖
dinosauring

Mikel Zhobro mikel-zhobro

🦖
dinosauring
View GitHub Profile
Google Chrome as well as Mozilla Firerfox both provide an option to copy download link specifically for cURL.
This option will generate cURL with all required things such as User agent for downloading things from the side.
To get that,
1. Open the URL in either of the browser.
2. Open Developer options using Ctrl+Shift+I.
3. Go to Network tab.
4. Now click on download. Saving file isn't required. We only need the network activity while browser requests the file from the server.
5. A new entry will appear which would look like "download.aspx?...".
6. Right click on that and Copy → Copy as cURL.
@mikel-zhobro
mikel-zhobro / record_animated_open3d.py
Created June 6, 2024 13:07
Record the animated scene of a pointcloud trajectory with a camera that rotates w.r.t up.axis
import open3d as o3d
import numpy as np
def create_gif_from_folder(image_list, output_path, duration=20, loop=0):
from PIL import Image
images = []
@mikel-zhobro
mikel-zhobro / dataclass_argparse.py
Last active January 26, 2024 17:13
One file dataclass argparse
from argparse import ArgumentParser
from dataclasses import dataclass, fields, Field, field
class col:
HEADER = "\033[95m"
OKBLUE = "\033[94m"
OKCYAN = "\033[96m"
OKGREEN = "\033[92m"
OKYELLOW = "\33[33m"
WARNING = "\033[93m"
@mikel-zhobro
mikel-zhobro / progress.py
Last active October 11, 2023 19:00
progress bar without dependencies
import sys
import time
def pretty_time(seconds):
seconds = int(round(seconds))
s = seconds % 60
m = (seconds // 60) % 60
h = (seconds // 3600)
return '%d:%02d:%02d' % (h, m, s)
@mikel-zhobro
mikel-zhobro / ply2obj.py
Created August 8, 2023 17:05
Transform pairs of `.ply` and `.png` textures into `.obj` and `.png` textures.
"""
Simple script to convert ply to obj models
"""
import pymeshlab
import os
from argparse import ArgumentParser
def parse_args():
parser = ArgumentParser()
parser.add_argument('input_dir', help='Path to ycb dataset models directory containing .ply files and .png textures.')
from __future__ import print_function
from os.path import dirname, abspath, join
import sys
import zmq
import json
import time
# Find code directory relative to our directory
THIS_DIR = dirname(__file__)
@mikel-zhobro
mikel-zhobro / BisectionMethod.py
Last active October 17, 2021 12:18
Bisection Method (RootFinding, Monotonous Functions)
import ContinuousSet
def bisection_method(f, value, interval, eps=1e-12):
""" Finds the root of f(psi) - value
Args:
f ([function]): f(psi)
value ([float]): value = f(psi0)
interval ([ContinuousSet]): interval of psi to look into
Returns:
@mikel-zhobro
mikel-zhobro / Sets.py
Last active October 17, 2021 12:15
Sets
# # Sets
# Provides logic for different continuous set operators.
# 1. Add continuous intervals of the form [2, 12.2] or (3, 6] in the set
# 2. Union Operator
# 3. Intersection Operator
@mikel-zhobro
mikel-zhobro / libri_trans.bpe_1000.vocab
Created March 16, 2021 09:05
Vocab for Librispeech BPE1k
{
'<s>': 0,
'</s>': 0,
'<unk>': 1,
'THE': 2,
'AND': 3,
'OF': 4,
'TO': 5,
'A': 6,
'IN': 7,
#version: 0.2
T H
TH E</w>
A N
I N
E D</w>
E R
AN D</w>
O U
E R</w>