Skip to content

Instantly share code, notes, and snippets.

View admariner's full-sized avatar

Periklis Papanikolaou admariner

  • admariner
  • Thessaloniki
View GitHub Profile
@ZordnajelA
ZordnajelA / ga4_traffic_source_session_level.sql
Last active February 19, 2024 03:30
Using SQL FIRST_VALUE() window function to replicate GA4 traffic source attribution behavior
FIRST_VALUE(
(SELECT
value.string_value
FROM
UNNEST(event_params)
WHERE
key = 'name_of_traffic_source_parameter'
--source, medium, campaign, content, term, campaign_id
)
@manchumahara
manchumahara / gist:dc88a6b9b157ada5f02cb8408653b80f
Created September 21, 2022 04:53
Google My Business Categories (Json formatted)
[
"Abbey",
"Aboriginal and Torres Strait Islander organization",
"Aboriginal art gallery",
"Abortion clinic",
"Abrasives supplier",
"Abundant Life church",
"Accountant",
"Accounting firm",
"Accounting school",
@ZordnajelA
ZordnajelA / ga4_session_scope_custom_dimension.sql
Last active February 19, 2024 06:24
Using SQL window functions to replicate Google Analytics custom dimensions behavior
LAST_VALUE(
(SELECT
value.string_value --value.int_value, value.float_value, value.double_value
FROM
UNNEST(event_params)
WHERE
key = 'name_of_event_parameter_to_use_as_dimension'
)
IGNORE nulls
) OVER (
@luratic-devs
luratic-devs / GA4 - Dimensions & Metrics Cheatsheet - Changelog.md
Last active February 2, 2025 16:20
GA4 - Dimensions & Metrics Cheatsheet - Changelog.md
@karpathy
karpathy / stablediffusionwalk.py
Last active June 29, 2025 09:56
hacky stablediffusion code for generating videos
"""
stable diffusion dreaming
creates hypnotic moving videos by smoothly walking randomly through the sample space
example way to run this script:
$ python stablediffusionwalk.py --prompt "blueberry spaghetti" --name blueberry
to stitch together the images, e.g.:
$ ffmpeg -r 10 -f image2 -s 512x512 -i blueberry/frame%06d.jpg -vcodec libx264 -crf 10 -pix_fmt yuv420p blueberry.mp4
import plotly.express as px
def treemap(traffic_df, metric='Users', path=['Medium', 'Source']):
"""Make in interactive treemap for two data dimensions/levels.
Parameters:
-----------
traffic_df : A DataFrame containing two dimensions, and one or more metrics
@RomainVialard
RomainVialard / Get indexes of selected rows.gs
Last active August 16, 2024 00:32
Google Apps Script - Google Sheets - Use the getActiveRangeList() method to get indexes of selected rows
function myFunction() {
const sheet = SpreadsheetApp.getActiveSheet();
const data = sheet.getDataRange().getValues();
const selectedRows = getIndexesOfSelectedRows(sheet);
for (let i = 0; i < data.length; i++) {
// skip not selected rows
if (!selectedRows.includes(i + 1)) continue;
const rowData = data[i];
console.log(rowData);
// perform the relevant action: generate a document, send an email,...
@ioannispol
ioannispol / conda-env-setup.sh
Last active September 6, 2024 01:43
Automate Anaconda environment creation
#!/usr/bin/env bash
SECONDS=0
source ~/miniconda3/etc/profile.d/conda.sh
# Set miniconda environment path
ENV_PATH="$HOME/miniconda3/envs"
echo "The folowing environments are installed:$(ls $ENV_PATH)"
@thefranke
thefranke / Redirector.json
Last active January 30, 2025 05:13
Redirector Configuration
{
"createdBy": "Redirector v3.5.3",
"createdAt": "2023-05-24T14:38:35.748Z",
"redirects": [
{
"description": "Wikipedia -> Wikiless",
"exampleUrl": "https://en.wikipedia.org/wiki/XYZ",
"exampleResult": "https://farside.link/wikiless/wiki/XYZ",
"error": null,
"includePattern": "*wikipedia.org/*",