Skip to content

Instantly share code, notes, and snippets.

@gwarser
gwarser / strip_emoji.py
Created April 23, 2023 06:49 — forked from Alex-Just/strip_emoji.py
Python regex to strip emoji from a string
import re
# http://stackoverflow.com/a/13752628/6762004
RE_EMOJI = re.compile('[\U00010000-\U0010ffff]', flags=re.UNICODE)
def strip_emoji(text):
return RE_EMOJI.sub(r'', text)
print(strip_emoji('🙄🤔'))
@gwarser
gwarser / swapstat.sh
Last active August 30, 2021 12:07 — forked from chriseckhardt/swap-cop.sh
Simple script that displays processes' vm swap usage
#!/bin/bash
# Get current swap usage for all running processes
# NOTE: MUST BE RUN AS ROOT (checks /proc/)
# Erik Ljungstrom 27/05/2011
# Modified by Mikko Rantalainen 2012-08-09
# Modified by Brandon Johnson 2013-07-30
# Pipe the output to "sort -nk3" to get sorted output
# set PID to echo full command path, mysql procs only showed "mysql", which was useless on services with multiple daemons running.
# Also added MB/GB feature for the purposes of using this tool with grep -e "MB" -e "GB"
@gwarser
gwarser / README.md
Last active November 11, 2020 01:59 — forked from indygreg/find_old_lines.pl
Find oldest lines in git repository

I put it in root repo dir and run from filters/ directory, by executing:

../find-oldest-line.sh | ../find-old-lines.pl > ../oldest-lines.txt
@gwarser
gwarser / jq command.sh
Last active October 14, 2020 15:05
Privacy Badger pre-self-trained blocklist, assumed ||action_map^$domain=snitch_map, only heuristicAction == "block"
jq --raw-output '. as $all | $all.action_map|to_entries[]|select(.value.heuristicAction == "block").key as $key | {action: $key, snitch: $all.snitch_map[$key]} | if .snitch then "||\(.action)^$domain=\(.snitch[])" else "||\(.action)^$3p" end' results.json > results.txt
@gwarser
gwarser / disqus ctl embeds.js
Created August 9, 2020 16:38
Disqus click-to-load
/*******************************************************************************
uBlock Origin - a browser extension to block requests.
Copyright (C) 2019-present Raymond Hill
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@gwarser
gwarser / disable-pageview-api.js
Last active September 18, 2023 10:22
"Disable Page Visibility API" scriptlet for uBO
/// disable-pageview-api.js
// Based on: https://addons.mozilla.org/firefox/addon/disable-page-visibility/
// License: http://www.opensource.org/licenses/bsd-license.php
(function(){
// visibilitychange events are captured and stopped
document.addEventListener("visibilitychange", function(e) {
e.stopImmediatePropagation();
}, true);
// document.visibilityState always returns false
Object.defineProperty(Document.prototype, "hidden", {
#!/bin/bash
# Finds all git repos inside directories specified in command line or current
# directory if no path specified and updates them all.
# Uses fetch + ff merge.
# Failed updates are marked by 'FAILED-git-update.txt' file left in git dir
# and dirs specified in command line or current dir if not specified.
# Can be run as cron job, example (includes sleep to randomize startup time):
# 0 */3 * * * $USER /bin/sleep $(shuf -i 0-300 -n 1) && /bin/bash $HOME/git/update-all-repos.sh $HOME/git/
-- autosave.lua
--
-- Periodically saves "watch later" data during playback, rather than only saving on quit.
-- This lets you easily recover your position in the case of an ungraceful shutdown of mpv (crash, power failure, etc.).
--
-- You can configure the save period by creating a "lua-settings" directory inside your mpv configuration directory.
-- Inside the "lua-settings" directory, create a file named "autosave.conf".
-- The save period can be set like so:
--
-- save_period=60

Answer to comments on uBlock Origin thread: https://github.com/gorhill/uBlock/commit/5733439f629da948cfc3cae74afa519f6cff7b7f as it seems I do not have permission to comment.

Hi,

First of all I'd like to personnaly thank you for all the work you do on uBlock Origin and other extensions, the source code of which have been an inspiration to me personally many times in the past.

I am also really excited that there are multiple people pushing for more accurate measurements of the efficiency of content-blockers and I think sharing methodologies, data and results is a great start!

It is interesting that the results you obtained diverge from the study published yesterday. If I understand correctly you got similar timings for uBlock Origin itself, but the numbers for Adblock Plus do not seem to match (45µs instead of ~19µs). I'd really like to understand where this difference could come from.

! Title: uBO-Extra helper moved https://github.com/gwarser/filter-lists/blob/master/uBO-Extra-notifier.txt
! Expires: 30 days
! Description: Displays mesage on pages where uBO-Extra is usefull
!
101greatgoals.com,4chan.org,afterellen.com,allthetests.com,americanphotomag.com,atvrider.com,baggersmag.com,baltimoresun.com,biology-online.org,boatingmag.com,boston.com,cafemom.com,calgaryherald.com,calgarysun.com,capitalgazette.com,carrollcountytimes.com,cattime.com,cbssports.com,chicagotribune.com,chowhound.com,chron.com,chroniclelive.co.uk,citypaper.com,cnet.com,comingsoon.net,computershopper.com,courant.com,craveonline.com,cruisingworld.com,csgoutpost.com,ctnow.com,cycleworld.com,dailydot.com,dailypress.com,dayzdb.com,deathandtaxesmag.com,delmartimes.net,destinationweddingmag.com,destructoid.com,dirtrider.com,diversitybestpractices.com,dogtime.com,dotaoutpost.com,download.cnet.com,edmontonjournal.com,edmontonsun.com,edmunds.com,emedicinehealth.com,esohead.com,eurweb.com,everquest.allakhazam.com,everydayhealth.com