Skip to content

Instantly share code, notes, and snippets.

View bartekupartek's full-sized avatar

Bartłomiej Różański bartekupartek

View GitHub Profile
@ahmadshah
ahmadshah / README.md
Last active March 24, 2025 13:29
Ecto Soft Delete

Soft Delete Ecto Repo

The goal is to support soft delete functionality in Ecto.Repo. With the suggestion by @imranismail, another repo is created and the remaining functionalities are delegate to the original MyApp.Repo.

The new repo get/2 and all/1 functions will exclude the soft deleted record by default. delete/1 and delete_all/1 will update the delete_at column by default instead of deleting.

Example

MyApp.Repo.get(MyApp.User, 1) //will return nil if record is in soft delete state
@narrowtux
narrowtux / collection.ex
Last active November 15, 2016 08:04
remove and difference functions for Enum
defmodule Coll do
@doc """
Removes all values from the subject
iex> Coll.remove([1, 2, 3], [2, 3])
[1]
iex> Coll.remove([1, 2], [2, 3, 4])
[1]
"""
@tamas-molnar
tamas-molnar / kubectl-shortcuts.sh
Last active June 4, 2025 16:08
aliases and shortcuts for kubectl
alias kc='kubectl'
alias kclf='kubectl logs --tail=200 -f'
alias kcgs='kubectl get service -o wide'
alias kcgd='kubectl get deployment -o wide'
alias kcgp='kubectl get pod -o wide'
alias kcgn='kubectl get node -o wide'
alias kcdp='kubectl describe pod'
alias kcds='kubectl describe service'
alias kcdd='kubectl describe deployment'
alias kcdf='kubectl delete -f'
@hauleth
hauleth / pg_graph.sh
Created April 17, 2018 17:22
Script to generate DOT graph of dependencies between tables in PostgreSQL
#!/bin/sh
psql -qX "$@" <<EOF
\t on
\timing off
\echo 'Digraph F{'
\echo 'ranksep=1.0; size="18.5, 15.5"; rankdir=LR;'
SELECT
@talyguryn
talyguryn / wildcard-ssl-certificate.md
Last active October 29, 2023 08:57
How to get a wildcard ssl certificate and set up Nginx.

How to get and install a wildcard SSL certificate

In this guide you can find how to resolve the following issues.

Feel free to ask any questions in the comments section below.

@joelpaulkoch
joelpaulkoch / rag_time.exs
Last active June 17, 2025 09:05
A RAG for Elixir in Elixir
Mix.install(
[
{:phoenix_playground, "~> 0.1.6"},
{:phoenix, "~> 1.7.14"},
{:phoenix_live_view, "~> 1.0.0-rc.1"},
{:chroma, "~> 0.1.3"},
{:text_chunker, "~> 0.3.1"},
{:nx, "~> 0.9.0"},
{:exla, "~> 0.9.1"},
{:axon, "~> 0.7.0"},