Skip to content

Instantly share code, notes, and snippets.

@AllenDang
AllenDang / gccemacs.md
Last active July 7, 2024 09:42
Build gccemacs on MacOS catalina with gcc 10 installed by homebrew.
@naesean
naesean / jsonapi_oas.yml
Last active May 9, 2025 06:06
OpenAPI 3.0 schemas that comply with the JSON:API 1.0 specification
JSONAPIObject:
description: Includes the current JSON:API version for this specification as well as optional meta information
type: object
required:
- version
properties:
version:
type: string
default: '1.0'
example: '1.0'
@atomkirk
atomkirk / cloud-files.md
Last active April 8, 2025 12:15
Storing files on S3 with Elixir

I have this abstraction in my application code called a "CloudFile". This is where I store in the database information about files on S3 and it gives me a resource for other resources to own. For example, a user would have an avatar_cloud_file_id. On the front-end, I would load this relationship and display the avatar with user.avatar_cloud_file.download_url

defmodule RL.CloudFile do
  use Ecto.Schema
  import Ecto.Changeset

  @timestamps_opts type: :utc_datetime_usec
@zookzook
zookzook / ldif.ex
Created August 13, 2019 14:33
Parsing LDIF content file with NimbleParsec in Elixir
defmodule Ldif do
import NimbleParsec
name= ascii_string([?a..?z, ?A..?Z, ?0..?9], min: 1)
eol = ascii_char([?\n]) |> ignore()
assigment =
choice([
string("::") |> replace(:base64),
@runlevel5
runlevel5 / uber_task.ex
Created April 10, 2016 23:49
A simple Elixir Port wrapper - it is kinda half way to Porcerlain
defmodule Uber.Task do
# this module takes advantage of `Task` to wrap around
# the Port process, it does extra processing in messages
# aggregation and waiting for exit_status message.
#
# example:
# cmd = "ls /"
# Uber.Task.run_async(cmd) |> Uber.Task.get_result()
#
def run_async(cmd) do
// Restify Server CheatSheet.
// More about the API: http://mcavage.me/node-restify/#server-api
// Install restify with npm install restify
// 1.1. Creating a Server.
// http://mcavage.me/node-restify/#Creating-a-Server
var restify = require('restify');
@jordimarinvalle
jordimarinvalle / setting_up_osx_for_python_developments.md
Last active January 15, 2024 09:21
Setting Up OSX For Python Developments

Setting Up OSX For Python Developments

This gist has been created using OSX Mavericks, but it sould work with any OSX 64-bits system – Mountain Lion, Mavericks and for sure Yosemite ;) In case that you are using a OSX 32-bits system OSX Lion or Snow Leopard (OSX Leopard is not supported by XCode) just include the 32-bits System? section.

Bash profile setup

64-bits System

OS X Mountain Lion, Mavericks & Yosemite are full 64-bit systems so lets configure them to ensure that incoming user's package installations (e.g., Homebrew package installations) will be on a 64 bits system and taking precedence over OSX packaged binaries.