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).
defmodule CustomUploadS3 do
@moduledoc """
Represents an AWS S3 Multipart Upload operation
## Examples
```
"path/to/big/file"
|> S3.Upload.stream_file
|> S3.upload("my-bucket", "path/on/s3")
|> CustomUploadS3.to_custom_upload_s3()
|> ExAws.request!() #=> :done
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>Document</title>
</head>
<body>
<input type="file" id="input" onchange="handle_csv(this.files)" />
defmodule PortRunner do
use GenServer, restart: :temporary
defmodule State do
defstruct [:command, :exit_status, :port, arguments: []]
end
@spec start_link(State.t() | map() | keyword()) :: GenServer.on_start()
def start_link(args) do
GenServer.start_link(__MODULE__, args)
@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 """
fun =
Gobgpapi.StartBgpRequest
|> to_string()
|> String.split(".")
|> List.last()
|> String.replace("Request", "")
|> Macro.underscore()
|> String.to_atom()
apply(MyModule, fun, args)
defmodule MonitorsDB do
@spec new_db() :: :ets.tid()
def new_db() do
random_string()
|> new_db()
end
@spec new_db(String.t()) :: :ets.tid()
def new_db(name) do
name
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
%{
defmodule RestartServer do
use GenServer
def start_link(args) do
GenServer.start_link(__MODULE__, args, [name: __MODULE__])
end
def init(_) do
IO.puts("RESTARTING")
num = Enum.random(1..1_000_000)