Skip to content

Instantly share code, notes, and snippets.

View AlephAlpha's full-sized avatar

AlephAlpha

View GitHub Profile
(* 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 March 3, 2026 05:52
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
@yohhoy
yohhoy / ff2cv.cpp
Last active December 14, 2024 12:44
Read video frame with FFmpeg and convert to OpenCV image
/*
* Read video frame with FFmpeg and convert to OpenCV image
*
* Copyright (c) 2016 yohhoy
*/
#include <iostream>
#include <vector>
// FFmpeg
extern "C" {
#include <libavformat/avformat.h>
@parmentf
parmentf / GitCommitEmoji.md
Last active February 27, 2026 08:17
Git Commit message Emoji
@nixpulvis
nixpulvis / ping.rs
Created November 18, 2015 21:38
A simple Ping implementation in Rust.
#![feature(ip_addr, raw)]
extern crate pnet;
use std::net::{IpAddr, Ipv4Addr};
use pnet::transport::TransportChannelType::Layer4;
use pnet::transport::TransportProtocol::Ipv4;
use pnet::transport::transport_channel;
use pnet::packet::ip::IpNextHeaderProtocols;
use pnet::packet::Packet;
@emptymalei
emptymalei / Q
Last active June 28, 2016 01:35
Draft
好吧,本来我是想着我自己想起什么来就记上的,gist 这玩意也没法合作,所以就用评论吧。
1. 在自己公司自由的做科研的感受是什么?(跟大学比?)
2. 完全自由的 AI 的实现最大的障碍?
git config --global https.proxy http://127.0.0.1:1080
git config --global https.proxy https://127.0.0.1:1080
git config --global --unset http.proxy
git config --global --unset https.proxy
npm config delete proxy
@myusuf3
myusuf3 / delete_git_submodule.md
Created November 3, 2014 17:36
How effectively delete a git submodule.

To remove a submodule you need to:

  • Delete the relevant section from the .gitmodules file.
  • Stage the .gitmodules changes git add .gitmodules
  • Delete the relevant section from .git/config.
  • Run git rm --cached path_to_submodule (no trailing slash).
  • Run rm -rf .git/modules/path_to_submodule (no trailing slash).
  • Commit git commit -m "Removed submodule "
  • Delete the now untracked submodule files rm -rf path_to_submodule
@willurd
willurd / web-servers.md
Last active March 1, 2026 18:36
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000