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 / comments.sql
Last active November 19, 2018 08:00
Output of teppic's answer
CREATE TABLE IF NOT EXISTS comment (
comment_id serial primary key,
original_id integer,
text text,
upvotes integer
);
INSERT INTO "public"."comment" ("comment_id", "original_id", "text", "upvotes") VALUES
('1', NULL, 'Hi.. should be 1', '10'),
('2', NULL, 'Je.. should be 10', '0'),
@adriaandotcom
adriaandotcom / endpoint.json
Last active December 1, 2018 13:06
Hugo API
{
"hostname": "codewithhugo.com",
"timezone": "UTC",
"visits": [
{
"utc_date": "2018-11-28",
"count": 2
},
{
"utc_date": "2018-11-29",
@adriaandotcom
adriaandotcom / time_zone_per_country.csv
Last active May 18, 2023 09:31
List of time zone names with country codes (version 2018i from https://www.iana.org/time-zones)
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
@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:

@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 / 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 / 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 / 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 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 / 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": {