Skip to content

Instantly share code, notes, and snippets.

View crucialfelix's full-sized avatar
💭
Building product, looking for consulting work

Chris Sattinger crucialfelix

💭
Building product, looking for consulting work
View GitHub Profile
@crucialfelix
crucialfelix / 2023-01-13
Last active October 8, 2023 20:37
Get Chrome history for a single day and create a markdown file summarizing browsing activity
# [[2023-01-13]] log
## URLs
- <strong>www.amazon.de</strong>
- [Prime Video - Video on Demand - Online-Videothek: Filme und Serien online ansehen oder als Einzelabruf online leihen oder kaufen](https://www.amazon.de/Amazon-Video/b/?node=3010075031&ref=atv_surl_aiv&redirectToCMP=1) /Amazon-Video/b/
- <strong>www.youtube.com</strong>
- [Parwal vs Kundru | कुंदरु या परवल | Pointed Gourd Vs Ivy Gourd | Everyday Life # 267 - YouTube](https://www.youtube.com/watch?v=6v4XD9T9-Rg&themeRefresh=1) /watch
- [YouTube](https://www.youtube.com/) /
@crucialfelix
crucialfelix / 0 Intro.md
Last active July 18, 2023 10:14
Get ChatGPT to encourage me TODO things

Given the title of https://frantic.im/todo-for-robots/ I was hoping the article was going to present a robot that would actually do my TODOs.

Which is a great idea; a TODO app that actually does your todos.

As a first step, I took the list of TODO app criticisms (nicely stated in the article) and asked ChatGPT to generate a list of generic strategies.

Then I fed it my "troublesome" list of TODOs and asked it to apply the strategies specifically to each task to encourage me.

These were in some cases helpful, some a bit off, but all of them gave a spark of randomness to the list I've been ignoring and that made it engaging.

@crucialfelix
crucialfelix / push-branches.sh
Last active June 22, 2023 11:43
git force push all feature branches
#!/bin/bash
set -e
# Iterate over all local branches matching feat/
for branch in $(git branch); do
# Skip branches that do not match the feat/* pattern
if [[ ! "$branch" =~ ^feat/.* ]]; then
continue
fi
@crucialfelix
crucialfelix / analytics.js
Last active November 30, 2022 19:05
Google Analytics for Next.js with next/router
/**
* analytics.js;
* Copyright 2019 Chris Sattinger
* MIT license - do as thou wilt
*
* This will send page views on route change to Google Analytics.
* Works with https://nextjs.org/ and https://github.com/fridays/next-routes
**/
import Router from "next/router";
@crucialfelix
crucialfelix / bulk_save.py
Last active October 6, 2022 08:09
Django BulkSave - batches insert, updates, deletes and m2m into the minimum number of queries
import contextlib
import hashlib
import logging
from collections import defaultdict
from decimal import Decimal
from django.db.models import DecimalField, ForeignKey
log = logging.getLogger(__name__)
@crucialfelix
crucialfelix / climatebase-signup-error.md
Created July 8, 2022 07:56
climatebase signup error bug report
#!/usr/bin/env deno run
/**
* Copy markdown posts from org folders to publishing folder
*
* Usage:
* deno run --allow-read --allow-write deno-export-markdown-posts.ts ~/org/blogging/mattermind/ ~/github/crucialfelix.github.io/content/posts
*/
import { join } from "https://deno.land/std@0.122.0/path/mod.ts";
import _ from "lodash";
import { QueryClient } from "react-query";
/**
* optimisticUpdate
*
* A utility function to update the react-query cache with data during
* a mutation.
*
* This clones the current data, uses the supplied function to update that
@crucialfelix
crucialfelix / atom-vim-mode-style.less
Last active September 16, 2021 18:39
Powerline style status bar and cursor styling for Atom vim-mode
// add or import these into your Atom styles.less
/****************** VIM MODE STATUS BAR ****************************************/
// green
@normal-bg: rgb(105, 238, 103);
// blue
@insert-bg: rgb(7, 193, 242);
// yellowish
@visual-bg: rgb(255, 206, 98);
@crucialfelix
crucialfelix / graphql_auth.py
Created August 4, 2017 19:03
django-graphene auth decorator
from decorator import decorator
def _check_auth(args, pred):
_, _, context, _ = args
if not pred(context):
raise Exception("Unauthorized")
@decorator
def is_user(fn, *args, **kwargs):