Skip to content

Instantly share code, notes, and snippets.

@ricardocchaves
ricardocchaves / Quotes Pending Trademark
Last active August 21, 2023 10:12
Quotes Pending Trademark
When you race against time, time races against you ™ August 10th, 2023
# Pending trademark
# DISCLAIMER
# These quotes at the time of writing were not found in Google. So I'm claiming them as my own :)
#!/bin/python3
# https://www.reddit.com/r/london/comments/xup3yh/monday_maths_at_canada_water_tube_station/
def allUnique(x):
seen = set()
return not any(i in seen or seen.add(i) for i in str(x))
def allEqual(x):
return len(set(str(x))) == 1
ABCDE = 9999
#!/usr/bin/python3
# Calculates stats for the entire test scene (all OBUs)
# WARNING: Must be adapted to your use case.
# Usage example:
# import ipfs.parseStats as ipfs
# downloads = ipfs.parse_data(fname)
# s,r,dup,dow,a,p = ipfs.detail_results(downloads)
import time
import datetime
import sys
@ricardocchaves
ricardocchaves / ipfs_progress.py
Last active March 25, 2021 00:56
IPFS - Get download progress of reachable peers for a CID
#!/usr/bin/python3
# Eg. command: ./ipfs_progress.py QmV5z4Wv7ENX5KoLuBHAbBVg8Yb9ibFM9xYMWb1gLWn93w
import subprocess as sp
import sys
import threading
import concurrent.futures as thr
import curses
import time
from datetime import datetime
@ricardocchaves
ricardocchaves / blender_forcefield.py
Last active August 23, 2020 06:30
Blender - An empty acts as a "force field" towards a group of objects.
import bpy
import mathutils
from random import randint
def my_handler(scene):
# I couldn't register a class as handler or use global variables
# so I'm using hidden empties as global variables to store the
# previous positions when required.
old_loc_name = "old_empty"
if old_loc_name not in bpy.data.objects: