Skip to content

Instantly share code, notes, and snippets.

View nickva's full-sized avatar

Nick Vatamaniuc nickva

  • USA
View GitHub Profile
@zachlankton
zachlankton / CouchDB_cr_debug.md
Last active August 31, 2022 22:11
Steps to setup Emacs on Ubuntu with ErlangLS extension for CouchDB code_reload and debugging

CouchDB ErlangLS Code Reload and Debugging

This write-up details the steps required to get emacs on ubuntu 20.04 setup with the erlang_ls extension and enable code reloading and debugging.

I'm hoping these instructions should be nearly identical for setup on a Mac.

CouchDB uses long names and the erlang_ls extension defaults to using short names. There is a bug that appends a dot . to the end of the node hostname when using long names and PR to fix it is pending, until then we will need to build the erlang extension from the PR repo so that we can connect ErlangLS to node1@127.0.0.1

@garazdawi
garazdawi / gcount.erl
Created September 6, 2019 14:20
Global Counters in Erlang
-module(gcount).
-export([bench/0,bench/1]).
-export([ets_init/0,ets_new/1,ets_incr/1,ets_read/1]).
-export([cnt_init/0,cnt_new/1,cnt_incr/1,cnt_read/1]).
-export([cnt_pt_init/0,cnt_pt_new/1,cnt_pt_incr/1,cnt_pt_read/1]).
ets_init() ->
ets:new(?MODULE, [{write_concurrency,true},named_table,public]).
ets_new(Counter) ->
@garazdawi
garazdawi / bit_vector.erl
Last active June 9, 2023 17:42
A shared mutable bit-vector in Erlang
-module(bit_vector).
-export([new/1, get/2, set/2, clear/2, flip/2, print/1]).
new(Size) ->
Words = (Size + 63) div 64,
{?MODULE, Size, atomics:new(Words, [{signed, false}])}.
get({?MODULE, _Size, Aref}, Bix) ->
@amiramix
amiramix / erl_data_bench.erl
Last active August 3, 2022 13:36
Benchmark of available Erlang key-value data structures.
%% Copyright (c) 2016, Grzegorz Junka
%% All rights reserved.
%%
%% Redistribution and use in source and binary forms, with or without
%% modification, are permitted provided that the following conditions are met:
%%
%% * Redistributions of source code must retain the above copyright notice,
%% this list of conditions and the following disclaimer.
%% * Redistributions in binary form must reproduce the above copyright notice,
%% this list of conditions and the following disclaimer in the documentation
@0XDE57
0XDE57 / config.md
Last active September 13, 2024 17:30
Firefox about:config privacy settings

ABOUT

about:config settings to harden the Firefox browser. Privacy and performance enhancements.
To change these settings type 'about:config' in the url bar. Then search the setting you would like to change and modify the value. Some settings may break certain websites from functioning and rendering normally. Some settings may also make firefox unstable. I am not liable for any damages/loss of data.

Not all these changes are necessary and will be dependent upon your usage and hardware. Do some research on settings if you don't understand what they do. These settings are best combined with your standard privacy extensions (HTTPS Everywhere No longer required: Enable HTTPS-Only Mode, NoScript/Request Policy, uBlock origin, agent spoofing, Privacy Badger etc), and all plugins set to "Ask To Activate".

#!/usr/bin/env escript
%%
%%
-mode(compile).
-compile(export_all).
main([Port]) ->
{ok, _} = application:ensure_all_started(ssh),
#!/usr/bin/env escript
%! -env ERL_LIBS deps -pa deps/io_libc/ebin
-mode(compile).
main([]) ->
code:add_pathz("deps/io_libc/ebin"),
Time = {{2015,3,21},{17,30,57}},
Count = 100000,
@gdamjan
gdamjan / twitter.erl
Last active March 12, 2018 04:11
Erlang and Elixir: hackney, oauth, twitter stream
%#!/usr/bin/env escript
%% -*- erlang -*-
%%! -sasl errlog_type error
%%% Dependencies: hackney, erlang-oauth, jsx
%%% https://dev.twitter.com/docs/auth/authorizing-request
%%% https://dev.twitter.com/docs/api/1.1/post/statuses/filter
-module(twitter).
-author(gdamjan).
@tecbot
tecbot / c_test.c
Last active August 29, 2015 13:57
failing prefix test
/* Copyright (c) 2011 The LevelDB Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file. See the AUTHORS file for names of contributors. */
#include "rocksdb/c.h"
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@gburd
gburd / async_nif.h
Last active October 3, 2023 05:12
Technique for running Erlang NIFs functions asynchronously, not on scheduler threads.
/*
* async_nif: An async thread-pool layer for Erlang's NIF API
*
* Copyright (c) 2012 Basho Technologies, Inc. All Rights Reserved.
* Author: Gregory Burd <greg@basho.com> <greg@burd.me>
*
* 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:
*