Skip to content

Instantly share code, notes, and snippets.

View ddosia's full-sized avatar

Daniil Churikov ddosia

View GitHub Profile
@ericbmerritt
ericbmerritt / Makefile
Last active August 11, 2023 09:35
Universal drop in Makefile for Erlang projects that use rebar
# Copyright 2012 Erlware, LLC. All Rights Reserved.
#
# This file is provided to you under the Apache License,
# Version 2.0 (the "License"); you may not use this file
# except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
@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
@rtraschke
rtraschke / magic.erl
Last active August 29, 2015 14:25
Encouraged by a tweet by Alice Maz (https://twitter.com/alicemazzy/status/623774654772170752), here's my Erlang version of "how to crack a simple crypt" exercise.
-module(magic).
-export([crack/1]).
crack(BaseH) ->
Base = hex_string_to_bytes(BaseH),
Scores = lists:sort([ {score(Base, I), I} || I <- lists:seq(0, 255) ]),
{_, Best_Key} = lists:last(Scores),
<< <<(C bxor Best_Key)>> || C <- Base >>.
@mihow
mihow / load_dotenv.sh
Last active July 16, 2024 13:19
Load environment variables from dotenv / .env file in Bash
if [ ! -f .env ]
then
export $(cat .env | xargs)
fi