Skip to content

Instantly share code, notes, and snippets.

Avatar
🕵️‍♂️
Developing the privacy-first Simple Analytics

Adriaan adriaanvanrossum

🕵️‍♂️
Developing the privacy-first Simple Analytics
View GitHub Profile
@adriaanvanrossum
adriaanvanrossum / bookmark.js
Created Jun 8, 2022
Fix Twitter's schedule tweet feature
View bookmark.js
javascript: (function () {
const currentHour = new Date().getHours();
const scheduleHour =
currentHour < 10 ? 10 : currentHour < 14 ? 14 : currentHour < 17 ? 17 : 10;
const addDays = currentHour < 17 ? 0 : 1;
const date = new Date(Date.now() + addDays * 24 * 60 * 60 * 1000);
const [month, day, year, hour, minute] = document.querySelectorAll(
'[role="dialog"] select'
);
month.value = date.getMonth() + 1;
View inspection.json
{
"title": "Blacklight - API Request",
"uri_ins": "http://simpleanalytics.com",
"uri_dest": "https://simpleanalytics.com/",
"uri_redirects": [
"http://simpleanalytics.com/"
],
"secure_connection": {},
"host": "simpleanalytics.com",
"config": {
View index.html
<!--
Shared because of this Tweet: https://twitter.com/iammarcthomas/status/1308507994334822400
-->
<div
data-sales-vue
v-bind:class="[{ finished: isFinished }, 'sales-popup', 'box']"
>
<a v-if="!isFinished" class="close" v-on:click="onClose">&times;</a>
<h2 v-if="!isFinished">
@adriaanvanrossum
adriaanvanrossum / ssl.bash
Created May 13, 2020
Check SSL expiry in terminal
View ssl.bash
openssl s_client -connect simpleanalytics.io:443 -servername simpleanalytics.io </dev/null | openssl x509 -in /dev/stdin -checkend 2592000 -noout -issuer -subject -dates
@adriaanvanrossum
adriaanvanrossum / index.html
Created Apr 3, 2020
Send events on outgoing links
View index.html
<!DOCTYPE html>
<html lang="en">
<head>
<title>Test page</title>
<script>window.sa_event=window.sa_event||function(){a=[].slice.call(arguments);sa_event.q?sa_event.q.push(a):sa_event.q=[a]};</script>
<script async src="https://scripts.simpleanalyticscdn.com/latest.js"></script>
</head>
<body>
<a href="https://example.com" onClick="sa_event('click_to_example_com')" target="_blank">Link to example.com</a>
</body>
View keybase.md

Keybase proof

I hereby claim:

To claim this, I am signing this object:

@adriaanvanrossum
adriaanvanrossum / 30-anonymize.conf
Last active May 28, 2020
Anonymize your syslog logs
View 30-anonymize.conf
# Specify a custom format to anonymize your logs
$template anonymize,"%$year%-%$month%-%$day% %timegenerated:12:19:date-rfc3339% %app-name% %$!new%\n"
# This makes the anonymize template the default for all file actions
$ActionFileDefaultTemplate anonymize
set $!new = $msg;
# Replace credit cards
if re_match($msg,'([0-9]{13,16})')
@adriaanvanrossum
adriaanvanrossum / aa-readme.md
Last active Dec 17, 2019
Run AB-tests without cookies and IPs
View aa-readme.md

Goal

I'm creating AB-tests and want to have a client side JavaScript function that returns a small integer. The integer will be the same every time the same user connects to my website. I don't want to use cookies, localStorage or IPs for this. Just a very simple hash with the user agent and maybe a few more variables.

Read more on Twitter: https://twitter.com/AdriaanvRossum/status/1198102973114654720

Results

We tested all convert to int functions with the dataset from agents.js, these are the results:

@adriaanvanrossum
adriaanvanrossum / time_zone_per_country.csv
Last active Feb 1, 2019
List of time zone names with country codes (version 2018i from https://www.iana.org/time-zones)
View time_zone_per_country.csv
country_code time_zone
AD Europe/Andorra
AE Asia/Dubai
AF Asia/Kabul
AG America/Antigua
AI America/Anguilla
AL Europe/Tirane
AM Asia/Yerevan
AO Africa/Luanda
AQ Antarctica/Casey
View endpoint.json
{
"hostname": "codewithhugo.com",
"timezone": "UTC",
"visits": [
{
"utc_date": "2018-11-28",
"count": 2
},
{
"utc_date": "2018-11-29",