Skip to content

Instantly share code, notes, and snippets.

@tonybaloney
tonybaloney / tidy.sh
Last active April 22, 2023 20:17
tidy script
# Delete all forks that haven't been updated since 2020
gh auth refresh -h github.com -s delete_repo
gh search repos \
--owner tonybaloney \
--updated="<2020-01-01" \
--include-forks=only \
--limit 100 \
--json url \
--jq ".[] .url" \ | xargs -I {} gh repo delete {} --confirm
@caksoylar
caksoylar / zen-display-improvements.md
Last active May 22, 2024 15:30
Corne-ish Zen display improvements

Display improvements for the Corne-ish Zen keyboard

This note details the changes made to the Zen and ZMK codebase to improve the experience of e-ink displays.

Getting the changes

You can test out below changes using your Zen config repo by modifying your config/west.yml file, following ZMK instructions:

manifest:
  remotes:
 - name: caksoylar
@robrich
robrich / README.md
Last active May 7, 2024 13:24
the definitive deep dive into the .git folder

the definitive deep dive into the .git folder

Thanks for joining us for "the definitive deep dive into the .git folder". It's an incredible live-demo where we open every file in the .git folder and show what it does.

Links

Here's the links we saw:

@remi
remi / shc.js
Last active March 2, 2022 14:32
Extract JSON object from https://smarthealth.cards QR code
// Extract JSON payload from SHC QR code (without any kind of private/public key verification)
// Credits + inspiration
// https://github.com/dvci/health-cards-walkthrough/blob/main/SMART%20Health%20Cards.ipynb
// Usage
// $ node shc.js "shc:/01234569…"
const zlib = require("zlib");
@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/')) {
@mikeckennedy
mikeckennedy / speed_of_exceptions.py
Created July 9, 2020 18:02
Simple example to test how much faster or slower it is to simply try and convert then catch an error vs. testing up front.
import datetime
import random
from typing import List
def main():
random.seed(172)
count = 1_000_000
data = build_data(count)
run_with_except(data)
TEAM | POINTS | LAST SUBMIT
----------------------------------+--------+-------------------
<CA> HubrETS Hackin'' | 155 | 2020/05/17 14:58
<CA> Les Gentils Pirates | 133 | 2020/05/17 14:42
<CA> CLICKESTI | 129 | 2020/05/17 14:07
<US> Skiddies as a Service | 125 | 2020/05/17 14:44
<CA> cold_root | 116 | 2020/05/17 14:38
<CA> Panique Au Village | 94 | 2020/05/17 14:47
<CA> Shopify | 84 | 2020/05/17 14:47
<CA> segfaults | 77 | 2020/05/17 14:55
@Neo23x0
Neo23x0 / sysmon_suspicious_keyboard_layout_load.yml
Last active September 4, 2020 15:41
Sigma Rule to Detect Uncommon Keyboard Layout Loads in Your Organisation
title: Suspicious Keyboard Layout Load
description: Detects the keyboard preload installation with a suspicious keyboard layout, e.g. Chinese, Iranian or Vietnamese layout load in user session on systems maintained by US staff only
references:
- https://renenyffenegger.ch/notes/Windows/registry/tree/HKEY_CURRENT_USER/Keyboard-Layout/Preload/index
author: Florian Roth
date: 2019/10/12
logsource:
product: windows
service: sysmon
definition: 'Requirements: Sysmon config that monitors \Keyboard Layout\Preload subkey of the HKLU hives - see https://github.com/SwiftOnSecurity/sysmon-config/pull/92/files'

Latency Comparison Numbers (~2012)

Name
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cachereference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
@ErikFontanel
ErikFontanel / filter-youtube-domains.sh
Last active November 28, 2023 18:55
Pi-hole Youtube ad blocking
#!/bin/sh
# This script will fetch the Googlevideo ad domains and append them to the Pi-hole block list.
# Run this script daily with a cron job (don't forget to chmod +x)
# More info here: https://discourse.pi-hole.net/t/how-do-i-block-ads-on-youtube/253/136
# File to store the YT ad domains
FILE=/etc/pihole/youtube.hosts
# Fetch the list of domains, remove the ip's and save them
curl 'https://api.hackertarget.com/hostsearch/?q=googlevideo.com' \