This is a fairly common question, and there isn't a One True Answer.
These are the most common techniques:
require 'digest/md5' | |
def gfm(text) | |
# Extract pre blocks | |
extractions = {} | |
text.gsub!(%r{<pre>.*?</pre>}m) do |match| | |
md5 = Digest::MD5.hexdigest(match) | |
extractions[md5] = match | |
"{gfm-extraction-#{md5}}" | |
end |
# ~/.tmux.conf | |
# | |
# See the following files: | |
# | |
# /opt/local/share/doc/tmux/t-williams.conf | |
# /opt/local/share/doc/tmux/screen-keys.conf | |
# /opt/local/share/doc/tmux/vim-keys.conf | |
# | |
# URLs to read: | |
# |
from django.contrib.sessions.backends.base import SessionBase, CreateError | |
from django.conf import settings | |
from django.utils.encoding import force_unicode | |
import redis | |
class SessionStore(SessionBase): | |
""" Redis store for sessions""" | |
def __init__(self, session_key=None): | |
self.redis = redis.Redis( |
# unregister broken GHC packages. Run this a few times to resolve dependency rot in installed packages. | |
# ghc-pkg-clean -f cabal/dev/packages*.conf also works. | |
function ghc-pkg-clean() { | |
for p in `ghc-pkg check $* 2>&1 | grep problems | awk '{print $6}' | sed -e 's/:$//'` | |
do | |
echo unregistering $p; ghc-pkg $* unregister $p | |
done | |
} | |
# remove all installed GHC/cabal packages, leaving ~/.cabal binaries and docs in place. |
class Client | |
def initialize | |
@callbacks = {} | |
set_key 'q', method(:quit) | |
end | |
def set_key(key, callback) | |
@callbacks[key] = callback | |
end |
%curl -s --user 'api:key-8av0ox9abrs2icvagny' \ | |
% https://api.mailgun.net/v2/bang.mailgun.org/messages \ | |
% -F from='Excited User <postmaster@bang.mailgun.org>' \ | |
% -F to=masquerade2ruslan@gmail.com \ | |
% -F subject='Hello' \ | |
% -F text='Testing some Mailgun awesomness!' | |
-module(mailgun). | |
-compile(export_all). |
start() -> | |
a_start(yourapp, permanent). | |
... | |
a_start(App, Type) -> | |
start_ok(App, Type, application:start(App, Type)). | |
start_ok(_App, _Type, ok) -> ok; | |
start_ok(_App, _Type, {error, {already_started, _App}}) -> ok; |
App | Description | Implementations |
---|---|---|
Dependency solver | https://github.com/erlware/relx/blob/master/src/rlx_depsolver.erl (needs to become separate app) | |
Semver parser | Strict semver 2.0.0 parser | https://github.com/nox/mouture |
Fetcher | Given URI and path, download content at URI to path (support http, git, hg, svn, ...) | |
Naive version parser | Non-semver version parser | |
Unpacker | Open tar, zip, 7z, ... | |
Index | ||
Sign/verify packages | ||
Command line parser |