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 ListTesting do | |
| def append([]), do: [] | |
| def append([head | tail]), do: append(head) ++ append(tail) | |
| def append(head) when is_integer(head), do: [transform(head)] | |
| def prepend_and_reverse(list), do: do_prepend(list, []) | |
| defp do_prepend([], acc), do: Enum.reverse(acc) | |
| defp do_prepend([head | tail], acc), do: do_prepend(tail, [transform(head) | acc]) | |
| defp transform(x), do: x * 2 |
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
| WITH constants AS ( | |
| -- define some constants for sizes of things | |
| -- for reference down the query and easy maintenance | |
| SELECT current_setting('block_size')::numeric AS bs, 23 AS hdr, 8 AS ma | |
| ), | |
| no_stats AS ( | |
| -- screen out table who have attributes | |
| -- which dont have stats, such as JSON | |
| SELECT table_schema, table_name, | |
| n_live_tup::numeric as est_rows, |
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
| shader_type canvas_item; | |
| const float Thickness = 0.003; | |
| float drawLine(vec2 uv,vec2 f, vec2 p1, vec2 p2) { | |
| float a = abs(distance(p1, uv.xy)); | |
| float b = abs(distance(p2, uv.xy)); | |
| float c = abs(distance(p1, p2)); |
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
| shader_type canvas_item; | |
| render_mode unshaded, blend_disabled; | |
| vec3 random3(vec3 c) { | |
| float j = 4096.0*sin(dot(c,vec3(17.0, 59.4, 15.0))); | |
| vec3 r; | |
| r.z = fract(512.0*j); | |
| j *= .125; | |
| r.x = fract(512.0*j); | |
| j *= .125; |
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
| sysctl -w fs.file-max="9999999" | |
| sysctl -w fs.nr_open="9999999" | |
| sysctl -w net.core.netdev_max_backlog="4096" | |
| sysctl -w net.core.rmem_max="16777216" | |
| sysctl -w net.core.somaxconn="65535" | |
| sysctl -w net.core.wmem_max="16777216" | |
| sysctl -w net.ipv4.ip_local_port_range="1025 65535" | |
| sysctl -w net.ipv4.tcp_fin_timeout="30" | |
| sysctl -w net.ipv4.tcp_keepalive_time="30" | |
| sysctl -w net.ipv4.tcp_max_syn_backlog="20480" |
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
| [Unit] | |
| Description=personal_website | |
| After=network.target | |
| [Service] | |
| WorkingDirectory=/home/alexandrubagu/apps/personal_website | |
| ExecStart=/home/alexandrubagu/apps/personal_website/bin/personal_website start | |
| ExecStop=/home/alexandrubagu/apps/personal_website/bin/personal_website stop | |
| Environment="PORT=7000" | |
| Environment=LANG=en_US.UTF-8 |
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
| # extract Phoenix app upstream for better readability | |
| upstream app { | |
| server localhost:5000; | |
| } | |
| # hide server information | |
| http { | |
| server_tokens off; | |
| } |
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 Mtrics do | |
| @behaviour Plug | |
| import Plug.Conn | |
| def init(opts \\ []), do: opts | |
| def call(conn, opts) do | |
| start = System.monotonic_time() | |
| register_before_send(conn, fn conn -> |