Skip to content

Instantly share code, notes, and snippets.

@bjorng
bjorng / otp-asm-diff
Created April 25, 2017 10:36
Compare two directories of .S files, producing a summary of the change of function sizes
#!/usr/bin/env escript
%% -*- erlang -*-
-mode(compile).
-import(lists, [foreach/2]).
main([Old,New]) ->
Wc = filename:join(Old, "*.S"),
Files0 = filelib:wildcard(Wc),
Files = [filename:basename(F) || F <- Files0],
F = fun(Name) ->
@bjorng
bjorng / otp-diffable-asm
Last active August 31, 2017 05:31
Compile some OTP applications into a diff-friendly assembly format
#!/usr/bin/env escript
%% -*- erlang -*-
-mode(compile).
main(Args) ->
case Args of
[] ->
do_compile("asm");
[OutDir] ->
do_compile(OutDir);
-module(string_eqc).
-compile([export_all,nowarn_export_all]).
-include_lib("eqc/include/eqc.hrl").
%%%
%%% Test most new functions in the new string module (PR #1330).
%%%
flat_chardata() ->
colorBlur(#we{es=Etab}=We) ->
L0 = array:sparse_foldl(
fun(E, #edge{vs=Va,ve=Vb}, A) ->
Left0 = wings_va:edge_attrs(E, left, We),
Right0 = wings_va:edge_attrs(E, right, We),
Left = def_color(wings_va:attr(color, Left0)),
Right = def_color(wings_va:attr(color, Right0)),
[{Va,Left},{Va,Right},{Vb,Left},{Vb,Right}|A]
end, [], Etab),
[{V,Color}|L] = lists:sort(L0),
#!/bin/sh
#
# Suggested name for this script: git-clean-stale-branches
#
# This script will help to remove "stale" branches from a remote
# repository (by default the "origin" repository). Stale branches
# are any branches that does not exist in the local repository.
#
# This script should be run in the local repository. It will print
# out a git command to remove all branches from the remote repository
#!/bin/sh
git filter-branch --env-filter '
an="$GIT_AUTHOR_NAME"
am="$GIT_AUTHOR_EMAIL"
cn="$GIT_COMMITTER_NAME"
cm="$GIT_COMMITTER_EMAIL"
if [ "$GIT_AUTHOR_EMAIL" = "[email protected]" ]