This file contains hidden or 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
%% Single-roundtrip version of epgsql:equery/3 | |
%% | |
%% It does parse-bind-execute sequence in 1 network roundtrip. | |
%% The cost is that user should manually provide the datatype information for | |
%% each bind-parameter. | |
%% Another potential problem is that connection will crash if epgsql does not | |
%% have a codec for any of result columns. Explicit type casting may save you | |
%% in this case: `SELECT my_enum::text FROM my_tab'. Or you can implement the | |
%% codec you need. | |
%% |
This file contains hidden or 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
iex(14)> defmodule T do | |
...(14)> def f(fun, arg), do: apply(String, :"#{fun}", [arg]) | |
...(14)> end |> elem(2) |> :beam_lib.chunks([:abstract_code]) |> elem(1) |> elem(1) |> get_in([:abstract_code]) |> elem(1) |> :erl_syntax.form_list |> :erl_prettypr.format |> IO.puts | |
warning: redefining module T (current version defined in memory) | |
iex:14 | |
-file("iex", 14). | |
-module('Elixir.T'). |
This file contains hidden or 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
# Description: Boxstarter Script | |
# Author: Jess Frazelle <[email protected]> | |
# Last Updated: 2017-09-11 | |
# | |
# Install boxstarter: | |
# . { iwr -useb http://boxstarter.org/bootstrapper.ps1 } | iex; get-boxstarter -Force | |
# | |
# You might need to set: Set-ExecutionPolicy RemoteSigned | |
# | |
# Run this boxstarter by calling the following from an **elevated** command-prompt: |
This file contains hidden or 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
Originally from: http://erlang.org/pipermail/erlang-questions/2017-August/093170.html | |
For a safe and fast Erlang SSL server, there's a few | |
configuration values you might want by default: | |
[{ciphers, CipherList}, % see below | |
{honor_cipher_order, true}, % pick the server-defined order of ciphers | |
{secure_renegotiate, true}, % prevent renegotiation hijacks | |
{client_renegotiation, false}, % prevent clients DoSing w/ renegs | |
{versions, ['tlsv1.2', 'tlsv1.1']}, % add tlsv1 if you must |
This file contains hidden or 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
ifeq ($(STAGE),initial) | |
.PHONY: everything | |
everything: | |
$(MAKE) STAGE=bootstrap bootstrap $(MAKECMDFLAGS) | |
$(MAKE) STAGE=execute bootstrap $(MAKECMDFLAGS) | |
$(MAKE) STAGE=execute $(MAKECMDGOALS) $(MAKECMDFLAGS) | |
$(MAKECMDGOALS): everything |
This file contains hidden or 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
SIGNATURE__API = $(shell find api -type f -name "*.yaml" | sort | bin/sign | bin/update-if-different $(SIGNATURE_DIRECTORY)/api) | |
$(MAKE_DIRECTORY)/api: $(SIGNATURE__API) bin/dsl-api | |
bin/dsl-api -strict -root api/gen.a.root.yaml | |
@touch $@ | |
api: $(MAKE_DIRECTORY)/api | |
################################################################################ |
This file contains hidden or 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
docker run \ | |
--name {{printf "%q" .Name}} \ | |
{{- with .HostConfig}} | |
{{- if .Privileged}} | |
--privileged \ | |
{{- end}} | |
{{- if .AutoRemove}} | |
--rm \ | |
{{- end}} | |
{{- if .Runtime}} |
This file contains hidden or 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
defmodule StructDefaults do | |
defmacro __using__(opts) do | |
name = case opts[:name] do | |
nil -> __CALLER__.module |> Module.split() |> List.last() | |
b when is_binary(b) -> b | |
end | |
mod = __CALLER__.module | |
quote location: :keep do | |
require StructDefaults |
This file contains hidden or 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
#unbind C-b | |
#set -g prefix C-a | |
set -g base-index 1 | |
set -g default-terminal "screen-256color" | |
set -g terminal-overrides "xterm*:kLFT5=\eOD:kRIT5=\eOC:kUP5=\eOA:kDN5=\eOB:smkx@:rmkx@:smcup@:rmcup@" | |
setw -g xterm-keys on | |
#setw -g mode-mouse on | |
#setw -g alternate-screen on |
This file contains hidden or 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
(def ^:dynamic *indent* 0) | |
(alter-var-root | |
#'clojure.core/load | |
(fn [orig] | |
(fn [& paths] | |
(let [t (System/nanoTime) | |
r (binding [*indent* (inc *indent*)] | |
(apply orig paths))] | |
(binding [*out* *err*] | |
(println (apply str (repeat *indent* " ")) (/ (- (System/nanoTime) t) 1000000.0) paths) |
NewerOlder