Skip to content

Instantly share code, notes, and snippets.

☢️
This place is not a place of honor… no highly esteemed deed is commemorated here

Fred Hebert ferd

☢️
This place is not a place of honor… no highly esteemed deed is commemorated here
Block or report user

Report or block ferd

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@ferd
ferd / adtech.md
Created Jun 10, 2019
AdTech in a non-linear timeline nutshell
View adtech.md

Essentially, there's a publisher side (the website displaying the ads), a supply side (the advertisers wanting to display ads), and the client (you). The advertisers might be individual corporations, but they could also be agencies that represent various advertisers or corporations as well.

Traditional advertising was either the publisher or supply side contacting each other to set up a campaign. They could strike a deal like "display my ads on your site for a week for $x" and off you'd go. A contract was signed, you added a banner, and things were fine. You could compare that format to what would be magazines and TV ads: the website was part of a target demographic and you could just buy time as-is. Eventually it evolved when sites got more general (say, news websites or dating websites) where a wide swath of the population could be on the same site. The idea became to target even tighter. The dating websites I used to work on had things like: age, gender, sexual orientation, interests, and so on. We could

View rebar3-exp.md

Rebar3 experience

  • Common test issues
    • Couldn't get the ct setup working as we needed. Our ct command is: ct_run -pa ./_build/default/lib/*/ebin -logdir logs -suite test/${SUITE} -cover test/antidote.coverspec
    • Option -pa is not supported for rebar3 ct
    • Because of this we needed a Makefile which called ct_run manually. Makefiles were problematic for Windows users.
  • Problems when switching branches
    • If the branch has different dependencies, the _build folder is not updated and rebar3 does not update it automatically on the next build
View gist:cf6dcf2e5001e259d89ef1d54b2af33a
binmiscctl add arm64 --interpreter "/usr/local/bin/qemu-aarch64-static" --magic "\x7f\x45\x4c\x46\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\xb7\x00" --mask "\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff" --size 20 --set-enabled
View gist:af9abf6b3600d2d7f08dba58fdfb514a
Originally from: http://erlang.org/pipermail/erlang-questions/2017-August/093170.html
For a safe and fast Erlang SSL server, there's a few
configuration values you might want by default:
[{ciphers, CipherList}, % see below
{honor_cipher_order, true}, % pick the server-defined order of ciphers
{secure_renegotiate, true}, % prevent renegotiation hijacks
{client_renegotiation, false}, % prevent clients DoSing w/ renegs
{versions, ['tlsv1.2', 'tlsv1.1']}, % add tlsv1 if you must
View gist:725e7af253cc751298b1f7b3bc109e95
1> application:set_env(tools, file_util_search_methods, bacon).
ok
2> application:ensure_all_started(tools).
{ok,[tools]}
3> application:get_all_env(tools).
[{file_util_search_methods,[{[],[]},
{"ebin","esrc"},
{"ebin","src"}]},
{included_applications,[]}]
View scanner.py
import sys
sys.path.append("./enum/enum")
from enum import Enum
import time
import datetime
import socket
import Crypto.Cipher
import signal
from binascii import hexlify
import base64
View gist:0e0ebfcf900960349c19
1> merklet_bench:main([10000, 30]).
x build-old
+ build-new
+--------------------------------------------------------------------------+
|+++++++++ x x x x xxxxxxx x xx x xx x|
|+++++ x xxxx x x x |
|+++++ x x |
|++++ x |
|++ + x |
|++ |
View pension2.erl
-module(pension2).
-export([totalBalance/1]).
%% memoization uses a process dictionary. While hackish and not portable
%% through processes, a PD of this kind has the advantage of being
%% garbage collected and being returned in a stack trace. There is also no
%% copying (see: comments over the macros) or locking needed.
-define(memoize(E), lazy_memoize(fun()-> E end)).
lazy_memoize(F) when is_function(F) ->
View hackney_issue.erl
16> hackney:get(<<"http://169.254.169.254/latest/meta-data/iam/security-credentials/">>, [], <<>>, [{connect_timeout,5000},{recv_timeout,5000}]).
{error,timeout} % <-- this is good
17> hackney:get(<<"http://169.254.169.254/latest/meta-data/iam/security-credentials/">>, [], <<>>, [{connect_timeout,5000},{recv_timeout,5000}]).
{error,closed} % <--- why is there no retry?
18> hackney:get(<<"http://169.254.169.254/latest/meta-data/iam/security-credentials/">>, [], <<>>, [{connect_timeout,5000},{recv_timeout,5000}]).
{error,closed} % <--- why is there no retry?
View run.erl
meck:new(hackney, [passthrough]),
...
{ok, _, _, Ref1} = hackney:request("facebook.com"), hackney:body(Ref1),
{ok, _, _, Ref2} = hackney:request("google.com"), hackney:body(Ref2),
...
{_, Requests} =
lists:foldl(fun({_, {hackney, request, [Url|_]}, {ok, Status, Headers, Ref}}, {RMap, BMap}) ->
{RMap#{Ref=>Url}, BMap#{Url => {Status, Headers}}}
You can’t perform that action at this time.