Skip to content

Instantly share code, notes, and snippets.

View linjunpop's full-sized avatar
🐚
Sleeping

Jun Lin linjunpop

🐚
Sleeping
View GitHub Profile
@hansonkd
hansonkd / readme.md
Last active August 17, 2022 14:14
Redis vs HTTP benchmark

Redis vs HTTP Benchmarks

See the original blog post

Results:

Name                           ips        average  deviation         median         99th %
redix_pool                   70.44       14.20 ms    ±36.07%       13.30 ms       50.60 ms
run_redix_pipeline 30.56 32.73 ms ±65.74% 47.26 ms 91.99 ms
@kcramer
kcramer / OTPTestCodes.md
Last active January 22, 2024 11:59
OTP Test Codes

OTP Test Codes

Sample OTP QR Codes

The following sample codes are not valid for the listed services but should allow basic testing of an authenticator application. Clicking on a QR code image will display just that code so it is easier to scan without interference from the other codes.

You can use this site to generate more QR codes as needed. It will also let you verify the produced codes against its own calculated code.

@bruce
bruce / resolution.ex
Created November 4, 2016 06:38
Example resolver mapping / wrapping
defmodule Resolution do
@operations %{
organization: {Resolution.Organization, :find}
# lots of others...
}
def resolver(name) do
case @operations |> Map.get(name) do
{mod, fun} ->
@riverrun
riverrun / workout_form.ex
Created August 2, 2016 09:00
Json / map in Phoenix form
<%= form_for @changeset, @action, fn f -> %>
<%= if @changeset.action do %>
<div class="alert alert-danger">
<p>Oops, something went wrong! Please check the errors below.</p>
</div>
<% end %>
<div class="form-group">
<%= label f, :type, class: "control-label" %>
<%= select f, :type, @workout_types, prompt: "Choose workout type", class: "form-control" %>
@bitwalker
bitwalker / config.ex
Created July 19, 2016 23:00
Useful config wrapper for Elixir
defmodule Config do
@moduledoc """
This module handles fetching values from the config with some additional niceties
"""
@doc """
Fetches a value from the config, or from the environment if {:system, "VAR"}
is provided.
An optional default value can be provided if desired.

#Phoenix 1.1.x to 1.2.0 Upgrade Instructions

Project Generator

To generate new projects as 1.2.0, install the new mix archive:

mix archive.install https://github.com/phoenixframework/archives/raw/master/phoenix_new.ez

Deps

Deploying Elixir and Phoenix applications using Docker and Exrm

Goal

By the end of this quick guide, you will know how to compile a Phoenix app release using Exrm and run it inside a Docker container. I've found only a couple of articles that discuss getting an Elixir app up and running inside a Docker container, and even those only touched on some parts of the process. The idea is that this guide will give you a full end-to-end example of how to get all the pieces and parts working together so that you are able to deploy your Phoenix application inside a Docker container.

Assumptions

  1. You already have a working Elixir environment with the Phoenix Framework installed
  2. You have at least basic working knowledge of Docker, and have installed the Docker tools onto your local environment
@bastman
bastman / docker-cleanup-resources.md
Created March 31, 2016 05:55
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm

@scrogson
scrogson / README
Last active March 13, 2020 13:56 — forked from ciastek/README
Use bootstrap-sass npm package with Phoenix's brunch
1) install npm packages
2) update brunch-config.js
3) remove Bootstrap from web/static/css/app.css
4) rename web/static/css/app.css to web/static/css/app.scss
5) update web/static/css/app.scss
@erichrobinson
erichrobinson / README.md
Last active February 24, 2024 08:32
SwitchResX Configuration

#SwitchResX Settings for LG 21:9 UltraWide

SwitchResX is a utility that allows users to override the default resolution settings in OSX. For more information, including download links, vist http://www.madrau.com/ .

##Disabling System Integrity Protection (SIP)

If you are running OSX 10.11 or higher, SIP must be disabled. To disable SIP do the following:

  • Boot into the recovery partition by pressing CMD + R when starting up your Mac.
  • Once in recovery mode, open a terminal window.
  • Type the command csrutil disable