Skip to content

Instantly share code, notes, and snippets.

View theplatypus's full-sized avatar

Nicolas Bloyet theplatypus

View GitHub Profile
@theplatypus
theplatypus / config.alloy
Created October 15, 2024 08:04
Alloy basic config
prometheus.exporter.unix "node" {
set_collectors = [
"uname",
"cpu",
"cpufreq",
"loadavg",
"meminfo",
"filesystem",
"netdev",
]
@theplatypus
theplatypus / .zshrc
Last active October 14, 2024 15:14
Kali .zshrc
# ~/.zshrc file for zsh interactive shells.
# see /usr/share/doc/zsh/examples/zshrc for examples
setopt autocd # change directory just by typing its name
#setopt correct # auto correct mistakes
setopt interactivecomments # allow comments in interactive mode
setopt magicequalsubst # enable filename expansion for arguments of the form ‘anything=expression’
setopt nonomatch # hide error message if there is no match for the pattern
setopt notify # report the status of background jobs immediately
setopt numericglobsort # sort filenames numerically when it makes sense
@theplatypus
theplatypus / logging_utils.py
Last active September 22, 2024 22:44
logging_utils.py
import sys
import time
import asyncio
import re
from functools import wraps
VERBOSITY = 1
CBLACK = '\33[30m'
@theplatypus
theplatypus / .zshrc
Last active September 3, 2024 13:26
dotfiles
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH="$HOME/.oh-my-zsh"
# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
@theplatypus
theplatypus / head_dump.py
Last active August 31, 2024 13:12
binary head
#!/bin/env python
import binascii
import argparse
def head_dump(path, head = None):
with open(path, "rb") as fh:
buf = fh.read(head) if head else fh.read(head)
print(binascii.hexlify(buf, b' '))
@theplatypus
theplatypus / asyncio_socket_queue.py
Last active April 2, 2023 00:53
Bind to TCP socket to read bytes, putting them into an asyncio.Queue / client
import asyncio
SOCKET_BUFFER_SIZE = 64
QUEUE_SIZE = 1500
WARNING = '\033[93m'
STD = '\033[0m'
def print_y(msg):
print(f"{WARNING}{msg}{STD}")
@theplatypus
theplatypus / regularization_path.py
Created September 23, 2022 21:54
Feature Selection based on Lasso Regularization along with AIC/BIC
from itertools import cycle
import numpy as np
import pandas as pd
from sklearn.linear_model import lasso_path, enet_path, lars_path, LassoLarsIC, LinearRegression
from sklearn.preprocessing import StandardScaler
from sklearn.pipeline import make_pipeline
@theplatypus
theplatypus / stress_test.sh
Last active April 26, 2022 08:20
Naive Stress Test with cURL
#!/bin/bash
#### Default Configuration
CONCURRENCY=4
REQUESTS=10
TARGET="http://127.0.0.1/api_endpoint"
REQ_ARG="?[1-$REQUESTS]"
@theplatypus
theplatypus / cmd.sh
Last active October 11, 2019 20:43
Compile tikz figures as minimal size pdf
#!/bin/bash
pdflatex --jobname=figure-1 main.tex
pdflatex --jobname=plot-1 main.tex
@theplatypus
theplatypus / cardigraph.py
Last active December 24, 2019 11:29
Compute cardinality of several classes of graph, from the least restricted to the most
from math import factorial, ceil
def fact(n):
"""
n!
<just as a reminder, we do prefer using C implementation of math library therefore>
"""
if n == 0 :
return 1
else :