The idea of using gists for blogging sounds interesting. They can be searched like this for a user's blog gists. #blog
should be appended to the title of the gist for it to show up in the search result.
View server1.erl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-module(server1). | |
-export([start/2, rpc/2]). | |
start(Name, Mod) -> | |
register(Name, spawn(fun() -> loop(Name, Mod, Mod:init()) end)). | |
rpc(Name, Request) -> | |
Name ! {self(), Request}, | |
receive | |
{Name, Response} -> Response |
View name_server1.erl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-module(name_server). | |
-export([init/0, add/2, find/1, handle/2]). | |
-import(server1, [rpc/2]). | |
%% client routines | |
add(Name, Place) -> rpc(name_server, {add, Name, Place}). | |
find(Name) -> rpc(name_server, {find, Name}). | |
%% callback routines | |
init() -> dict:new(). |
View server2.erl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-module(server2). | |
-export([start/2, rpc/2]). | |
start(Name, Mod) -> | |
register(Name, spawn(fun() -> loop(Name,Mod,Mod:init()) end)). | |
rpc(Name, Request) -> | |
Name ! {self(), Request}, | |
receive | |
{Name, crash} -> exit(rpc); |
View server3.erl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-module(server3). | |
-export([start/2, rpc/2, swap_code/2]). | |
start(Name, Mod) -> | |
register(Name, | |
spawn(fun() -> loop(Name,Mod,Mod:init()) end)). | |
swap_code(Name, Mod) -> rpc(Name, {swap_code, Mod}). | |
rpc(Name, Request) -> |
View name_server3.erl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-module(name_server1). | |
-export([init/0, add/2, find/1, handle/2]). | |
-import(server3, [rpc/2]). | |
%% client routines | |
add(Name, Place) -> rpc(name_server, {add, Name, Place}). | |
find(Name) -> rpc(name_server, {find, Name}). | |
%% callback routines | |
init() -> dict:new(). |
View server4.erl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-module(server4). | |
-export([start/2, rpc/2, swap_code/2]). | |
start(Name, Mod) -> | |
register(Name, spawn(fun() -> loop(Name,Mod,Mod:init()) end)). | |
swap_code(Name, Mod) -> rpc(Name, {swap_code, Mod}). | |
rpc(Name, Request) -> | |
Name ! {self(), Request}, |
View baseXencoding
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func sample_usage() { | |
digits := "0123456789abcdefghijklmnopqrstuvwxyz" // base 36 | |
var num int64 = 9876543210 | |
fmt.Printf("input number is %d\n", num) | |
e := encode(num, digits) | |
fmt.Printf("encoded as %v\n", e) | |
d := decode(e, digits) | |
fmt.Printf("decoded as %v\n", d) | |
} |
View persian_calendar.ex
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule PersianCalendar do | |
@moduledoc """ | |
for converting persian calendar to/from gregorian calendar | |
""" | |
@breaks [ | |
-61, | |
9, | |
38, | |
199, |
View flowchart_fate_accelerated.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View 2021-w44-using-github-gists-for-blogging.md
OlderNewer