Skip to content

Instantly share code, notes, and snippets.

View loguntsov's full-sized avatar
💭
open for offers

Sergey Loguntsov loguntsov

💭
open for offers
  • Russia, Saint-Petersburg
View GitHub Profile
-module(huify).
-export([huify/1]).
-define(cl_vowels(),
[$а, $е, $ё, $и, $о, $у, $ы, $э, $ю, $я]).
-define(cl_consonants(),
[$б, $в, $г, $д, $ж, $з, $к, $л, $м, $н, $п, $р, $с, $т, $ф, $х, $ц, $ч,
$ш, $щ]).
-define(cl_etc(),
@Titiaiev
Titiaiev / bash-guide-1.md
Last active April 2, 2024 14:40
шпаргалка по написанию bash скриптов, по ссылке - оригинальная статья на хабре

Бесплатная книга-сайт на русском, полный гайд
Advanced Bash-Scripting Guide

Введение

BASH — Bourne-Again SHell (что может переводится как «перерожденный шел», или «Снова шел Борна(создатель sh)»), самый популярный командный интерпретатор в юниксоподобных системах, в особенности в GNU/Linux. Ниже приведу ряд встроенных команд, которые мы будем использовать для создания своих скриптов.

>break выход из цикла for, while или until

@seriyps
seriyps / uptime.erl
Last active April 29, 2022 08:38
Uptime of Erlang node
-export([uptime/0, uptime/1, uptime_string/0]).
%% @doc uptime in native time units
uptime() ->
erlang:monotonic_time() - erlang:system_info(start_time).
%% @doc uptime in specified time units
uptime(Unit) ->
erlang:convert_time_unit(uptime(), native, Unit).
email
erxzk@ecqo.nw
ziouijsnj@jvmf.lv
pbttaibdfv@mmvr.eg
ztdwjqym@aaex.qg
yoyahhh@quie.nv
szbljfvog@skmx.wx
juwweb@gkhl.qr
zofvzeog@abhf.qs
pgxurngwcz@xxfj.sz
@debasishg
debasishg / gist:8172796
Last active March 15, 2024 15:05
A collection of links for streaming algorithms and data structures

General Background and Overview

  1. Probabilistic Data Structures for Web Analytics and Data Mining : A great overview of the space of probabilistic data structures and how they are used in approximation algorithm implementation.
  2. Models and Issues in Data Stream Systems
  3. Philippe Flajolet’s contribution to streaming algorithms : A presentation by Jérémie Lumbroso that visits some of the hostorical perspectives and how it all began with Flajolet
  4. Approximate Frequency Counts over Data Streams by Gurmeet Singh Manku & Rajeev Motwani : One of the early papers on the subject.
  5. [Methods for Finding Frequent Items in Data Streams](http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.187.9800&rep=rep1&t
PLT_NAME=.projectname_dialyzer.plt
$(PLT_NAME):
@ERL_LIBS=../erllib/deps dialyzer --build_plt --output_plt $(PLT_NAME) \
--apps erts kernel stdlib sasl crypto lager jiffy \
amqp_client rabbit_common || true
dialyze: $(PLT_NAME)
@dialyzer apps/projectname/ebin --plt $(PLT_NAME) --no_native \
-Werror_handling -Wunderspecs -Wrace_conditions
@RJ
RJ / Makefile-erlang.mk
Last active November 2, 2019 07:29
Makefile fragment that generates makefile targets to call make with a given target on all apps/* subdirs. Useful for erlang projects using erlang.mk that have apps/{app1,app2,app3..} structure (which rebar doesn't mind). Eg: call "make app" and it will call "make -C apps/app1 app; make -C apps/app2 app; ..." for you.
APPDIRS := $(wildcard apps/*)
## Example hack to filter one out:
## APPDIRS := $(filter-out apps/fooapp, $(APPDIRS))
define PROXY_TARGET
$(1):
$(foreach appdir,$(APPDIRS),$(MAKE) -C $(appdir) $(1) ;)
endef
@seriyps
seriyps / email.erl
Last active November 6, 2022 02:03
Send emails using Erlang gen_smtp shortcut.
% Send plaintext email using gen_smtp https://github.com/Vagabond/gen_smtp
% This function sends email directly to receiver's SMTP server and don't use MTA relays.
%
% Example plaintext email:
% Mail = mail_plain(<<"Bob <sender@example.com>">>, <<"Alice <receiver@example.com>">>, <<"The mail subject">>, <<"The mail body">>),
% send_email(Mail).
%
% Example email with image attachment:
% ImgName = "image.jpg",
% {ok, ImgBin} = file:read_file(ImgName),
@seriyps
seriyps / walker_alias.erl
Last active February 15, 2022 14:07
Walker alias method implemented in Erlang
%%% @author Sergey Prokhorov <me@seriyps.ru>
%%% @copyright (C) 2013, Sergey Prokhorov
%%% @doc
%%% @license Apache License Version 2.0
%%%
%%% Walker alias method - efficient random selection with defined probabilities.
%%% <http://en.wikipedia.org/wiki/Alias_method>
%%%
%%% > ProbabilityValueList = [{10, a}, {20, b}, {30, c}, {40, d}],
%%% > WalkerVectors = walker_alias:build(ProbabilityValueList),
@maxlapshin
maxlapshin / small_erlang.sh
Last active December 17, 2015 00:09
Build and clean small server erlang distribution without useless libraries
#!/bin/bash
[ -f /usr/bin/gcc ] || (apt-get update && apt-get install -y build-essential libncurses-dev libssl-dev chrpath)
#wget http://www.hpl.hp.com/research/linux/atomic_ops/download/libatomic_ops-7.2d.tar.gz
#tar zxf libatomic_ops-7.2d.tar.gz
#cd libatomic_ops-7.2/
#./configure --prefix=/opt/flussonic
#make install
#cd ..