Skip to content

Instantly share code, notes, and snippets.

View Baldomo's full-sized avatar
💻

Leonardo Baldin Baldomo

💻
View GitHub Profile
@Baldomo
Baldomo / solar.rs
Last active September 29, 2023 13:03
Sun position calculation utility in Rust
//! This file is a copy of [solar.c](https://github.com/jonls/redshift/blob/master/src/solar.c) from redshift.
//!
//! This module makes extensive use of the [Julian Day notation](https://en.wikipedia.org/wiki/Julian_day)
//! to measure elapsed days between events and in calculations.
use std::collections::HashMap;
/* Ported from javascript code by U.S. Department of Commerce,
National Oceanic & Atmospheric Administration:
http://www.srrb.noaa.gov/highlights/sunrise/calcdetails.html
It is based on equations from "Astronomical Algorithms" by

Keybase proof

I hereby claim:

  • I am baldomo on github.
  • I am baldomo (https://keybase.io/baldomo) on keybase.
  • I have a public key ASBG1mcyQmuwJ7C1lBQXIxu9reK10z4iUT4acQutGWiF8go

To claim this, I am signing this object:

@Baldomo
Baldomo / install.sh
Created July 12, 2018 10:45
Minimal Luks Arch install
dd if=/dev/urandom of=/dev/sda bs=4k status=progress
# create a GPT table with an EFI and LVM partition
cfdisk /dev/sda
# format partitions
mkfs.fat -F32 /dev/sda1
cryptsetup -v -y -c aes-xts-plain64 -s 512 -h sha512 -i 2000 --use-urandom luksFormat /dev/sda2
cryptsetup luksOpen /dev/sda2 luks
pvcreate /dev/mapper/luks
vgcreate lvm /dev/mapper/luks
lvcreate --name swap --size 4G lvm
@Baldomo
Baldomo / styles.scss
Created June 28, 2018 15:33
Universal line clamping in a SCSS mixin
@mixin line-clamp($lines: 5) {
&:after {
content: '...';
text-align: right;
bottom: 0;
right: 0;
width: 25%;
display: block;
position: absolute;
height: calc(1em * 1.2 * $lines);
@Baldomo
Baldomo / pipeline.py
Created June 28, 2018 13:11
Simple multithreaded PSD layer slicer and PNG exporter (created as a PS CC -> Unity 3D pipeline for pixel-art animations)
#!/usr/bin/env python
from psd_tools import PSDImage, Layer, Group
from sys import argv, exit
from multiprocessing.dummy import Pool
from typing import List
psds: List[PSDImage] = []
def split_export(psd: PSDImage) -> None: