Skip to content

Instantly share code, notes, and snippets.

View AlephAlpha's full-sized avatar

AlephAlpha

View GitHub Profile
# pip install python-lifelib
from math import log2
from lifelib.pythlib.pattern import Pattern
import lifelib
import sys
def get_gen(pat: Pattern, maxexp: int) -> int | None:
x = pat
@AlephAlpha
AlephAlpha / PKGBUILD
Last active November 9, 2020 03:55 — forked from maksverver/PKGBUILD
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"
@AlephAlpha
AlephAlpha / _tealdeer
Last active July 22, 2019 09:12
zsh autocompletion for tealdeer, a tldr implementation in Rust (https://github.com/dbrgn/tealdeer )
#compdef tldr
_arguments : \
{-h,--help}'[Print the help message]' \
{-v,--version}'[Show version information]' \
{-l,--list}'[List all commands in the cache]' \
{-f,--render}'[Render a specific markdown file]:file:_files' \
{-o,--os}'[Override the operating system]:type:(linux osx sunos windows other)' \
{-u,--update}'[Update the local cache]' \
{-c,--clear-cache}'[Clear the local cache]' \
@AlephAlpha
AlephAlpha / z3_life_search.py
Last active March 30, 2021 01:21
试玩 Z3……速度好慢,搜个 25P3H1V0.1 都要十几秒。懒得支持生命游戏以外的规则以及对称性了。
#!/usr/bin/env python
from z3 import *
import sys
class LifeSearch:
nbhd = {(i, j): 1 if i == j == 0 else 2
for i in range(-1,2)
for j in range(-1,2)}
@AlephAlpha
AlephAlpha / luna_pinyin.cthulhu.dict.yaml
Created August 10, 2018 07:39
Rime 克苏鲁神话词库,手动整理,欢迎补充。
# Rime custom dictionary
# encoding: utf-8
#
# Rime 克苏鲁神话词库
# 手动整理,欢迎补充
#
# 参考资料:
# * Frend《邪神与那些创造邪神的人》
# https://www.zhihu.com/people/frend-10/posts
# * 艾守义《克苏鲁神话:萌萌哒古神在哪里》
@AlephAlpha
AlephAlpha / StillLife.m
Last active July 18, 2018 13:27
Game of Life still life searcher in Mathematica
SearchStillLife[w_, h_] :=
Block[{r = RandomInteger[1, {w, h}]},
ArrayPlot[
Echo[Mod[r + ArrayReshape[Boole@#, {w, h}], 2], "RLE: ",
"x = " <> #2 <> ", y = " <> #1 <> ", rule = B3/S23\n" & @@
ToString /@ Dimensions@# <>
StringRiffle[
StringCases[
StringReplace[
StringReplace[
@AlephAlpha
AlephAlpha / TUNet.wl
Last active April 15, 2018 13:10
用Mathematica写了个TUNet登录脚本
#!/usr/bin/env wolframscript
(*_*)
(*命令行参数有两个以上时,前两个分别为用户名和密码*)
(*命令行参数只有一个时,退出登录*)
(*没有命令行参数,显示登录状态*)
@AlephAlpha
AlephAlpha / webcomics.wl
Last active June 5, 2019 03:08
转发网漫的Mathematica脚本(已放到 GitHub:https://github.com/AlephAlpha/WebComics ,此处不再更新)
#!/usr/bin/env wolframscript
appURL = " https://github.com/AlephAlpha/WebComics";
weiboAPI = "https://api.weibo.com/2/statuses/share.json";
(* 请设成脚本所在的目录 *)
(* 目录名有中文时必须先转 UTF8 *)
SetDirectory[
FromCharacterCode[
ToCharacterCode@"/home/alephalpha/文档/马甲与小号/WebComics/", "UTF8"]];
@AlephAlpha
AlephAlpha / jcuken.schema.yaml
Created August 11, 2016 09:55
Rime 俄语 ЙЦУКЕН 键盘布局
# Rime schema
# vim: set sw=2 sts=2 et:
# encoding: utf-8
schema:
schema_id: jcuken
name: ЙЦУКЕН
version: "1.0"
author:
- AlephAlpha <alephalpha911@gmail.com>
@AlephAlpha
AlephAlpha / 10moliyf.md
Last active July 17, 2018 13:20
10 Mathematica One Liners to Impress Your Friends