Skip to content

Instantly share code, notes, and snippets.

View humberaquino's full-sized avatar

Humberto Aquino humberaquino

View GitHub Profile
@axelbdt
axelbdt / install_asdf_with_nix.md
Created April 11, 2023 14:10
How to Install asdf with Nix Home-manager

How to Install asdf with Nix Home-manager

  1. First, add asdf to the Nix configuration with the package named asdf-vm. Add the following line to your configuration.nix file:

    environment.systemPackages = with pkgs; [
      asdf-vm
    ];
@PJUllrich
PJUllrich / big-o.md
Last active March 18, 2024 14:44
Big-O Time Complexities for Elixir Data Structures

Big-O Time Complexities for Elixir data structures

Map [1]

Operation Time Complexity
Access O(log n)
Search O(log n)
Insertion O(n) for <= 32 elements, O(log n) for > 32 elements [2]
Deletion O(n) for <= 32 elements, O(log n) for > 32 elements
@phuochau
phuochau / create_dynamic_func.ex
Created September 11, 2020 07:16
Create dynamic function with Elixir Macro
defmodule MyMacro do
defmacro create_some_function_by_number(name, num, do: block) do
params =
for n <- 1..num do
{"id#{n}", Macro.var(:"id#{n}", nil)}
end
# We can't call Macro.escape because it is for escaping values.
# In this case, we have a mixture of values "id#{n}" and
# expressions "Macro.var(...)", so we build the map AST by hand.

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
@chrismccord
chrismccord / phx-1.4-upgrade.md
Last active June 16, 2023 06:22
Phoenix 1.3.x to 1.4.0 Upgrade Guides

Phoenix 1.4 ships with exciting new features, most notably with HTTP2 support, improved development experience with faster compile times, new error pages, and local SSL certificate generation. Additionally, our channel layer internals receiveced an overhaul, provided better structure and extensibility. We also shipped a new and improved Presence javascript API, as well as Elixir formatter integration for our routing and test DSLs.

This release requires few user-facing changes and should be a fast upgrade for those on Phoenix 1.3.x.

Install the new phx.new project generator

The mix phx.new archive can now be installed via hex, for a simpler, versioned installation experience.

To grab the new archive, simply run:

@DanielStormApps
DanielStormApps / EmailValidator.swift
Last active March 16, 2021 14:22 — forked from darthpelo/EmailValidator.swift
This regular expression is adapted from a version at regular-expressions.info and is a complete verification of RFC 2822. Source: http://www.cocoawithlove.com/2009/06/verifying-that-string-is-email-address.html. Dedicate article: https://medium.com/@darthpelo/email-validation-in-swift-3-0-acfebe4d879a
extension String {
/// Checks if the `String` is a valid email address.
/// ````
/// // Example
/// "name@email.com".isValidEmailAddress() // true
/// "name(at)email(dot)com".isValidEmailAddress() // false
/// "name@email".isValidEmailAddress() // false
/// "name@.com".isValidEmailAddress() // false
/// "name.com".isValidEmailAddress() // false
@miguelmota
miguelmota / wasm_tools_install.sh
Created August 28, 2018 20:55
macOS install WebAssembly (WASM) tools (wasm-objdump)
git clone --recursive https://github.com/WebAssembly/wabt
cd wabt
make
make clang-debug
make gcc-i686-release
make clang-debug-lsan
make gcc-debug-no-re2c
chmod +x bin/
@cablespaghetti
cablespaghetti / ecr-cred-updater.sh
Last active November 18, 2023 09:16
Automatic Updating Amazon ECR Credentials in Kubernetes
#!/bin/bash
# Get directory of script
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
if [[ $# -ne 1 ]]
then
echo "ERROR: This script expects the namespace name to be given as an argument"
echo "e.g. ./ecr-cred-updater.sh my-namespace"
exit 1
@uraimo
uraimo / dnsovertls.md
Last active March 22, 2024 20:55
Configure your Mac to use DNS over TLS
@jarun
jarun / disassemble.md
Last active April 20, 2024 05:14
Guide to disassemble

prerequisites

  • Compile the program in gcc with debug symbols enabled (-g)
  • Do NOT strip the binary
  • To generate assembly code using gcc use the -S option: gcc -S hello.c

utilities

objdump