Skip to content

Instantly share code, notes, and snippets.

@Quentin-M
Quentin-M / trace_udp_rcvbuferrors.bt
Created April 30, 2022 12:34
trace_udp_rcvbuferrors.bt
// Tracks the origin of net_udp_rcvbuferrors, printing socket metadata associated with the packet drops.
//
// usage: bpftrace trace_udp_rcvbuferrors.bt
// sample output:
// 12:32:25 iperf3/3391 ::ffff:192.168.60.3:5201 -> ::ffff:192.168.60.1:50512 retval=-1 dropped=23809 qlen=36 qsize/qmaxsize=213248/212992 bytes
kprobe:udp_queue_rcv_skb
{
$sock = (struct sock *)arg0;
if ($sock->sk_type != SOCK_DGRAM || ($sock->__sk_common.skc_family != AF_INET && $sock->__sk_common.skc_family != AF_INET6)) {
@Quentin-M
Quentin-M / ogamex-resource-trader-calculator.ipynb
Created November 16, 2021 23:18
OgameX - Resource Trader Calculator.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Quentin-M
Quentin-M / iOS.xml
Created July 27, 2021 03:48
iPad Pro 12.9 (2021 / M1) + PleX - Sync'ing 4K HVEC / H.265 content without transcoding
<?xml version="1.0" encoding="utf-8"?>
<Client name="iOS">
<!--
Description: Allows sync'ing / downloading any PleX content, including 4K HVEC HDR10 content, to the iPad Pro 12.9 with M1 chip.
Author: Quentin Machu (https://github.com/Quentin-M)
Disclaimer: There might be a few combinations of unplayable content as I haven't tested rigorously, but that ain't my goal today.
Instructions: Replace iOS.xml in /usr/lib/plexmediaserver/Resources/Profiles/ (or use /var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Profiles), profit $$$ while the battery lasts (if it does).
-->
<Settings>
<Setting name="DirectPlayStreamSelection" value="true" />
@Quentin-M
Quentin-M / tcpretrans.perl
Created May 13, 2020 18:16
tcpretrans - show TCP retransmts, with address and other details. Written using Linux ftrace.
#!/usr/bin/perl
#
# tcpretrans - show TCP retransmts, with address and other details.
# Written using Linux ftrace.
#
# This traces TCP retransmits, showing address, port, and TCP state information,
# and sometimes the PID (although usually not, since retransmits are usually
# sent by the kernel on timeouts). To keep overhead low, only
# tcp_retransmit_skb() calls are traced (this does not trace every packet).
#
@Quentin-M
Quentin-M / dbactivitystream_s3_decrypt.py
Created May 12, 2020 19:26
Decrypts a set of S3 files resulting from an DB Activity Streams using an LRU to save time/$ (Local dev / Python version - Also have a Golang version to run as Lambda in Kinesis Stream)
import base64
import zlib
import re
import argparse
import os
import glob
import locale
from json import JSONDecoder, JSONDecodeError
import aws_encryption_sdk
@Quentin-M
Quentin-M / fetch_rds_logs.py
Last active April 21, 2020 23:24
Download AWS RDS / Aurora logs between specified dates - working around truncated files from broken API
import os
import argparse
import botocore.session
import botocore.awsrequest
# Arguments
parser = argparse.ArgumentParser(
description=
'''
@Quentin-M
Quentin-M / fetch_rds_logs.sh
Created April 21, 2020 04:16
Download AWS RDS / Aurora logs between specified dates - working around truncated files from broken API
#!/bin/bash
set -e
REGION=eu-west-1
DB_INSTANCE=
USE_CSV=0
START_DATE=`gdate -u +'%Y-%m-%d'`
END_DATE=`gdate -u +'%Y-%m-%d' --date 'tomorrow'`
package main
import (
"bytes"
"context"
"crypto/ecdsa"
"crypto/elliptic"
crand "crypto/rand"
"crypto/tls"
"crypto/x509"
@Quentin-M
Quentin-M / main.go
Last active October 1, 2017 21:26
Go: Generic configuration and typed configuration for dynamic providers (with defaults)
package main
import (
"fmt"
"reflect"
"time"
"unsafe"
"gopkg.in/yaml.v2"
)
@Quentin-M
Quentin-M / gist:272d64faf0bc8533e131
Last active November 19, 2015 07:01
Unlock 1Password with Yukikey in Challenge-Response mode
-# Have 1Password Mini enabled
-# Configure Ubikey with the Challenge-Response mode (Slot 2 per defaut, change -2 by -1 to use Slot 1)
-# Get the response of /usr/bin/sudo /usr/local/bin/ykchalresp -2 *PIN_CODE* and set it as your 1Password master password
-# Modify the pin in the code below
-# Create a service in Automator, paste the script, set the script input as none, save it
-# Open MacOS Shortcut preferences, create a service with the exact same name, define a shortcut
-# The app that has the focus when you press the shortcut has to have assistive access
on toggle_mini()
tell application "System Events" to tell process "1Password mini"