Skip to content

Instantly share code, notes, and snippets.

View sescobb27's full-sized avatar
🇨🇴
sisas parce

Simon Escobar Benitez sescobb27

🇨🇴
sisas parce
View GitHub Profile
@sescobb27
sescobb27 / PlayStationBIOSFilesNAEUJP.md
Created November 24, 2023 14:03 — forked from juanbrujo/PlayStationBIOSFilesNAEUJP.md
Files for PlayStation BIOS Files NA-EU-JP
@sescobb27
sescobb27 / dstore.erl
Created March 29, 2022 13:56 — forked from copenhas/dstore.erl
distributed k/v store in erlang
-module(dstore).
% internal operations
-export([init/0, loop/1, write/3]).
% public system operations
-export([start_link/0, stop/0, sync/2, replicate/1, pid/0]).
% public k/v operations
-export([lookup/1, write/2]).
-define(TIMEOUT, 30000).
@sescobb27
sescobb27 / elixir.diagnostics.markdown
Created December 6, 2019 13:53 — forked from binarytemple/elixir.diagnostics.markdown
Generate a list of all processes in the system which are neither linked nor monitored.

Inspired by Stuff Goes Bad - Erlang in Anger

Is the global process count indicative of a leak? If so, you may need to investigate unlinked processes, or peek inside supervisors’ children lists to see what may be weird-looking.

defmodule Diags do 

  @doc """
defmodule ExCluster.StateHandoff do
use GenServer
require Logger
def start_link(opts) do
GenServer.start_link(__MODULE__, opts, name: __MODULE__)
end
def child_spec(opts \\ []) do
%{
@sescobb27
sescobb27 / my_app.ex
Created February 6, 2019 18:11 — forked from alanpeabody/my_app.ex
Websockets in Elixir with Cowboy and Plug
defmodule MyApp do
use Application
def start(_type, _args) do
import Supervisor.Spec, warn: false
children = [
Plug.Adapters.Cowboy.child_spec(:http, MyApp.Router, [], [
dispatch: dispatch
])
@sescobb27
sescobb27 / libcluster_rabbit.ex
Created December 21, 2017 15:16 — forked from narrowtux/libcluster_rabbit.ex
RabbitMQ strategy for libcluster
defmodule Cluster.RabbitStrategy do
use GenServer
use Cluster.Strategy
import Cluster.Logger
alias Cluster.Strategy.State
@routing_key "cluster.heartbeat"
def start_link(opts) do
@sescobb27
sescobb27 / repo_stream.ex
Created December 21, 2017 15:16 — forked from narrowtux/repo_stream.ex
Module for Ecto and GenStage to work together when you want to use Repo.stream in conjunction with a GenStage subscriber or a Flow.
defmodule RepoStream do
defmodule Producer do
use GenStage
defstruct [:demand, :pid]
def start_link() do
GenStage.start_link(__MODULE__, self())
end
@sescobb27
sescobb27 / deploying_phoenix_on_dokku.md
Created October 7, 2016 17:00 — forked from henrik/deploying_phoenix_on_dokku.md
Deploying Elixir's Phoenix Framework on Dokku.

Deploying Phoenix on Dokku

Worked 2015-09-08 for Phoenix 1.0.1 on Dokku 0.3.25.

These instructions assume you've set up Dokku. If not, go find a tutorial for that part. My notes for setting it up on Digital Ocean.

On your local machine, in the app's repo

Create a Dokku app:

@sescobb27
sescobb27 / Model.coffee
Created September 26, 2016 15:51 — forked from GeoffreyBooth/Model.coffee
Ember.js rollback relationships, including deletions of child objects
# RollbackAttributes should also rollback relationships
# Based on http://stackoverflow.com/a/27184207/223225 and https://github.com/emberjs/rfcs/pull/21#issuecomment-135134132
DS.Model.reopen
rollbackAttributes: ->
@_super()
@rollbackRelationships()
cacheOriginalRelations: ->
@sescobb27
sescobb27 / gproc_tests.erl
Created September 25, 2016 15:18 — forked from rustyio/gproc_tests.erl
gproc_tests.erl
-module(gproc_tests).
-compile(export_all).
-include_lib("stdlib/include/qlc.hrl").
go() -> make:all([load]).
register_stuff() ->
gproc:reg({n, l, key1}, value1),
gproc:reg({n, l, key2}, value2),
gproc:reg({n, l, key3}, value3),