This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::hash::Hash; | |
use std::cmp::Eq; | |
use std::any::{Any, TypeId}; | |
use std::collections::HashMap; | |
pub struct AnyMap<K>(HashMap<(TypeId, K), Box<dyn Any>>); | |
impl<K: Hash + Eq> AnyMap<K> { | |
pub fn new() -> Self { | |
Self(HashMap::new()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"vim.insertModeKeyBindings": [ | |
{ | |
"before": ["j", "j"], | |
"after": ["<Esc>"] | |
} | |
], | |
"vim.hlsearch": true, | |
"vim.useCtrlKeys": true, | |
"vim.incsearch": true, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ab -k -c 20 -n 500000 http://localhost:8080/ | |
This is ApacheBench, Version 2.3 <$Revision: 1807734 $> | |
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ | |
Licensed to The Apache Software Foundation, http://www.apache.org/ | |
Benchmarking localhost (be patient) | |
Completed 50000 requests | |
Completed 100000 requests | |
Completed 150000 requests | |
Completed 200000 requests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
every_100 = Flow.Window.global |> Flow.Window.trigger_every(100) | |
API.container_id_stream | |
|> Stream.chunk_every(10, 10, []) | |
|> Flow.from_enumerable(min_demand: 1, max_demand: 20, stages: 4) | |
|> Flow.flat_map(fn container_ids -> | |
container_ids | |
|> API.get_containers_by_id | |
|> Enum.map(& &1.item_ids) | |
|> List.flatten |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule EOD.Packet.Client.CharacterCrudRequest do | |
use EOD.Packet do | |
code 0xFF | |
structure Character do | |
blank using: 0x00, size: [bytes: 4] | |
field :name, :c_string, size: [bytes: 24] | |
field :custom_mode, :integer, size: [bytes: 1] | |
field :eye_size, :integer, size: [bytes: 1] | |
field :lip_size, :integer, size: [bytes: 1] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
LoginPacket: | |
from: server | |
version: 1104 | |
code: 0xA7 | |
preferedProtocol: TCP | |
body: | |
- addonsAndType: | |
size: 1 | |
body: | |
- addons: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Packetx do | |
@moduledoc """ | |
Documentation for Packetx. | |
""" | |
defmacro __using__([do: block]) do | |
quote do | |
Module.register_attribute(__MODULE__, :struct_fields, accumulate: true) | |
Module.register_attribute(__MODULE__, :binary_matches, accumulate: true) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule PacketxTest do | |
use ExUnit.Case, async: true | |
doctest Packetx | |
defmodule Person do | |
use Packetx do | |
version "1.1.24-c" | |
field :age, :integer, size: [bits: 7] | |
field :gender, :integer, size: [bits: 1] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
``` | |
60 81 FE 48 A0 8F 16 49 00 FA DF 44 36 C3 09 7D 00 00 00 00 00 01 80 00 00 00 34 08 live | |
2F 72 08 95 00 08 D5 56 00 08 7E 59 0C 93 80 00 00 00 00 00 00 01 03 4C 4F 52 00 DOL | |
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
an exmaple of a gif in github comment |
NewerOlder