Skip to content

Instantly share code, notes, and snippets.

View garretttaco's full-sized avatar

Garrett Tacoronte garretttaco

View GitHub Profile
@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 21, 2024 12:06
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 October 24, 2023 22:13
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.)
@jagregory
jagregory / gist:710671
Created November 22, 2010 21:01
How to move to a fork after cloning
So you've cloned somebody's repo from github, but now you want to fork it and contribute back. Never fear!
Technically, when you fork "origin" should be your fork and "upstream" should be the project you forked; however, if you're willing to break this convention then it's easy.
* Off the top of my head *
1. Fork their repo on Github
2. In your local, add a new remote to your fork; then fetch it, and push your changes up to it
git remote add my-fork git@github...my-fork.git