Skip to content

Instantly share code, notes, and snippets.

View anler's full-sized avatar

Anler anler

View GitHub Profile
@anler
anler / calc-tutorial.md
Last active February 22, 2016 12:13
Emacs calc tutorial

Emacs Calc Tutorial

Getting help

h h See all the help at once.

Working with the stack

. Denotes the top of the stack

@anler
anler / edit
Last active February 22, 2016 12:13
Edit command to launch Emacs
#!/bin/bash
# To automatically start Emacs in daemon mode if there's no daemon already
# running, set:
#
# export ALTERNATE_EDITOR=""
#
# Automatically choose how to open Emacs:
# 1. If running in interactive terminal use the same terminal.
# 2. If there's a frame created, use that frame.
# 3. Otherwise create a new frame and use it.
@anler
anler / archlinux_setup_guide.md
Last active September 28, 2020 17:48
How to setup Archlinux

Archlinux setup guide

This guide is based on the official Archlinux [Installation Guide][1], [Beginners' Guide][2] and my personal experience.

Partition layout

SDD partitions fs size mountpoint
/dev/nvme0n1p1 FAT 512M -
/dev/nvme0n1p2 LUKS MAX -
@anler
anler / purely-functional-streams.js
Last active April 29, 2016 15:26
Purely functional implementation of streams in JavaScript borrowed from SICP
const EMPTY = null;
console.clear();
var naturals$ = Naturals()
var firstFive$ = take(5, naturals$)
applyEach(
n => console.log(n),
firstFive$
)
// 1 2 3 4 5
@anler
anler / purely-functional-observable.js
Created April 29, 2016 16:34
"Purely" functional observable in JavaScript
var ones$ = Repeat(1);
var naturals$ = foldPast(sum, 0, ones$)
applyEach(
n => console.log(n),
naturals$
)
// 1 2 3 4 5 ...
function sum(x, y) {
function Y(f) {
return (function(g) {
return g(g);
})(
function(g) {
return (f)(function(arg) {
return (g(g))(arg);
});
}
);
@anler
anler / build-emacs.sh
Created July 19, 2016 21:56 — forked from favadi/build-emacs.sh
Compile latest emacs version (24.5) in Ubuntu 14.04
#!/bin/bash
# Build latest version of Emacs, version management with stow
# OS: Ubuntu 14.04 LTS
# version: 24.5
# Toolkit: lucid
# Warning, use updated version of this script in: https://github.com/favadi/build-emacs
set -e
function getFourInARow(numbers) {
var xs = partitionEvery(4, numbers);
var transducer = compose(
mapping(calcProduct),
updateIn("maxProduct", max2),
updateIn("avg", avg2(xs.length))
);
var result = xs.reduce(transducer(id), { maxProduct: 0, avg: 0 });
return result.maxProduct - result.avg
}
function namesSorter (departmentsArray) {
return sort(
concat(departmentsArray),
byLengthAndAlphabetically
);
}
function concat(xs) { return xs.reduce(concat2, []); }
function concat2(a, b) { return a.concat(b); }
@anler
anler / update.el
Last active February 25, 2017 09:59
(save-window-excursion
(package-refresh-contents)
(list-packages :no-fetch)
(package-menu-mark-upgrades)
(package-menu-execute :no-query))