Skip to content

Instantly share code, notes, and snippets.

View fastjames's full-sized avatar

Jim Kane fastjames

View GitHub Profile
@andreaseriksson
andreaseriksson / convert_to_verified_routes.ex
Last active March 31, 2024 12:29
This is a mix task for converting old Phoenix routes to new verified routes
defmodule Mix.Tasks.ConvertToVerifiedRoutes do
@shortdoc "Fix routes"
use Mix.Task
@regex ~r/(Routes\.)(.*)_(path|url)\(.*?\)/
@web_module MyAppWeb
def run(_) do
Path.wildcard("lib/**/*.*ex")
@bluzky
bluzky / request_helper.ex
Last active July 21, 2023 05:01
Elixir download/stream large file with hackney
defmodule RequestHelper do
@moduledoc """
Reference from https://gist.github.com/avdi/7990684
Stream download large file from url
"""
require Logger
@doc """
Get stream data from url
mode could be `:binary` or `:line`
@brenogazzola
brenogazzola / migrate_im_to_vips.md
Last active March 17, 2024 21:56
Steps to migrate ImageMagick to Libvips

For apps built before the image_processing gem became the default, the migration will involve two steps:

  1. Migrating to the image processing syntax while still using ImageMagick;
  2. Switching to Vips and updating the compression options;

Migrate to the image processing syntax

Before changing from ImageMagick to Vips, it's better to first test the new syntax and ensure everything is still working.

1. Move everything that has to do with compression to a saver hash:

variant(format: :jpg, strip: true, quality: 80)
@treygriffith
treygriffith / Dockerfile
Created August 13, 2020 03:35
Dockerfile for building a release for Amazon Linux on EC2
# Building an Phoenix (Elixir) Release targeting Amazon Linux for EC2
# By https://github.com/treygriffith
# Original by the Phoenix team: https://hexdocs.pm/phoenix/releases.html#containers
#
# Note: Build context should be the application root
# Build Args:
# OTP_VERSION - the OTP version to target, like 23.0
# ELIXIR_VERSION - the Elixir version to target, like 1.10.4
#
# If you have other environment variables in config/prod.secret.exs, add them as `ARG`s in this file
@plieningerweb
plieningerweb / zenbook-ux310-ua-ubuntu-16-10.md
Last active February 3, 2021 16:00
Ubuntu 16.10 Linux on Asus ZenBook UX310UA

Ubuntu 16.10 on Asus ZenBook UX310UA

What is working:

  • Keyboard
    • Backlight control
    • Screenlight contro
    • Volumne, Display on/off, Touchbad
    • Seems like everything is working
  • Trackpad is ok
  • Wireless
@djinn
djinn / Shopify.Oauth.ex
Last active January 21, 2017 21:00
Shopify Oauth strategy for Elixir
defmodule Shopify.Oauth do
@moduledoc """
An OAuth2 strategy for Shopify.
Based on the OAuth2 strategy for GitHub by Sonny Scroggin
in https://github.com/scrogson/oauth2_example
"""
use OAuth2.Strategy
alias OAuth2.Strategy.AuthCode
alias OAuth2.Request
@wsmoak
wsmoak / LICENSE.md
Last active June 12, 2022 00:57
Spinning a servo with elixir_ale
# Install dependencies
#
# * checkinstall: package the .deb
# * libpcre3, libpcre3-dev: required for HTTP rewrite module
# * zlib1g zlib1g-dbg zlib1g-dev: required for HTTP gzip module
apt-get install checkinstall libpcre3 libpcre3-dev zlib1g zlib1g-dbg zlib1g-dev && \
mkdir -p ~/sources/ && \
# Compile against OpenSSL to enable NPN
# Paginate a collection
#
# Usage:
#
# {% paginate contents.projects by 5 %}
# {% for project in paginate.collection %}
# {{ project.name }}
# {% endfor %}
# {% endpaginate %}
#
@dfox
dfox / route53-user-policy.json
Created January 25, 2012 16:45
An IAM policy for Amazon AWS to allow limited access to Route 53
{
"Statement":[
{
"Action":[
"route53:ChangeResourceRecordSets",
"route53:GetHostedZone",
"route53:ListResourceRecordSets"
],
"Effect":"Allow",
"Resource":[