Skip to content

Instantly share code, notes, and snippets.

@D3f0
D3f0 / .sh
Created March 20, 2024 13:32
Get all the URLs from modern unix
curl https://raw.githubusercontent.com/ibraheemdev/modern-unix/master/README.md | grep "<a" | cut -d '"' -f 2
@D3f0
D3f0 / ubuntu.yaml
Created October 13, 2023 11:15
A Ubuntu 22.04 LTS lima VM with Python3 (3.10) and Invoke (for Apple Sillicon)
images:
# Try to use release-yyyyMMdd image if available. Note that release-yyyyMMdd will be removed after several months.
- location: "https://cloud-images.ubuntu.com/releases/22.04/release-20231010/ubuntu-22.04-server-cloudimg-arm64.img"
arch: "aarch64"
digest: "sha256:5167c1b13cb33274955e36332ecb7b14f02b71fd19a37a9c1a3a0f8a805ab8e5"
mounts:
- location: "~"
- location: "/tmp/lima"
writable: true
@D3f0
D3f0 / test_no_breakpoint_left_behind.py
Created October 28, 2019 17:54
Check not Python breakpoints left behind
from pathlib import Path
from shlex import split
from subprocess import check_output
from typing import List
import pytest
def sh(cmd):
return check_output(split(cmd)).decode("utf-8").splitlines()
@D3f0
D3f0 / add_to_index.js
Created October 2, 2019 05:59
Trace nodejs scripts
// Add this to your index.js, you may want to do file $(which program) to find where
// the package has been installed. Also, you will need to install npm install njstrace
if (process.env.TRACE || false) {
// Generate the name of the tracefile
let call_argument_list = process.argv.slice(2);
call_argument_list.push(new Date().getTime());
let trace_file_name = call_argument_list.join('-');
@D3f0
D3f0 / os.json
Created March 28, 2019 09:07
PINN ordered JSON
{
"os_list": [{
"nominal_size": 9554,
"supported_hex_revisions": "2,3,4,5,6,7,8,9,d,e,f,10,11,12,14,19,1040,1041,0092,0093,2082",
"feature_level": 35120124,
"os_info": "http://downloads.raspberrypi.org/raspbian/os.json",
"icon": "http://downloads.raspberrypi.org/raspbian/Raspbian.png",
"tarballs": [
"http://downloads.raspberrypi.org/raspbian/boot.tar.xz",
"http://downloads.raspberrypi.org/raspbian/root.tar.xz"
@D3f0
D3f0 / pyproject.toml
Created January 7, 2019 09:53
Poetry Shell
[tool.poetry]
name = "pcapfilter"
version = "0.1.0"
description = ""
authors = ["Nahuel Defossé <email@domain>"]
[tool.poetry.dependencies]
python = "^3.6"
scapy = "^2.4"
click = "^7.0"
@D3f0
D3f0 / .aliasrc
Created December 12, 2018 15:53
Record terminal SVG animation
# Uses the termsvg
alias svgcast='termtosvg -t ${TEMPLATE:=window_frame_js} $(echo $(git rev-parse --abbrev-ref HEAD) | tr "/" "_")-$(date "+%Y-%m-%d-%H-%M").svg'
@D3f0
D3f0 / ip_address_bin_rep.py
Created July 2, 2018 23:24
Binary IP check
# Checks that binary representation is the same as int.from_bytes(..., 'big')
bin(int.from_bytes(ip_address('200.1.17.25').packed, 'big'))[2:] == ''.join(format(i, '08b') for i in map(int, '200.1.17.25'.split('.')))
@D3f0
D3f0 / icmp_ip_fragmentation.imn
Created June 4, 2018 17:41
ICMP fragmentation
node n1 {
type router
model host
network-config {
hostname n1
!
interface eth0
ip address 10.0.0.10/24
ipv6 address :0::10/64
!
@D3f0
D3f0 / stack.yml
Created June 1, 2018 05:15
Start CORE
version: 3.2
services:
core:
image: unpdit/coreemu_vnc
ports:
- 8080:8080
- 9999:9999
cap_add:
- NET_ADMIN
- SYS_ADMIN