Skip to content

Instantly share code, notes, and snippets.

View mikalv's full-sized avatar

Mikal mikalv

View GitHub Profile
@mikalv
mikalv / pkcs11-tls-proxy.go
Created January 27, 2022 13:39 — forked from korc/pkcs11-tls-proxy.go
PKCS11-authenticated TLS socket proxy
package main
import (
"crypto/tls"
"flag"
"fmt"
"io"
"log"
"net"
"net/textproto"
@mikalv
mikalv / grafana_dashboard.json
Created January 23, 2022 01:18 — forked from skosch/grafana_dashboard.json
Very simple Grafana dashboard for Prometheus Elixir metrics
{
"__inputs": [
{
"name": "DS_PROMETHEUS",
"label": "Prometheus",
"description": "",
"type": "datasource",
"pluginId": "prometheus",
"pluginName": "Prometheus"
}
@mikalv
mikalv / box.ex
Created December 18, 2021 22:46 — forked from teamon/box.ex
Define elixir structs with typespec with single line of code
defmodule Box do
defmacro __using__(_env) do
quote do
import Box
end
end
@doc """
Define module with struct and typespec, in single line
@mikalv
mikalv / musl-bootstrap.sh
Created December 15, 2021 19:14
musl-bootstrap.sh
#!/bin/bash
# This script builds a (hopefully) working gcc based cross compiler
# Update to latest stable release
BINUTILS_VERSION=2.27
GMP_VERSION=6.1.2
MPFR_VERSION=3.1.5
MPC_VERSION=1.0.3
ISL_VERSION=0.16.1
GCC_VERSION=6.3.0
@mikalv
mikalv / .vpn_helpers.sh
Created December 14, 2021 00:54 — forked from rfairburn/.vpn_helpers.sh
Mac OS X command-line VPN Helpers
#!/bin/bash
# Source this file in your .bash_profile e.g.:
#
# source ~/gitcheckouts/vpn_heplers/.vpn_helpers.sh
#
# Note: This script works best with NOPASSWD: ALL configured in your sudoers file:
# /etc/sudoers:
# %admin ALL=(ALL) NOPASSWD: ALL
#
@mikalv
mikalv / reference.txt
Created December 4, 2021 14:28 — forked from hartescout/reference.txt
macOS Internals, Reversing, and Analysis reference I've found essential.
## In no particular order. I'm pulling these from a bookmark folder, I'll work on labeling as I have time. Hope these help. Will be mixing in Linux reference as well.
Sidenote: the macOS Internals series is amazing, although might be out of reach for some. However if having a hard time deciding (I definitely way) and in budget, In my opinion, they are worth the price. I've worked through Volume II, waiting on Volume III.
As always, most of what we need in our world can be found open sourced and provided by some of the brightest, but it can be a frustrating journey finding material.
https://www.intezer.com/blog/malware-analysis/elf-malware-analysis-101-linux-threats-no-longer-an-afterthought/
http://timetobleed.com/dynamic-linking-elf-vs-mach-o/
https://github.com/apple/darwin-xnu
https://opensource.apple.com/source/xnu/
https://developer.apple.com/library/archive/documentation/Darwin/Conceptual/KernelProgramming/Architecture/Architecture.html
@mikalv
mikalv / ToastNotification_Windows10.ps1
Created December 3, 2021 13:14 — forked from altrive/ToastNotification_Windows10.ps1
Windows 10 toast notification sample
$ErrorActionPreference = "Stop"
$notificationTitle = "Notification: " + [DateTime]::Now.ToShortTimeString()
[Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime] > $null
$template = [Windows.UI.Notifications.ToastNotificationManager]::GetTemplateContent([Windows.UI.Notifications.ToastTemplateType]::ToastText01)
#Convert to .NET type for XML manipuration
$toastXml = [xml] $template.GetXml()
$toastXml.GetElementsByTagName("text").AppendChild($toastXml.CreateTextNode($notificationTitle)) > $null
@mikalv
mikalv / big-o.md
Created November 27, 2021 05:46 — forked from PJUllrich/big-o.md
Big-O Time Complexities for Elixir Data Structures

Big-O Time Complexities for Elixir data structures

Map [1]

Operation Time Complexity
Access O(log n)
Search O(log n)
Insertion O(n) for < 32 elements, O(log n) for >= 32 elements [2]
Deletion O(n) for < 32 elements, O(log n) for >= 32 elements
@mikalv
mikalv / job_control_zsh_bash.md
Created November 23, 2021 02:32 — forked from CMCDragonkai/job_control_zsh_bash.md
CLI: Job Control in ZSH and Bash

Job Control in ZSH and Bash

All processes in ZSH/Bash under job control are in 3 states: foregrounded, backgrounded and suspended.

# run command in the foreground
command
# run commend in the background

There's something out of whack with the consistent hash algorithm used by swarm (libring):

Add 4 nodes all weighted equally (should be 4 x 25%) libring

iex> ring = HashRing.new()
iex> ring = HashRing.add_node(ring, :a@nohost)
iex> ring = HashRing.add_node(ring, :b@nohost)
iex> ring = HashRing.add_node(ring, :c@nohost)
iex&gt; ring = HashRing.add_node(ring, :d@nohost)