Skip to content

Instantly share code, notes, and snippets.

@hcs42
hcs42 / gist:ce008b393e827c87e16b
Created September 25, 2014 12:00
Make <c-w><c-]> work with vim-erlang-tags
function! VimErlangTagsSelectSplit()
split
let orig_isk = &isk
set isk+=:
normal "_vawo
if getline('.')[col('.') - 2] =~# '[#?]'
normal h
endif
let &isk = orig_isk
endfunction
@hcs42
hcs42 / docker_notes
Created November 27, 2014 18:09
Docker notes
Container states
non-existant
running
stopped
paused
Image info
docker images # list images
Image operations
@hcs42
hcs42 / connect2beam
Last active May 26, 2021 15:50
connect2beam: a script that finds Erlang nodes and connect to them
#!/usr/bin/python
# connect2beam is a script that finds Erlang nodes and connects to them or
# kills them.
#
# Example for connection:
#
# $ connect2beam
# Available nodes: index name (cookie, pid)
#
@hcs42
hcs42 / test_term
Created May 5, 2015 11:28
test_term: a script that checks if a file contains only valid Erlang terms.
#!/usr/bin/env escript
% test_term is a script that checks if a file contains only valid Erlang terms.
%
% Example:
%
% $ echo '{1,2}.' > f
% $ test_term f
% f:The file contains 1 valid Erlang term.
%
@hcs42
hcs42 / remove_nbsp
Last active August 29, 2015 14:20
remove_nbsp: script that replaces non-breaking space charaters
#!/usr/bin/env python3
# This script replaces each non-breaking space charaters with a space character
# in the given files.
#
# Usage: remove_nbsp <files>
#
# Examples:
#
# Replace NBSPs in two files:
@hcs42
hcs42 / print_erl_string
Created June 17, 2015 11:43
print_erl_string: a script that reads a text, collects the numbers between 32 and 128, and prints the corresponding ASCII characters.
#!/usr/bin/env python3
# print_erl_string is a script that reads a text, collects the numbers between
# 32 and 128, and prints the corresponding ASCII characters.
#
# Example:
#
# $ cat myfile
# [0,116,104,105,115,32,105,115,32,97,32,116,101,120,116,32,116,104,97,116,
# 32,105,115,32,110,111,116,32,102,111,114,109,97,116,116,101,100,32,97,
@hcs42
hcs42 / erlang_notes
Last active August 23, 2019 14:54
Erlang notes
Loading modules
---------------
Purging = removing the old version of the module (so that it will only have a new
version).
erlang:check_old_code(mymodule).
Return if the module has an old version loaded.
code:load_file(mymodule).
code:load_abs("/home/me/mymodule"). % no ".beam"
@hcs42
hcs42 / rpc
Created July 8, 2016 15:19
A script to evaluate an expression on an Erlang node
#!/usr/bin/env escript
%%! -name [email protected]
%% rpc is a script that connects to the given Erlang node using RPC and
%% evaluates an expression in it.
%%
%% Examples:
%%
%% rpc [email protected] mycookie 'erlang:whereis(init)'
%% rpc [email protected] mycookie erlang whereis '[init]'
@hcs42
hcs42 / FindInBuffers.vim
Created October 12, 2016 15:47
FindInBuffers
" Usage:
"
" :FindInBuffers "regex"
" Buffer index, buffer name
" 0 file1
" 7 file2
command! -nargs=1 FindInBuffers call FindInBuffers(<args>)
function! FindInBuffers(pattern)
let last = bufnr('$')
@hcs42
hcs42 / cursor_insight_cla.txt
Created February 27, 2018 09:36
Cursor Insight Individual Contributor License Agreement
### Cursor Insight Individual Contributor License Agreement
Thank you for your interest in contributing to open source software
projects ("Projects") made available by Cursor Insight Ltd. or its
affiliates ("Cursor Insight"). This Individual Contributor License
Agreement ("Agreement") sets out the terms governing any source code,
object code, bug fixes, configuration changes, tools, specifications,
documentation, data, materials, feedback, information or other works of
authorship that you submit or have submitted, in any form and in any
manner, to Cursor Insight in respect of any of the Projects