This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-module(expr). | |
-export([ | |
parse/1, | |
test/0 | |
]). | |
% ------------------------------------------------------ | |
% | |
% Simple math-expressions parser |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Enable repeat on keydown | |
defaults write -g ApplePressAndHoldEnabled -bool false | |
#Use current directory as default search scope in Finder | |
defaults write com.apple.finder FXDefaultSearchScope -string "SCcf" | |
#Show Path bar in Finder | |
defaults write com.apple.finder ShowPathbar -bool true | |
#Show Status bar in Finder |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env escript | |
main([BeamFile]) -> | |
{ok, {_, [{abstract_code, {_, AC}}]}} = beam_lib:chunks(BeamFile, [abstract_code]), | |
io:fwrite("~s~n", [erl_prettypr:format(erl_syntax:form_list(AC))]). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function mkcd | |
mkdir $argv; and cd $argv | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Diff | |
def initialize(a, b) | |
@a, @b = a, b | |
end | |
def left | |
diff(@a, @b) | |
end | |
def right |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module IdentifiedCollection | |
module ClassMethods | |
attr_reader :objects | |
def identify_by(identity) | |
@objects = Hash.new | |
@identity = identity | |
end | |
def identity |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function ram | |
set -l sum 0 | |
set -l app $argv[1] | |
if [ -z $app ] | |
echo "First argument - pattern to grep from processes" | |
else | |
for i in (ps aux | grep -i "$app" | grep -v "grep" | awk '{print $6}') | |
set sum (math $sum + $i) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
APP=<application_name> | |
USER=user | |
ROOT=/home/$USER/apps/$APP/_rel/$APP | |
export HOME=/home/$USER | |
exec 2>&1 | |
exec chpst -u $USER $ROOT/bin/$APP foreground |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lager:debug("throughput ~p num/s", [length(State)]). | |
% transforms to | |
case {whereis(lager_event), whereis(lager_event), lager_config:get({lager_event, loglevel}, {0, []})} of | |
{undefined, undefined, _} -> | |
fun () -> {error, lager_not_running} end(); | |
{undefined, _, _} -> | |
fun () -> {error, {sink_not_configured, lager_event}} end(); | |
{__Pidfb_throughput43, _, {__Levelfb_throughput43, __Tracesfb_throughput43}} when __Levelfb_throughput43 band 128 /= 0 orelse __Tracesfb_throughput43 /= [] -> | |
lager:do_log(debug, [{application, fb}, {module, fb_throughput}, {function, handle_info}, {line, 43}, {pid, pid_to_list(self())}, {node, node()} | lager:md()], "throughput ~p num/s", [length(State)], 4096, 128, __Levelfb_throughput43, __Tracesfb_throughput43, lager_event, __Pidfb_throughput43); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# string merging | |
"asd" "qwe" "zxc" | |
# => "asdqwezxc" | |
# separators may be a space | |
% sometext .size | |
# => 8 |
OlderNewer