Skip to content

Instantly share code, notes, and snippets.

@kurozael
kurozael / UbuntuSwapCtrlCmdKeys.md
Created July 17, 2019 11:50
How to swap the Ctrl and Cmd keys when using Ubuntu.
@andykingking
andykingking / coin.ex
Last active October 23, 2024 19:10
Using structs with Access behaviour
# An example struct.
defmodule Coin do
# Using Kernel.put_in/3 and other methods requires the target to have the Access behaviour.
@behaviour Access
# Structs by default do not implement this. It's easy to delegate this to the Map implementation however.
defdelegate get(coin, key, default), to: Map
defdelegate fetch(coin, key), to: Map
defdelegate get_and_update(coin, key, func), to: Map
defdelegate pop(coin, key), to: Map
@dvv
dvv / justo.lua
Last active December 28, 2015 09:39
Lua perf measurement
#!/usr/bin/env le-lua-interpreter
if #arg < 1 then
-- TODO: help
os.exit(1)
end
local DEFAULT_ITERATIONS = 1e6
local bench_file = arg[1]
@dvv
dvv / .erlang
Created March 28, 2013 18:59
Erlang shortcuts
code:load_abs(os:getenv("HOME") ++ "/.ebin/user_default"),
io:format("You may use r() to recompile the code, t() to recompile templates under priv/templates.~n", []).
@dvv
dvv / peectp.erl
Created January 12, 2013 07:54
Process registrar -- gproc wrapper
%%
%% @doc Generic process registrar and operating primitives.
%% Basically, gproc wrapper.
%%
-module(peectp).
-author('Vladimir Dronnikov <[email protected]>').
%%
%% -----------------------------------------------------------------------------