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 <kyle.sferrazza@gmail.com>
# Contributor: Maks Verver <maksverver@geocities.com>
# Contributor: p2k <Patrick.Schneider@uni-ulm.de>
# Contributor: nokangaroo <nokangaroo@aon.at>
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};
@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 April 18, 2024 03: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 April 19, 2024 05:20
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 git@github.com:usi-systems/easytrace.git

[
{
"src": "http://24.media.tumblr.com/tumblr_m1lew907mE1qejbiro1_1280.jpg",
"width": 600,
"height": 476
},
{
"src": "http://25.media.tumblr.com/Jjkybd3nSces6pgsQAXKUKjb_500.jpg",
"width": 500,
"height": 375