Skip to content

Instantly share code, notes, and snippets.

View AlephAlpha's full-sized avatar

AlephAlpha

View GitHub Profile
@snoyberg
snoyberg / abonimable-snoyman.rs
Created December 2, 2020 15:05
Playing with GATs, transformers, and more
#![feature(generic_associated_types)]
#[allow(dead_code)]
trait Functor {
type Unwrapped;
type Wrapped<B>: Functor;
fn map<F, B>(self, f: F) -> Self::Wrapped<B>
where
F: FnMut(Self::Unwrapped) -> B;
@maksverver
maksverver / PKGBUILD
Created November 7, 2020 20:16
golly-4.0 PKGBUILD
# Maintainer: Kyle Sferrazza <[email protected]>
# Contributor: Maks Verver <[email protected]>
# Contributor: p2k <[email protected]>
# Contributor: nokangaroo <[email protected]>
pkgname=golly
pkgver=4.0
pkgrel=1
pkgdesc="A simulator for Conway's Game of Life and other cellular automata"
@veer66
veer66 / last_insert_rowid.rs
Created January 26, 2019 11:27
I tried to get last insert rowid from SQLite via Diesel. #rust
#[macro_use]
extern crate diesel;
pub mod models;
pub mod schema;
use diesel::prelude::*;
use diesel::sqlite::SqliteConnection;
use self::models::{Post, NewPost};
@hlorand
hlorand / vidstab_ffmpeg.md
Last active November 8, 2024 20:34
Video stabilization using VidStab and FFMPEG

Video stabilization using VidStab and FFMPEG

** Step 1 **

Install ffmpeg with the vidstab plugin.

@vyznev
vyznev / hex2map.py
Last active July 28, 2020 12:01
Convert non-totalistic hexagonal CA rules to MAP rules
#!/usr/bin/python
"""
This script converts hexagonal isotropic (possibly non-totalistic) CA rules[1]
into the equivalent MAP rules[2]. It runs under both Python 2 and Python 3, and
can be used either as a stand-along script (with the rules given as command line
arguments) or as a Golly plug-in.
[1]: http://www.conwaylife.com/wiki/Isotropic_non-totalistic_Life-like_cellular_automaton#Hexagonal_neighbourhood
[2]: http://golly.sourceforge.net/Help/Algorithms/QuickLife.html
"""
@Jim-Bar
Jim-Bar / YUV_formats.md
Last active October 30, 2024 13:14
About YUV formats

About YUV formats

First of all: YUV pixel formats and Recommended 8-Bit YUV Formats for Video Rendering. Chromium's source code contains good documentation about those formats too: chromium/src/media/base/video_types.h and chromium/src/media/base/video_frame.cc (search for RequiresEvenSizeAllocation(), NumPlanes() and those kinds of functions).

YUV?

You can think of an image as a superposition of several planes (or layers in a more natural language). YUV formats have three planes: Y, U, and V.

Y is the luma plane, and can be seen as the image as grayscale. U and V are reffered to as the chroma planes, which are basically the colours. All the YUV formats have these three planes, and differ by the different orderings of them.

(* Conway's life rules *)
rule = {224, {2, {{2, 2, 2}, {2, 1, 2}, {2, 2, 2}}}, {1, 1}};
(* hashlife algorithm *)
lastId = 1;
h[x_] := (lastId = lastId + 1; h[x] = lastId; q[lastId] = x; lastId);
q2[i_] := ArrayFlatten[Map[q, q[i], {2}]];
step[i_, d_] := step[i, d] = Block[{
i2 = q2[i],
half = Map[step[h[#], d - 1] &, Partition[#, {2, 2}, 1], {2}] &},
@0xjac
0xjac / private_fork.md
Last active November 19, 2024 16:59
Create a private fork of a public repository

The repository for the assignment is public and Github does not allow the creation of private forks for public repositories.

The correct way of creating a private frok by duplicating the repo is documented here.

For this assignment the commands are:

  1. Create a bare clone of the repository. (This is temporary and will be removed so just do it wherever.)

git clone --bare [email protected]:usi-systems/easytrace.git