Skip to content

Instantly share code, notes, and snippets.

View adriaandotcom's full-sized avatar
🕵️‍♂️
Developing the privacy-first Simple Analytics

Adriaan adriaandotcom

🕵️‍♂️
Developing the privacy-first Simple Analytics
View GitHub Profile
@adriaandotcom
adriaandotcom / README.md
Created February 6, 2023 05:25
Google Looker submission script

Copy paste the script into the console of the submission flow of Google Looker. It's a Google Form, so might work for other Google Forms as well.

Enjoy!

@adriaandotcom
adriaandotcom / preview.md
Last active January 8, 2023 12:34
AQI iOS lock screen widget with waqi.info

Here is how it looks (most left widget):

@adriaandotcom
adriaandotcom / bookmark.js
Created June 8, 2022 11:02
Fix Twitter's schedule tweet feature
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;
@adriaandotcom
adriaandotcom / inspection.json
Created September 23, 2020 08:13
Blacklight export
{
"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": {
@adriaandotcom
adriaandotcom / index.html
Created September 22, 2020 20:54
Sales popup
<!--
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">
@adriaandotcom
adriaandotcom / ssl.bash
Created May 13, 2020 08:45
Check SSL expiry in terminal
openssl s_client -connect simpleanalytics.io:443 -servername simpleanalytics.io </dev/null | openssl x509 -in /dev/stdin -checkend 2592000 -noout -issuer -subject -dates
@adriaandotcom
adriaandotcom / index.html
Created April 3, 2020 19:09
Send events on outgoing links
<!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>
@adriaandotcom
adriaandotcom / keybase.md
Created January 3, 2020 11:44
Keybase proof

Keybase proof

I hereby claim:

To claim this, I am signing this object:

@adriaandotcom
adriaandotcom / 30-anonymize.conf
Last active May 28, 2020 20:38
Anonymize your syslog logs
# 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})')
@adriaandotcom
adriaandotcom / aa-readme.md
Last active December 17, 2019 16:54
Run AB-tests without cookies and IPs

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: