Skip to content

Instantly share code, notes, and snippets.

@eproxus
eproxus / ._Extending the Erlang Shell.md
Last active February 2, 2023 12:22
Extending the Erlang Shell
View ._Extending the Erlang Shell.md

Extending the Erlang Shell

Erlang makes it possible to extend the Erlang shell with your own built-in functions using the special module user_default. We can use this to add functions to the shell, and even add custom libraries to the code path for all Erlang shells.

How To Setup

  1. Start by creating a file called .erlang in your home directory. Any Erlang expression ending with a dot in this file will be executed when the Erlang shell starts
  2. Create the directory ~/.erlang.d:
    $ mkdir ~/.erlang.d
@eproxus
eproxus / _OP-Z_Automated_Backup_on_macOS.md
Created April 11, 2022 09:44
OP-Z Automated Backup on macOS
View _OP-Z_Automated_Backup_on_macOS.md

OP-Z Automated Backup for macOS

Setup

  1. Store backup.sh somewhere and make it executable:
    $ vim ~/Music/OP-Z/Backups/Support/backup.sh
    (The file opz_backup.sh is only needed as a convenience shortut to manually run the backup)
@eproxus
eproxus / README.md
Last active February 20, 2022 10:21
Hide Firefox Tab Bar on Windows
View README.md
  1. Go to MenuHelpMore troubleshooting informationApplication BasicsProfile FolderOpen Folder
  2. Create a folder named chrome
  3. Create a new text file inside chrome named userChrome.css and paste the content
  4. Go to about:config in Firefox
  5. Change the setting toolkit.legacyUserProfileCustomizations.stylesheets to true
  6. Restart Firefox
@eproxus
eproxus / 01 Erlang GitHub Actions With setup-beam and Caching.md
Last active December 24, 2022 22:19
How to Setup Erlang GitHub Actions With setup-beam and Caching
View 01 Erlang GitHub Actions With setup-beam and Caching.md

Erlang GitHub Actions With setup-beam and Caching

To build and test Erlang projects on GitHub actions with Rebar 3 it is fastest to use the setup-beam action and use caching.

To get started, create a workflow file in .github/workflows in your repository. For this example we use a file called .github/workflows/continuous_integration.yml.

@eproxus
eproxus / COWBOY_STREAM_HANDLER.md
Last active September 12, 2022 09:34
How to Create a Cowboy Stream Handler
View COWBOY_STREAM_HANDLER.md

How to Create a Cowboy Stream Handler

Add your stream handler to the list of stream handlers in the protocol options:

{ok, Pid} = cowboy:start_clear(ListenerName,
    [{port, Port}],
    #{
        env => #{dispatch => Dispatch},
 stream_handlers => [my_stream_h, cowboy_compress_h, cowboy_stream_h]
@eproxus
eproxus / COWBOY_MIDDLEWARE.md
Last active December 31, 2021 22:16
How to Create a Cowboy Middleware
View COWBOY_MIDDLEWARE.md

How to Create a Cowboy Middleware

⚠️
Middlewares are "deprecated" because stream handlers can do everything middlewares can do and more. Consider using a stream handler instead.

Add an entry to the middlewares. Usually you want to keep the standard Cowboy handlers afterwards, but you can replace them if you want.

@eproxus
eproxus / new_gen_event.erl
Last active November 13, 2019 15:30
Erlang Behaviour Templates
View new_gen_event.erl
-module().
-behavior(gen_event).
% Callbacks
-export([init/1]).
-export([handle_event/2]).
-export([handle_call/2]).
-export([handle_info/2]).
-export([terminate/2]).
View loadorder.zsh
# Load Order Interactive Interactive Script
# Startup Only login Always
# ------------- ----------- ----------- ------
# /etc/zshenv 1 1 1
# ~/.zshenv 2 2 2
# /etc/zprofile 3
# ~/.zprofile 4
# /etc/zshrc 5 3
# ~/.zshrc 6 4
# /etc/zlogin 7
View skeleton_gen_server.erl
-module().
-behavior(gen_server).
% API
-export([start_link/0]).
% Callbacks
-export([init/1]).
-export([handle_call/3]).
@eproxus
eproxus / sVimcss.css
Last active November 25, 2018 16:57
sVim Settings with Vimium Hint Styles
View sVimcss.css
@-webkit-keyframes fadein {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
#sVim-command {