Skip to content

Instantly share code, notes, and snippets.

View midzer's full-sized avatar

midzer

View GitHub Profile
@pezcode
pezcode / server-cross-origin.py
Last active May 20, 2024 14:46
Local HTTP server with COEP+COOP enabled for SharedArrayBuffer
# Based on:
# https://stackoverflow.com/a/21957017
# https://gist.github.com/HaiyangXu/ec88cbdce3cdbac7b8d5
from http.server import SimpleHTTPRequestHandler
import socketserver
import sys
class Handler(SimpleHTTPRequestHandler):
extensions_map = {
@penguwin
penguwin / pre-push
Last active December 29, 2020 14:50
A git hook to prevent force pushing on master
#!/bin/bash
# Per-repo installation
# 1. Place this file in `.git/hooks/pre-push`
# 2. `chmod +x` it
clippy='
_________________________________________
/ It looks like youre trying to force \
| push on master... |
@moba
moba / find-low-bitrate.sh
Created December 13, 2019 21:49
scans one mp3 per directory and prints files with low bitrate
#!/bin/bash
scanfile ()
{
FILE="${1//[$'\n']}" # drop newline from argument
BITRATE=$(/usr/bin/mediainfo "$FILE" --Output=JSON | jq '.media.track[0].OverallBitRate')
BITRATE="${BITRATE//[$'\"']}" # remove "
if [[ $BITRATE -lt "130000" ]]; then
echo $BITRATE " " $FILE
fi
@maxboeck
maxboeck / donottrack.js
Last active November 6, 2023 10:00
Check "Do Not Track" Client Hint
const allowsTracking = () => {
const dnt =
window.doNotTrack ||
navigator.doNotTrack ||
navigator.msDoNotTrack
if (dnt === 1 || dnt === '1' || dnt === 'yes') {
return false
}
if ('msTrackingProtectionEnabled' in window.external) {
return !window.external.msTrackingProtectionEnabled()
@crusy
crusy / uBlock filter rules (public)
Last active March 14, 2024 13:32
uBlock Filter
# Make Outlook's selected mail more visible:
outlook.office.com#$#div[aria-selected="true"] * { font-weight: bold !important; }
# Make stackoverflow less cluttered:
stackoverflow.com##div.s-sidebarwidget__yellow
stackoverflow.com###hot-network-questions
stackoverflow.com###feed-link
stackoverflow.com###newsletter-ad
stackoverflow.com#$#div.everyonelovesstackoverflow{ margin-bottom: 0 !important; }
stackoverflow.com##:xpath(//ol[li[div[text()='Teams']]])
@Zren
Zren / DarkSolarized.qss
Last active August 28, 2022 14:22
Dark Solarized - Quassel Theme (qss)
/**
** ______ _ _____ _ _ _
** | _ \ | | / ___| | | (_) | |
** | | | |__ _ _ __| | __ \ `--. ___ | | __ _ _ __ _ _______ __| |
** | | | / _` | '__| |/ / `--. \/ _ \| |/ _` | '__| |_ / _ \/ _` |
** | |/ / (_| | | | < /\__/ / (_) | | (_| | | | |/ / __/ (_| |
** |___/ \__,_|_| |_|\_\ \____/ \___/|_|\__,_|_| |_/___\___|\__,_|
**
** Quassel Theme
**
@nixpulvis
nixpulvis / gem-reset
Last active October 5, 2020 15:21
Remove all non default gems. For ruby 2.0.0
#!/usr/bin/env ruby
# Remove all gems EXCEPT defaults :)
`gem list -d`.split(/\n\n^(?=\w)/).each do |data|
match = data.match(/(?<name>([^\s]+)) \((?<versions>.*)\)/)
name = match[:name]
versions = match[:versions].split(', ')
if match = data.match(/^.*\(([\d\.]*),? ?default\): .*$/)
next if match[1].empty? # it's the only version if this match is empty