Skip to content

Instantly share code, notes, and snippets.

View marinakr's full-sized avatar

Maryna Shabalina marinakr

View GitHub Profile
@marinakr
marinakr / mix.ex
Last active October 11, 2021 22:11
Elixir mix file using config provider file for release
defmodule HV.MixProject do
use Mix.Project
def project do
[
app: :hello_vault,
version: "0.1.0",
elixir: "~> 1.12",
elixirc_paths: elixirc_paths(Mix.env()),
compilers: Mix.compilers(),
@marinakr
marinakr / vault_config_provider.ex
Created October 11, 2021 21:15
elixir_vault_config_provider
defmodule HV.ConfigProviders.VaultConfigProvider do
@moduledoc false
@behaviour Config.Provider
require Logger
# Let's pass the path to the JSON file as config
def init(nil), do: "/path/to/vault/token"
def init(path) when is_binary(path), do: path
@marinakr
marinakr / redis_import_csv.txt
Created September 12, 2019 11:46 — forked from arsperger/redis_import_csv.txt
import csv file into redis with a single command
cat data.csv | awk -F',' '{print " SET \""$1"\" \""$2"\" \n"}' | redis-cli --pipe
@marinakr
marinakr / redis_import_csv.txt
Created September 12, 2019 11:45 — forked from arsperger/redis_import_csv.txt
import csv file into redis with a single command
cat data.csv | awk -F',' '{print " SET \""$1"\" \""$2"\" \n"}' | redis-cli --pipe
@marinakr
marinakr / elixir-crud-protobuff.txt
Last active June 8, 2019 12:12
Elixir protobuff app
mix phx.new --umbrella --database postgres --no-webpack --no-ecto --no-html --binary-id to_do
cd apps/to_do
mix phx.gen.schema ToDo.Item items title:string description:text status:text owner:uuid
mix ecto.gen.repo -r ToDo.Repo
mix ecto.create
mix ecto.migrate
cd ../
mix new protobuf
@marinakr
marinakr / split-pem.sh
Last active June 4, 2019 15:00 — forked from gnanet/split-pem.sh
Split combined PEM file the smart way (tested on debian, requires openssl)
#!/bin/bash
CERT_NAME=cert_
META=.meta
#openssl pkcs7 -in ~/Downloads/PB2019.p7b -inform DER -print_certs -out chain.pem
if [ $1 ]
then
if [ -f $1 ]
then
alter table declarations rename to declarations_old;
/*Drop triggers*/
drop trigger on_declaration_insert ON public.declarations_old;
drop trigger on_declaration_update ON public.declarations_old;
/*Drop all indexes*/
drop index declarations_declaration_number_index;
drop index declarations_declaration_request_id_index;
drop index declarations_employee_id_status_index;
@marinakr
marinakr / Kafka SASL_PLAINTEXT auth configure
Created February 15, 2019 11:29
How to start kafka broker with sasl_plaintext auth
Support SASL_PLAIN auth for kafka broker
Kafka broker can be configure like
`/usr/local/etc/kafka/server.properties`:
```
listeners=SASL_PLAINTEXT://localhost:9093
advertised.listeners=SASL_PLAINTEXT://localhost:9093
security.inter.broker.protocol=SASL_PLAINTEXT
sasl.mechanism.inter.broker.protocol=PLAIN
@marinakr
marinakr / phoenix_to_umbrella
Last active January 25, 2019 21:11 — forked from emilsoman/phoenix_to_umbrella
How to move an existing phoenix app under an umbrella app
How to convert existing phoenix app to an umbrella app.
https://elixir-lang.slack.com/archives/phoenix/p1472921051000134
chrismccord [10:14 PM]
@alanpeabody yes, it's straightforward
[10:14]
1) mix new my_umbrella --umbrella