Skip to content

Instantly share code, notes, and snippets.

@alfonsodev
alfonsodev / install-ffmpeg-amazon-linux.sh
Last active November 14, 2017 08:00 — forked from gboudreau/install-ffmpeg-amazon-linux.sh
How to compile ffmpeg on Amazon Linux (EC2)
#!/bin/sh
# Based on gist.github.com/gboudreau/install-ffmpeg-amazon-linux.sh
# and https://trac.ffmpeg.org/wiki/CompilationGuide/Centos
if [ "`/usr/bin/whoami`" != "root" ]; then
echo "You need to execute this script as root."
exit 1
fi
cat > /etc/yum.repos.d/centos.repo<<EOF
@rlipscombe
rlipscombe / initial_calls.erl
Last active March 25, 2017 00:54
Finding leaked processes in Erlang
lists:sort(fun({_, X}, {_, Y}) -> X > Y end,
dict:to_list(lists:foldl(
fun(Pid, Dict) ->
InitialCall = case erlang:process_info(Pid, initial_call) of
{initial_call,{proc_lib,init_p,A}} ->
case erlang:process_info(Pid, dictionary) of
{dictionary, D} -> proplists:get_value('$initial_call', D, undefined);
_ -> {proc_lib,init_p,A}
end;
{initial_call,{erlang,apply,A}} ->
@pnc
pnc / observer.md
Last active September 9, 2023 23:32
Using Erlang observer/appmon remotely

Using OTP's observer (appmon replacement) remotely

$ ssh remote-host "epmd -names"
epmd: up and running on port 4369 with data:
name some_node at port 58769

Note the running on port for epmd itself and the port of the node you're interested in debugging. Reconnect to the remote host with these ports forwarded:

$ ssh -L 4369:localhost:4369 -L 58769:localhost:58769 remote-host
@nozma
nozma / EmacsMode.bas
Created May 5, 2012 15:51
Emacs like key bindings for Microsoft Excel
'' define EmacsMode key bindings
Sub EmacsMode()
With Application
.OnKey "^{f}", "ForwardCell"
.OnKey "^{b}", "BackwardCell"
.OnKey "^{p}", "PreviousLine"
.OnKey "^{n}", "NextLine"
.OnKey "^{a}", "BeginningOfUsedRangeLine"
.OnKey "^{e}", "EndOfUsedRangeLine"
.OnKey "%{<}", "BeginningOfUsedRangeRow"
@crofty
crofty / index.html
Last active October 22, 2021 08:24
A example of using Google Map tiles with the Leaflet mapping library - http://matchingnotes.com/using-google-map-tiles-with-leaflet
<!DOCTYPE html>
<html>
<head>
<title>Leaflet</title>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.3.1/leaflet.css" />
<script src="http://cdn.leafletjs.com/leaflet-0.3.1/leaflet.js"></script>
<script src="http://maps.google.com/maps/api/js?v=3.2&sensor=false"></script>
<script src="http://matchingnotes.com/javascripts/leaflet-google.js"></script>
</head>
<body>
@carlosbrando
carlosbrando / gist:995982
Created May 27, 2011 19:38
Erlang Base64
-module (base64ex).
-export ([urlsafe_decode64/1, urlsafe_encode64/1]).
urlsafe_decode64(Str) ->
Str2 = re:replace(Str, "-", "+", [global, {return,list}]),
Str3 = re:replace(Str2, "_", "/", [global, {return,list}]),
base64:decode(Str3).
urlsafe_encode64(Bin) ->