Simplest implementation of do-notation in Erlang without using parse-tranform
<<"16.0">> = pipeline:do(0, [
fun(X) -> X+1 end,
fun(X) -> X+3 end,
define RUN_SCRIPT | |
import tarfile | |
import StringIO | |
import imp | |
import runpy | |
PKG_NAME = "some_module" | |
if __name__ == '__main__': | |
tar_fd = StringIO.StringIO(PKG_DATA) |
% For running can be used 'rabbitmqctl' | |
% Example: | |
% sudo rabbitmqctl eval 'node().' | |
% Find process with the largest memory consumption | |
lists:sublist( | |
lists:reverse( | |
lists:sort([{process_info(Pid, memory), Pid, process_info(Pid)} || Pid <- processes()])), 1). | |
% get all vhosts |
all: build | |
init: | |
opam init -a | |
opam pin add web-project . -n | |
get-deps: | |
opam install --deps-only web-project |
create or replace | |
function partition_insert_trigger() returns trigger | |
language 'plpgsql' as $$ | |
declare | |
column_name text := TG_ARGV[0]; | |
columnt_format text := TG_ARGV[1]; | |
column_value timestamp; | |
table_name text; | |
insert_stmt_tpl text := 'insert into %I select ($1).*'; | |
insert_stmt text; |
Erlang list is a singly linked list. Each item has a size of 2 Eterm: one for storing value, second for storing the pointer to next item.
When you append new element to the list:
-module(test). | |
-compile([export_all]). | |
-links([ | |
"https://github.com/efcasado/forms", | |
"https://github.com/matwey/pybeam", | |
"https://gist.github.com/kuenishi/3183043", | |
"https://github.com/hypernumbers/LuvvieScript", | |
"https://github.com/erlang/otp/blob/OTP-18.2/lib/compiler/src/genop.tab", |
# check elapsed time after last modification | |
# not often than once at 15 minutes | |
if [ $(( $(date +%s) - $(stat --format %Y "some_file.txt") )) -gt 900 ] | |
then | |
echo "old" | |
fi |
// https://en.wikipedia.org/wiki/Mercator_projection | |
function MercatorProjection(){ | |
this.EARTH_RADIUS = 6378137 // WGS-84 | |
this.EARTH_HALF_CIRCUMFERENCE = Math.PI * this.EARTH_RADIUS // 20037508.342789244 | |
this.EARTH_METERS_PER_DEGREE = (Math.PI * this.EARTH_RADIUS) / 180 // 111319.49079327358 | |
this.RADIAN = Math.PI / 180 | |
this.DEGREE = 180 / Math.PI | |
} |