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 Mix.Tasks.NTest do | |
use Mix.Task | |
@wildcard "apps/*/test/**/*_test.exs" | |
def run([i, n | args]) do | |
{i, _} = Integer.parse(i) | |
{n, _} = Integer.parse(n) | |
test_paths = |
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
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
defmodule Mix.Tasks.PhenixPlayer.Firmware.Reload do | |
use Mix.Task | |
alias IEx.Helpers | |
alias PhenixPlayer.MixProject | |
@app_name Mix.Project.config()[:app] | |
def run(_) do | |
node = :"#{@app_name}@#{System.get_env("MDNS_DOMAIN")}.local" |
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 MasterProxy.Application do | |
alias MyApp.Endpoint, as: MyAppEndpoint | |
alias MyApp.UserSocket, as: MyAppUserSocket | |
alias MyOtherApp.Endpoint, as: MyOtherAppEndpoint | |
alias MyOtherApp.UserSocket, as: MyOtherAppUserSocket | |
alias Phoenix.LiveReloader.Socket, as: LiveReloadSocket | |
alias Plug.Cowboy | |
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 |
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
#!/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
#!/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 | |