Skip to content

Instantly share code, notes, and snippets.

Avatar

Daniel Aleksandersen da2x

View GitHub Profile
View jpeg-progressive-scan.txt
0 1 2: 0 0 0 0;
0: 1 9 0 0;
2: 1 63 0 0 ;
1: 1 63 0 0 ;
0: 10 63 0 0;
@da2x
da2x / fedora-askbot-redirects.conf
Created May 17, 2019
HTTPD redirects from ask.fedoraproject.org to the old askbot posts on the Internet Archive.
View fedora-askbot-redirects.conf
This file has been truncated, but you can view the full file.
Redirect 301 /en/question/9369/network-manager-not-detecting-3g-modem-after-installing-mobilepartner-app/ https://web.archive.org/web/20190517/https://askbot.fedoraproject.org/en/question/9369/network-manager-not-detecting-3g-modem-after-installing-mobilepartner-app/
Redirect 301 /en/question/10303/no-option-for-gnome-desktop-at-start-up-newbie/ https://web.archive.org/web/20190517/https://askbot.fedoraproject.org/en/question/10303/no-option-for-gnome-desktop-at-start-up-newbie/
Redirect 301 /en/question/54800/how-to-remove-a-font-installed-on-fedora-20/ https://web.archive.org/web/20190517/https://askbot.fedoraproject.org/en/question/54800/how-to-remove-a-font-installed-on-fedora-20/
Redirect 301 /en/question/104551/is-there-a-source-of-older-gcc-packages-for-fedora-25/ https://web.archive.org/web/20190517/https://askbot.fedoraproject.org/en/question/104551/is-there-a-source-of-older-gcc-packages-for-fedora-25/
@da2x
da2x / dweb_researcher.py3
Last active Feb 11, 2019
Python 3 program for parsing Tranco ranking lists to discover Dat and IPFS websites.
View dweb_researcher.py3
from os.path import isfile
from urllib.request import urlopen
import concurrent.futures
import socket
import dns.resolver
import time
from urllib.request import urlopen, Request
import multiprocessing as mp
import os
import sys
@da2x
da2x / tranco-dat-research.csv
Last active Feb 11, 2019
Top 10 websites with http://$domain.well-known/dat from crawling the top 2,4 million most popular websites and domains in January 2019
View tranco-dat-research.csv
Tranco RNXW List Rank Dat archive domain name availability
0149929 dat://d82084b53fce5f07696c2acf98a363601ec9410d06c633513269979786464eb3 ar.al available
0406174 dat://4bc5d5651d95e89348663fa71dd62de9bb2cdb247c7c02414e7d0ba917d95c2c evertpot.com unavailable
0417810 dat://ba81c9746d6183f3d5c05d51279ff3e0fed06369d0e17a3bbd4ac76e7303b418 ind.ie available
0505161 dat://47a6d1ac8084cdbeba2def34eb3528fe7c23add67442c516314acaa47937db26 staltz.com unavailable
0742962 dat://8bb99a0ac0d56131e61bd4bfea74ced9bc2c603e78e4eb72e8dd2fd6f33743cd beakerbrowser.com available
0848744 dat://54cb4accdabc258240d76df28ee66c0900aeaadddb822e2b99e0cef113ae128b bernsteinbear.com unavailable
0874829 dat://8dd20f73e70b5a467eabefd2c3ef6e0d39668afea90190e498e7cc396a1bea07 inkdroid.org available
0887990 dat://cff13e4cc797f46d453d4b2d7472dd481d7fd2f0a1c6e4eab425327f48c396fd macwright.org unavailable
1167327 dat://676db9db2e04a604ea6dbc798bb0d327a335c19b4856ac496ae4bb34e367633a freedombone.net unavailable
@da2x
da2x / google-my-activity-deletion.js
Created May 27, 2018
Delete My Activity from your Google Account older than 9 moonths.
View google-my-activity-deletion.js
Date.prototype.getUnixTime = function() {
return this.getTime()/1000|0;
};
Date.prototype.getUnixMicroUnixTime = function() {
return this.getUnixTime()*1000000;
};
var date = new Date();
date.setMonth(date.getMonth() - 9);
@da2x
da2x / track-hashes.js
Created Mar 10, 2018
Hash-based tracking links
View track-hashes.js
/*
Tracking links that use hashes rather than query parameters.
Improves privacy by not including campaign data in referral-out links.
Improves CDN/proxy privacy by not sharing campaign data with them. Also improves caching!
Tracking links can (optionally) be removed from URLbar/history without a redirect.
Example links:
/document#s:feed
/document#s:email
*/
@da2x
da2x / brave_publisher_dns_crawler.py
Created Dec 6, 2017
Detects websites with brave-leder-verifications in their DNS records. Note that such a ledger is no guarantee that the website is infact a verified Brave publisher.
View brave_publisher_dns_crawler.py
# Download and unzip Alexa Top 1 Million websites
# http://s3.amazonaws.com/alexa-static/top-1m.csv.zip
# Run this script.
from os.path import isfile
from urllib.request import urlopen
import concurrent.futures
import socket
import dns.resolver
import time
@da2x
da2x / amp2html.js
Created Sep 28, 2017
Redirect AMP pages to the canonical HTML equivalent.
View amp2html.js
if (document.querySelector("html[amp],html[⚡]")) {
var amp = document.head.querySelector("link[rel='amphtml'][href]"),
canon = document.head.querySelector("link[rel='canonical'][href^='https://'],\
link[rel='canonical'][href^='http://']");
if (null != canon && amp != canon) {
document.location = canon.href;
} }
View bug.py
>>> test = 0.8
>>> test -= 0.2
>>> print(test)
0.7000000000000001
>>> test = 0.8
>>> test -= 0.1
>>> print(test)
0.7000000000000001
@da2x
da2x / double-escape.py
Created Jul 13, 2017
Extracting the text node of an XML element containing a double-escaped entety.
View double-escape.py
>>> import xml.etree.ElementTree as ETree
>>> ETree.fromstring("<test>&amp;rdquo;</test>").text
'&rdquo;'
You can’t perform that action at this time.