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 | |
mkdir -p h264 | |
for i in *.mkv ; do | |
ffmpeg -i "$i" -bsf:v h264_mp4toannexb -map 0:v -map 0:1 -map 0:a:1 -map 0:s:1 -vcodec libx264 -acodec copy -scodec copy "h264/$i" | |
done | |
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
if Code.ensure_loaded?(Postgrex.Extension) do | |
defmodule Postgrex.Box2D do | |
@moduledoc """ | |
Postgrex Extension to save and load box2d data types. | |
""" | |
alias Postgrex.Point | |
alias Postgrex.Box2D |
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/ash | |
PATH=/bin:/usr/bin | |
site=www.google.fr | |
logfile=/var/log/monitor-internet.log | |
interval=60 | |
ping_delay=5 | |
reboot_delay=600 | |
livebox_ip=192.168.1.1 | |
livebox_password=password |
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
defmodule StringUtil do | |
def raw_binary_to_string(raw) do | |
raw | |
|> String.codepoints() | |
|> Enum.reduce(fn(w, result) -> | |
if String.valid?(w) do | |
result <> w | |
else | |
<< parsed :: 8>> = w |
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
mix xref graph --sink lib/my_app_web/controllers/campaign_controller.ex | |
lib/my_app_web/views/admin/admin_campaign_log_view.ex | |
├── lib/my_app_web/router.ex (compile) | |
│ ├── lib/my_app_web/controllers/admin/admin_tag_controller.ex | |
│ │ ├── lib/my_app_web/router.ex (compile) | |
│ │ ├── lib/my_app_web/plugs/authorization.ex (compile) | |
│ │ │ └── lib/my_app_web/router.ex (compile) | |
│ │ ├── lib/my_app_web/controllers/helpers/error_helpers.ex (compile) | |
│ │ │ ├── lib/my_app_web/views/error_view.ex |
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
$> mix n_test 1 4 | |
$> mix n_test 2 4 | |
$> mix n_test 3 4 | |
$> mix n_test 4 4 |
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
version: v1.0 | |
agent: | |
machine: | |
type: e1-standard-2 | |
os_image: ubuntu1804 | |
fail_fast: | |
stop: | |
when: "true" |
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
defmodule MyApp.WaitHelper do | |
use Hound.Helpers | |
def wait_until(fun), do: wait_until(1000, fun) | |
def wait_until(0, fun), do: fun.() | |
def wait_until(timeout, fun) do | |
fun.() | |
rescue | |
Hound.NoSuchElementError -> retry(timeout, fun) |
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
defmodule MyApp.Facade do | |
defmacro facade(mod) do | |
quote bind_quoted: [mod: mod] do | |
Enum.each apply(mod, :__info__, [:functions]), fn {fun, arity} -> | |
case arity do | |
0 -> defdelegate unquote(fun)(), to: mod | |
_ -> | |
values = Enum.map(1..arity, &(Macro.var(:"arg#{&1}", mod))) | |
defdelegate unquote(fun)(unquote_splicing(values)), to: mod |