Skip to content

Instantly share code, notes, and snippets.

@verespej
verespej / tiny-img-data.html
Created January 11, 2022 16:09
Smallest img data:image data
<html>
<body>
<div>
SVG:
<img src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA1MCA1MCI+PHBhdGggZD0iTTIyIDM4VjUxTDMyIDMybDE5LTE5djEyQzQ0IDI2IDQzIDEwIDM4IDAgNTIgMTUgNDkgMzkgMjIgMzh6Ii8+PC9zdmc+" />
</div>
<div>
PNG:
<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAACklEQVR42mMAAQAABQABoIJXOQAAAABJRU5ErkJggg==" />
</div>
@verespej
verespej / commands.txt
Last active January 5, 2022 11:41
Uncommon, but useful git commands
# Diff two arbitrary files in the file system
git diff --no-index <file-path-1> <file-path-2>
# Get the dates of stashes
git stash list --date=local
@verespej
verespej / delete_s3_versioned_bucket.py
Last active June 22, 2020 13:18
Delete an S3 versioned bucket (including all versioned objects within it)
#!/usr/bin/env python
# S3 versioned buckets with many objects can be difficult to delete due to
# (1) S3 using delete markers instead of deleting objects and
# (2) web console and cli operations time out when the bucket has many versioned objects.
# This script delete all versioned objects from a bucket, then deletes the bucket.
import boto3
@verespej
verespej / list_owned_objects_for_role.sql
Created May 20, 2020 00:39
List a postgresql role's owned objects
-- From https://stackoverflow.com/questions/44835028/postgresql-get-effective-permissions-for-specified-roles-on-each-object-type
WITH
databases AS (
SELECT unnest('{db_name}'::text[]) AS dbname
),
roles AS (
SELECT unnest('{role_id}'::text[]) AS rname
),
permissions AS (
@verespej
verespej / cleanup_docker_commands.sh
Last active November 23, 2023 04:45
Various commands for cleanup up docker
docker rm $(docker ps -aqf status=exited) # May want to also run for 'created' containers
docker rmi $(docker images -qf dangling=true)
docker volume rm $(docker volume ls -qf dangling=true)
# Untagged images
docker rmi $(docker images | grep "^<none>" | awk '{print $3}')
@verespej
verespej / app.js
Last active December 29, 2015 05:09
Scrape course description from UW CSE course page and store as JSON. Implemented using node.js.
var cheerio = require('cheerio');
var http = require('http');
var fs = require('fs');
var url = require('url');
var pageUrl = 'http://www.washington.edu/students/crscat/cse.html';
http.get(pageUrl, function(res) {
res.setEncoding('utf8');
var data = '';