Skip to content

Instantly share code, notes, and snippets.

View hailelagi's full-sized avatar
Caffeinated

Haile hailelagi

Caffeinated
View GitHub Profile
@hailelagi
hailelagi / binary.rs
Created October 5, 2022 11:26
how to serialise a Vec<u8> into an elixir/erlang binary <<u8>>
use rustler::{Decoder, Encoder};
#[derive(Clone, Debug, Default, PartialEq, Eq)]
pub struct Bin(Vec<u8>);
impl Bin {
pub fn new<T: Into<Vec<u8>>>(bin: T) -> Self {
Self(bin.into())
}

Recon and Attack Vectors from My Logs

This document contains excerpts from my web server logs collected over a period of 7 years that shows various kinds of recon and attack vectors.

There were a total of 37.2 million lines of logs out of which 1.1 million unique HTTP requests (Method + URI) were found.

$ sed 's/^.* - - \[.*\] "\(.*\) HTTP\/.*" .*/\1/' access.log &gt; requests.txt
@hailelagi
hailelagi / gist:1364949d96893a1173da762ee494d651
Created June 2, 2022 11:34
asdf not reshiming quick fix
rm -rf ~/.asdf/shims; asdf reshim
@hailelagi
hailelagi / miscellaneous
Last active July 22, 2022 14:14
miscellaneous config settings
# Ignore VS Code and intelliJ settlings
.elixir_ls
.DS_Store
.idea
# Ignore asdf and secrets
.tools-version
.env*
# Other read lists
teachyourselfcs.com
https://www.programmingbooks.dev/#learn-to-program
# Dated but excellent intro to concurrency and distributed systems overview
https://berb.github.io/diploma-thesis/original/0_preface.html
# C++ (concurrency)
https://livebook.manning.com/book/c-plus-plus-concurrency-in-action/
# What's a query engine?
@hailelagi
hailelagi / session.sh
Last active April 23, 2022 23:39
Enter an IEx session via a docker container
docker exec -it $CONTAINER_NAME /bin/bash
iex --sname console --cookie mycookie --remsh $NAME@CONTAINER_ID
@hailelagi
hailelagi / kmp.ex
Last active April 23, 2022 23:26
Knutt-Morris-Prath alternative
# naive implementation of sub string search
defmodule Solution do
@spec str_str(haystack :: String.t, needle :: String.t) :: integer
def str_str(haystack, needle) do
if String.length(haystack) <= 1 do
0
else
original_needle = String.to_charlist(needle)
original_hay = String.to_charlist(haystack)
disable:
defaults -currentHost write -g AppleFontSmoothing -int 0
enable:
defaults -currentHost delete -g AppleFontSmoothing
# Print the current call stack
# see: https://hexdocs.pm/elixir/1.13/Process.html
Process.info(self(), :current_stacktrace)
@hailelagi
hailelagi / stuff.md
Created January 11, 2022 19:09
stuff I should learn waayyy more than I currently do about.