Skip to content

Instantly share code, notes, and snippets.

View DinoChiesa's full-sized avatar

Dino Chiesa DinoChiesa

View GitHub Profile
@DinoChiesa
DinoChiesa / csharp-ts-mode-navigation.el
Created December 29, 2024 01:10
Navigation helpers for csharp-ts-mode in emacs 29
;;; csharp-ts-mode-navigation.el --- define some helpers for navigating in csharp-ts-mode
;;
;; Author: Dino Chiesa
;; Created: Sunday, 29 December 2024, 00:34
;; Package-Requires: (csharp-ts-mode.el)
;; URL:
;; X-URL:
;; Version: 2024.12.29
;; Keywords: csharp treesit
;; License: Apache 2.0
Instructions for running peloton-to-garmin (https://github.com/philosowaffle/peloton-to-garmin) in Cloud Run, assuming you're doing this from Windows Powershell v7.4.6:
$env:PROJECT_ID="your-gcp-project-id"
$env:REGION="us-west1"
$env:JOB_NAME="peloton-to-garmin"
gcloud config set core/project $env:PROJECT_ID
# create two GCS buckets - https://cloud.google.com/sdk/gcloud/reference/storage/buckets/create
# one for the output, one for the configuration file
<style type='text/css'>
/* https://stackoverflow.com/a/63574369/48082 */
body, body #index .main-content .home-page .home-page-cta h1.home-page-cta-title {
font-family: 'SF Pro Text',-apple-system,BlinkMacSystemFont,Roboto,'Segoe UI',Helvetica,Arial,sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol';
}
body #index > .main-content {
padding: 0;
background-color: #7d7d7d;
background-image: revert;
@DinoChiesa
DinoChiesa / getTokenWithRetry.js
Created October 21, 2024 17:33
Apigee JS httpClient with retry
// getTokenWithRetry.js
// ------------------------------------------------------------------
//
// Example JS policy configuration:
//
// Note: you need the authUrl Property.
//
// <Javascript name='JS-Retrieve-Token' timeLimit='12000' >
// <Properties>
// <Property name='authUrl'>https://url-for-token-endpoint/token</Property>
@DinoChiesa
DinoChiesa / OAuth2 Client Credentials.postman_collection.json
Created October 15, 2024 03:51
Postman collection for the OAuthV2 Client Credentials example.
{
"info": {
"_postman_id": "ac53fc95-c464-4413-8330-0ae96d1bfd1e",
"name": "OAuth2 Client Credentials",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
"_exporter_id": "22976572"
},
"item": [
{
"name": "Request-for-Token (Client credentials",
@DinoChiesa
DinoChiesa / example-output.txt
Created August 30, 2024 00:02
Get GCP ID Token for a Service Account, using a JSON-encoded Service Account key
$ node ./getIdTokenWithServiceAccount.js --keyfile ./my-service-account-key-a8ef19f432a9.json --audience https://foo-bar/bam
jwt payload: {
"iss": "[email protected]",
"aud": "https://oauth2.googleapis.com/token",
"iat": 1724976008,
"exp": 1724976068,
"target_audience": "https://foo-bar/bam"
}
assertion: eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzaGVldC13cml0ZXItMUBkY2hpZXNhLWFyZ29saXMtMi5pYW0uZ3NlcnZpY2VhY2NvdW50LmNvbSIsImF1ZCI6Imh0dHBzOi8vb2F1dGgyLmdvb2dsZWFwaXMuY29tL3Rva2VuIiwiaWF0IjoxNzI0OTc2MDA4LCJleHAiOjE3MjQ5NzYwNjgsInRhcmdldF9hdWRpZW5jZSI6Imh0dHBzOi8vZm9vLWJhci9iYW0ifQ.rxVh1-rpXxn67zh94LBDLJm3j2jDqzlXXxV9AqUVtVYDVoKvLy5PH7oBFxrO9RgnhvYkxmbYhMWC5bKmAsaB1J7Y7m3Ch7N2C05kzvle8RHImMsIdW7_nLEISKYgZLmUTQh_oqqgyysmY6C6q0Hadt7yqJ7rZz1W_-wq2fV0hZVTAZLKlUtXefKrwK90Myzo3yZg5tA7GTFUY23b8D4gSEkMxjGR0Ke3PwR4N9SK4FKy8YlYeDsOUGfX2GNmqEIQpD7AfjLBUbnFJeKVL04c8PKXnvUAiffeqfCkwcVpVNoyFexEsB2e9ZUUL2H4A7tRR4cA0DU3OL0dkm3Bhd9qHQ
@DinoChiesa
DinoChiesa / fetch-and-unzip-proxy-apigee.sh
Created April 16, 2024 00:35
Fetch a proxy from Apigee Edge, and unzip the bundle locally
#!/bin/bash
# -*- mode:shell-script; coding:utf-8; -*-
#
# Works with Apigee Edge.
#
proxyname="$1"
[[ -z "$proxyname" ]] && printf "specify a proxy name as argument\n" && exit 1
MISSING_ENV_VARS=()
@DinoChiesa
DinoChiesa / fetch-and-unzip-proxy-apigeex.sh
Last active April 16, 2024 00:37
Fetch an API Proxy from Apigee X or hybrid, and unzip the bundle in the local filesystem
#!/bin/bash
# -*- mode:shell-script; coding:utf-8; -*-
#
# Works with Apigee X/hybrid.
#
proxyname="$1"
[[ -z "$proxyname" ]] && printf "specify a proxy name as argument\n" && exit 1
MISSING_ENV_VARS=()
@DinoChiesa
DinoChiesa / delete-youtube-shorts-watch-history.user.js
Created April 14, 2024 17:05
Tampermonkey script that removes watch history of youtube shorts
// ==UserScript==
// @name autodelete-Youtube-watch-history-shorts - youtube.com
// @namespace youtube
// @description automatically deletes watch history of shorts.
// @match https://myactivity.google.com/product/youtube/
// @grant none
// @version 0.1.0
// @run-at document-end
// @license Apache 2.0
// ==/UserScript==
@DinoChiesa
DinoChiesa / delete-watch-history-shorts.console.js
Last active November 30, 2024 04:38
Remove video shorts from YT Watch History
// orig: https://gist.github.com/miketromba/334282421c4784d7d9a191ca25095c09
// Paste the script into your console on this page: https://myactivity.google.com/product/youtube
const ENABLED = true;
const MIN_DURATION_MS = 1000 * 60 * 1.5; // 1:30 mins
const CHECK_FOR_CONFIRM_INTERVAL = 2000;
let CYCLE_INTERVAL = 1800; // Amount of time in MS to wait between deletion (more likely to fail with a small number)
let wantCycling = true;
const VERY_LONG_DURATION = MIN_DURATION_MS * 10;