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
zookeeper: # | |
image: zookeeper:3.4.9 | |
hostname: zookeeper | |
deploy: | |
resources: | |
limits: | |
cpus: '3' | |
memory: 200m | |
ports: | |
- "2181:2181" |
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
global: | |
scrape_interval: 5s | |
scrape_configs: | |
- job_name: 'kafka' | |
static_configs: | |
- targets: [ 'kafka1:9404' ] | |
- job_name: "kafka_java" | |
metrics_path: "/actuator/prometheus" | |
static_configs: |
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 cp dumpfile.sql container-name:dumpfile.sql | |
docker exec -it container-name bash | |
psql -U <username> -d <database_name> -f /dumpfile.sql |
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
Mix.install([:nimble_csv, :geo]) | |
# defmodule DefinedZones do | |
# defstruct [:country, :city, :zone, :sub_zone, :priority, :geo] | |
# end | |
defmodule Converter do | |
alias NimbleCSV.RFC4180, as: CSV | |
def run() do | |
"demo.csv" |
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
# The bash command `history | grep abc` is a neat tool. I abuse it alot. | |
# So, I wrote a module that would list or search through iex history. | |
# https://dev.to/sushant12/list-all-history-in-iex-408b | |
# I prefer to put this module in my .iex.exs file and then import the .iex.exs file into my project. | |
defmodule History do | |
def search do | |
load_history() | |
|> Enum.with_index(1) | |
|> Enum.each(fn {value, index} -> |
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
-module(palindrome). | |
-export([palindrome/1]). | |
palindrome(Xs) -> | |
Filtered = lists:filter( | |
fun(T) -> ((T >= $a) and (T =< $z)) or ((T >= $A) and (T =< $Z)) end, | |
string:to_lower(Xs) | |
), | |
Filtered == lists:reverse(Filtered). |
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
-module(nub). | |
-export([nub/1]). | |
nub([]) -> []; | |
nub(Xs) -> nub(Xs, []). | |
nub([], C) -> lists:reverse(C); | |
nub([X | Xs], C) -> | |
Ret = case lists:member(X, C) of | |
true -> C; |
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
-module(list). | |
-export([take/2]). | |
take(0, _L) -> []; | |
take(_N, []) -> []; | |
take(N, [X|Xs]) when is_integer(N) andalso N > 0 -> | |
[X | take(N-1, Xs)]. |
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
-module(assignment5). | |
-export([perimeter/1]). | |
perimeter({"square", Length}) -> | |
4 * Length; | |
perimeter({"triangle", SideA, SideB, SideC}) -> | |
SideA + SideB + SideC. |
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
-module(assignment4). | |
-export([fib/1, perfect/1]). | |
fib(N) -> fib_tail(N, 0, 1). | |
fib_tail(0, X,_Y) -> X; | |
fib_tail(N, X, Y) when N > 0 -> fib_tail(N - 1, X + Y, X). | |
perfect(N) when N > 0 -> sum_divisors(N div 2, N, 0). |
NewerOlder