This file contains hidden or 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(file_mode_calc). | |
-export([run/0]). | |
-include_lib("kernel/include/file.hrl"). | |
%% source: https://jameshfisher.github.io/2017/02/24/what-is-mode_t.html | |
-define(S_IRWXU, 8#0000700). | |
-define(S_IRUSR, 8#0000400). |
This file contains hidden or 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(calc). | |
-export([prime_numbers/1]). | |
% Source: https://wbear.wordpress.com/2011/12/08/prime-numbers-with-erlang/ | |
% Sieve of Eratosthenes algorithm for finding all prime numbers up to N. | |
% http://en.wikipedia.org/wiki/Sieve_of_Eratosthenes | |
% Generate list of prime numbers up to N. | |
prime_numbers(N) when is_number(N) -> | |
prime_numbers(N, generate(N)). |
This file contains hidden or 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
## node 1 | |
$ erl | |
1> erl_epmd:start(). | |
2> erl_node:register_node(ejabberd, 23456). | |
## Emergency 'epmd' Recovery | |
## node 2 | |
$ erl -sname repair | |
1> net_adm:ping(ejabberd@hostname). |
This file contains hidden or 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
/*****************************************************************/ | |
/* Super Simple Unix/Linux "Display" commands. */ | |
/* */ | |
/* file : unixcommands.txt */ | |
/* Date : 02/02/2013 */ | |
/* Version: 0.3 */ | |
/* By : Albert van der Sel */ | |
/* Remarks: The Commands will only display information and not */ | |
/* change anything at all. */ | |
/*****************************************************************/ |
This file contains hidden or 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
* Erlang Source Code | |
* Scanning | |
* Parsing | |
* Parse Trasform | |
* Linter | |
* Erlang AST ('P') | |
* Erlang Expanded AST ('E') | |
* Core Erlang | |
* Core Erlang AST | |
* Kernel Erlang |
This file contains hidden or 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
%% part 1: utility module | |
%% ====================== | |
-module(utility). | |
-export([count/2]). | |
%% part 2: count function | |
%% ====================== | |
count(Dir, Word) -> | |
Accumulator = 0, | |
CounterPid = spawn(fun() -> counter(Accumulator) end), |
This file contains hidden or 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(direct_msg_to_rabbit). | |
%% Define Record | |
-record('P_basic', { | |
content_type, | |
content_encoding, | |
headers, | |
delivery_mode, priority, | |
correlation_id, | |
reply_to, |
This file contains hidden or 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(main). | |
-export([hi/0, bye/0, hey/1]). | |
-compile({parse_transform, main_pt}). | |
hi() -> io:format("Hi there!~n"). | |
bye() -> io:format("Bye there!~n"). | |
hey(foo) -> io:format("Hey foo!~n"); | |
hey(bar) -> io:format("Hey bar!~n"). |
This file contains hidden or 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
# in command mode | |
Ctrl+E (move screen up) | |
Ctrl+Y (move screen down) | |
H (move cursor to head of screen) | |
M (move cursor to middle of screen) | |
L (move cursor to end of screen) | |
gg (move cursor to head of file) |
This file contains hidden or 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
%% move cursor to beginning of the line | |
io:format("\e[H"). | |
%% clear the console | |
io:format("\e[J"). | |
%% both | |
io:format("\e[H\e[J"). |
NewerOlder