Skip to content

Instantly share code, notes, and snippets.

View lucaspar's full-sized avatar

Lucas Parzianello lucaspar

  • University of Notre Dame
View GitHub Profile
lucaspar / slack-notify
Created October 6, 2023 14:44
Slack notification script
#!/bin/env bash
# Slack Notifications
# notify about error on slack channel if errors happened
function _slack_notify() {
lucaspar / heimdall-style.css
Created July 20, 2023 15:18
Heimdall Style
/* Paste these lines in Settings > Advanced > Custom CSS */
/* ================ */
/* generic elements */
body {
background-color: rgb(16, 16, 16);
color: rgb(198, 198, 198);
/* font-family: monospace; */
line-height: 1.8;
lucaspar /
Created July 14, 2023 20:17
Progressively allocates all memory in a system
"""You probably don't want to run this.
import logging
import secrets
from typing import Optional
from humanfriendly import format_size
lucaspar /
Created June 24, 2023 21:39
Debugging in containers

Debugging in containers

Tired of "command not found" - these lines will install commonly used tools to debug networking, read logs, and other things.

Start a shell as root inside the container

CONTAINER_NAME=$(docker ps | grep -i "${CONTAINER_KEYWORD}" | head -n 1 | awk '{print $NF}')
lucaspar /
Created June 14, 2023 20:03
Benchmark | PyArrow conversions
"""Benchmark the conversion of pyarrow arrays to polars, numpy, and lists."""
import time
from typing import Callable
import numpy as np
import pandas as pd
import polars as pl
import psutil
import pyarrow as pa
lucaspar / ub-origin-filters.txt
Last active December 20, 2023 08:20
Denser YouTube's subscriptions view, with smaller thumbnails
! Add these lines to the "my filters" section of ublock origin 12 !important;), #contents.ytd-rich-grid-row:style(display:contents !important;)
lucaspar / Dockerfile
Last active December 20, 2023 08:10
Minimal installation of Poetry in Docker
# use python3 alpine image
FROM python:3.12-alpine
# install curl
RUN apk add --no-cache curl
# install poetry
RUN curl -sSL | python3 -
lucaspar / ntail
Last active November 26, 2022 07:11
Bash helper for displaying the last lines of an output continuously without cluttering the entire screen like `tail -f`.
# Display last N lines of input like tail, but cleaning the screen before every update.
# Example: date; for i in $(seq 1 2000); do echo $i; sleep 0.03; done | ntail 10
function ntail {
# default to 10 lines of tail output
# gets the current time in milliseconds
lucaspar / commands
Last active September 9, 2022 21:04
CRC commands
#!/usr/bin/env bash
# Helper program to list useful CRC commands
function get_pager_cmd() {
if command -v bat &>/dev/null; then
echo "bat -l bash"
echo cat
lucaspar /
Last active August 14, 2022 07:25
Video reading benchmarks | OpenCV and Torchvision
"""Benchmarks for the video reader: OpenCV vs Torchvision.
OpenCV is faster than Torchvision when just reading the frames, but it's slower when
adding the conversions to RGB, tensor, float, and stacking the frames.
Benchmarking OpenCV
Read 300 frames in 0.84 seconds
Read 300 frames in 0.81 seconds
Read 300 frames in 0.98 seconds