Skip to content

Instantly share code, notes, and snippets.

View garretttaco's full-sized avatar

Garrett Tacoronte garretttaco

View GitHub Profile
@PJUllrich
PJUllrich / audit.ex
Created May 12, 2026 10:58
The Prompts I use for finding Vulnerabilities in Elixir/Erlang projects
defmodule MyApp.Prompts.Audit do
@moduledoc """
Prompts for the audit pipeline. Two entry points:
* `audit_file/4` — embeds a single source file in the prompt and
runs `MyApp.CodingAgent` against it. Style is `:simple` or
`:deep`; the executor picks based on `audit.strategy`.
* `audit_directory/2` — whole-package audit. Spawns the agent with
`:cwd` set to the source dir so it can use Read/Grep/Bash.
"""
@cigzigwon
cigzigwon / config.exs
Created September 16, 2022 15:45
Crawly Config for WAFs and JL File Writer
config :revo,
:user_agent,
"Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:84.0) Gecko/20100101 Firefox/84.0"
config :revo, :wait_intervals, [30_000, 45_000, 60_000, 65_000, 76_000]
config :crawly,
concurrent_requests_per_domain: 1,
closespider_timeout: 1,
manager_operations_timeout: 5 * 60_000,

Phoenix 1.4.x to 1.5.0 upgrade instructions

Phoenix 1.5 requires Elixir >= 1.7. Be sure your existing version is up to date by running elixir -v on the command line.

Install the new phx.new project generator

$ mix archive.uninstall phx_new
$ mix archive.install hex phx_new 1.5.0
@matjam
matjam / model.go
Created October 8, 2019 19:13
Example GORM model
package model
import (
"github.com/jinzhu/gorm"
_ "github.com/jinzhu/gorm/dialects/mysql"
)
// this is shared by all goroutines accessing the database. Note it is NOT
// exported as any database access code should be in this package. This creates
// clean separation of concerns.
@krystofbe
krystofbe / rename_phoenix_project.sh
Created March 8, 2019 11:46 — forked from kumekay/rename_phoenix_project.sh
rename a phoenix 1.3 project
#!/bin/bash
set -e
CURRENT_NAME="Zauberantrag"
CURRENT_OTP="zauberantrag"
NEW_NAME="Wunderantrag"
NEW_OTP="wunderantrag"
@kitten
kitten / hyper.js
Last active May 30, 2018 21:15
hyper-nightowl colours/theme
module.exports = {
config: {
/* ... */
// font family with optional fallbacks
fontFamily: '"Dank Mono", "Fira Code", monospace',
fontWeight: 'normal',
fontWeightBold: 'normal',
fontSize: 14,
@tzmartin
tzmartin / m3u8-to-mp4.md
Last active May 9, 2026 15:50
m3u8 stream to mp4 using ffmpeg

1. Copy m3u8 link

Alt text

2. Run command

echo "Enter m3u8 link:";read link;echo "Enter output filename:";read filename;ffmpeg -i "$link" -bsf:a aac_adtstoasc -vcodec copy -c copy -crf 50 $filename.mp4
yum install -y libpng
yum install -y libjpeg
yum install -y openssl
yum install -y icu
yum install -y libX11
yum install -y libXext
yum install -y libXrender
yum install -y xorg-x11-fonts-Type1
yum install -y xorg-x11-fonts-75dpi
@kipcole9
kipcole9 / Map.Helpers
Last active June 5, 2025 21:11
Helpers for Elixir Maps: underscore, atomise and stringify map keys
defmodule Map.Helpers do
@moduledoc """
Functions to transform maps
"""
@doc """
Convert map string camelCase keys to underscore_keys
"""
def underscore_keys(nil), do: nil

Falsehoods programmers believe about prices

  1. You can store a price in a floating point variable.
  2. All currencies are subdivided in 1/100th units (like US dollar/cents, euro/eurocents etc.).
  3. All currencies are subdivided in decimal units (like dinar/fils)
  4. All currencies currently in circulation are subdivided in decimal units. (to exclude shillings, pennies) (counter-example: MGA)
  5. All currencies are subdivided. (counter-examples: KRW, COP, JPY... Or subdivisions can be deprecated.)
  6. Prices can't have more precision than the smaller sub-unit of the currency. (e.g. gas prices)
  7. For any currency you can have a price of 1. (ZWL)
  8. Every country has its own currency. (EUR is the best example, but also Franc CFA, etc.)