Skip to content

Instantly share code, notes, and snippets.

@atadams
atadams / piwik_referer_domain.sql
Created February 7, 2017 14:29
Piwik Referer Domain
SELECT
SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(referer_url, '://', -1), '/', 1), 'www.', -1) AS domain,
count(*) AS visits
FROM piwik_log_visit
WHERE
visit_first_action_time BETWEEN '2017-01-01' AND '2017-02-01'
AND referer_url NOT LIKE '%effectivehealthcare.ahrq.go%'
GROUP BY domain
ORDER BY visits DESC
@atadams
atadams / backmatting.ipynb
Created February 12, 2021 14:46 — forked from andreyryabtsev/backmatting.ipynb
BackMatting.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@atadams
atadams / pca-vectors.py
Last active June 21, 2024 00:59
Python scripts that compares PCA mean vectors for altered images and unaltered images from raw files
import cv2 as cv
import numpy as np
import rawpy
def perform_pca(filepath, alter_image=False):
if alter_image:
# Read the CR2 image with auto white balance or auto brightness
rgb_image = rawpy.imread(filepath).postprocess()
else: