Skip to content

Instantly share code, notes, and snippets.

View AlephAlpha's full-sized avatar

AlephAlpha

View GitHub Profile
+++++
++++-+><++++-+++<>-+><<>-++++><<>++-+++++
++++++-++-+++++<>+++++++++-++<>+++++++++->< +++
+++++><><+++-+-+<><>++++-+++- ++.>+<<> <+-<<<<<+-
+><<<>> <>>>>+-> <>-+>>>+-+
++><+++ ++>-+>> >>>[>++ +>-+-<>++-
<+-><++- ++<-]<< ><<<>+- <<<+++-><+-
++++++++ ><++++++ ++++++-+++<>- ++<>++-+-+-+ <>-+++
+><+++++++-++->>>>>><<>>[>+>++><---<+->< +-+-<-><]+-<+-<<<><<<><++<>><+++++<<<<><-+-+-+
<<<<<+++->>>>>>>>>+++><+++++<>+-+++>>>> >>[>+>+---+<>-++<<-]><<<<<<<++++-<-+>++++++
@AlephAlpha
AlephAlpha / Brainfuck
Last active December 25, 2015 14:39
Brainfuck interpreter in Mathematica.
ToExpression[
"input=StringToStream[\"" <> ##2 <>
"\"];Clear[memory];memory[_]=pointer=0;" <>
StringReplace[#,
{">" -> "pointer++;",
"<" -> "pointer--;",
"+" -> "memory[pointer]++;",
"-" -> "memory[pointer]--;",
"." -> "BinaryWrite[OutputStream[\"stdout\",1],memory[pointer]];",
"," -> "memory[pointer]=BinaryRead[input];",
@AlephAlpha
AlephAlpha / palladius.schema.yaml
Last active March 6, 2016 16:54
Rime 西里尔拼音输入方案
# Rime schema
# vim: set sw=2 sts=2 et:
# encoding: utf-8
schema:
schema_id: palladius
name: "西里尔拼音"
version: "0.0"
author:
- AlephAlpha <alephalpha911@gmail.com>
@AlephAlpha
AlephAlpha / maze
Last active June 22, 2016 00:01
Maze generator in Mathematica.
MazeGraphics[m_, n_] :=
Block[{$RecursionLimit = Infinity,
unvisited = Tuples[Range /@ {m, n}], maze},
maze = Graphics[{Line[{{#, # - {0, 1}}, {#, # - {1, 0}}}] & /@
unvisited,
Line[{{0, n}, {0, 0}, {m, 0}}]}]; {unvisited =
DeleteCases[unvisited, #];
Do[If[MemberQ[unvisited, neighbor],
maze = DeleteCases[
maze, {#,
@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 / 2048.nb
Last active November 24, 2016 04:45
(*_*)
挪[左] = # //. {{x___, 1, a_ /; a > 1, y___} :> {x, a, 1, y},
{x___, a_ /; a > 1, a_, y___} :> {x, 2 抓住[a], 1, y}} /.
抓住[a_] :> a &;
挪[上] = Composition[Transpose, 挪[左], Transpose];
挪[下] = Composition[Reverse, 挪[上], Reverse];
挪[右] = Composition[Transpose, 挪[下], Transpose];
加块瓦 = ReplacePart[#, RandomChoice@Position[#, 1] -> 2] &;
@AlephAlpha
AlephAlpha / TUNet.wl
Last active April 15, 2018 13:10
用Mathematica写了个TUNet登录脚本
#!/usr/bin/env wolframscript
(*_*)
(*命令行参数有两个以上时,前两个分别为用户名和密码*)
(*命令行参数只有一个时,退出登录*)
(*没有命令行参数,显示登录状态*)
@AlephAlpha
AlephAlpha / 10moliyf.md
Last active July 17, 2018 13:20
10 Mathematica One Liners to Impress Your Friends
@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 / 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"]];