Skip to content

Instantly share code, notes, and snippets.

View marka2g's full-sized avatar
🎯
Focusing

Mark Sadegi marka2g

🎯
Focusing
View GitHub Profile
@PJUllrich
PJUllrich / worker.ex
Created July 22, 2023 12:06
Attack Library Worker
defmodule Attack.Worker do
use GenServer
require Logger
def start_link(init_args) do
GenServer.start_link(__MODULE__, [init_args])
end
def init(_args) do
defmodule SchemaChecker do
def find_field_discrepancies do
schema_modules()
|> Enum.map(fn mod ->
{mod.__schema__(:source), check_module(mod)}
end)
end
defp schema_modules do
{:ok, modules} = :application.get_key(:core, :modules)
@timohuovinen
timohuovinen / install-kvm-windows-linux.md
Last active April 28, 2025 18:20
Windows 10 guest virtual machine on linux mint 21 host using KVM and QEMU
@kofiasare
kofiasare / .env
Last active April 17, 2024 13:58
Phoenix with docker compose
PGHOST=db
PGUSER=postgres
PGPASSWORD=postgres
PGDATABASE=hello_dev
PGPORT=5432
%{
configs: [
%{
name: "default",
files: %{
included: ~w{config lib test}
},
strict: true,
color: true,
checks: [
@marka2g
marka2g / encrypt_decrypt.rb
Created October 23, 2021 01:12 — forked from wteuber/encrypt_decrypt.rb
Simply encrypt and decrypt Strings in Ruby.
require 'openssl'
class String
def encrypt(key)
cipher = OpenSSL::Cipher.new('DES-EDE3-CBC').encrypt
cipher.key = Digest::SHA1.hexdigest key
s = cipher.update(self) + cipher.final
s.unpack('H*')[0].upcase
end
@toranb
toranb / leex_to_heex.ex
Last active July 27, 2022 21:56
inline conditional css comparison of leex and heex
##### phx live view 0.16 with leex
def render(assigns) do
~L"""
<button class="<%= if @foo && @bar && @baz do %>text-blue-600<% else %>text-red-600<% end %>">hello</button>
"""
end
##### phx live view 0.16 with heex -inline edition
@phortuin
phortuin / postgres.md
Last active March 9, 2025 22:22
Set up postgres + database on MacOS (M1)

Based on this blogpost.

Install with Homebrew:

$ brew install postgresql@14

(The version number 14 needs to be explicitly stated. The @ mark designates a version number is specified. If you need an older version of postgres, use postgresql@13, for example.)

@theguuholi
theguuholi / Kafka-compose.yml
Last active March 6, 2024 12:19
Kafka-compose
`version: '3'
services:
zookeeper:
image: confluentinc/cp-zookeeper:latest
container_name: zookeeper
ports:
- "2181:2181"
environment:
ZOOKEEPER_CLIENT_PORT: 2181
ZOOKEEPER_TICK_TIME: 2000
@LukeMathWalker
LukeMathWalker / config.yml
Last active June 29, 2024 12:20
CircleCI - Rust setup
version: 2
jobs:
build-and-test:
docker:
- image: cimg/rust:1.69
environment:
# Fail the build if there are warnings
RUSTFLAGS: '-D warnings'
steps:
- checkout