Skip to content

Instantly share code, notes, and snippets.

version: "3.8"
networks:
app_local:
driver: bridge
services:
redis:
deploy:
mode: global
function docker() {
# source: https://github.com/moby/moby/issues/33673#issuecomment-817117924
if [ "$1" = "service" ] && [ "$2" = "logs" ]; then
shift 2
args=()
follow=
for arg in "$@"; do
if [ "$arg" = "-f" ] || [ "$arg" = "--follow" ]; then follow=1
else args+=( "$arg" )
fi
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
{ cmake
, fetchFromGitHub
, pkg-config
, stdenv
, wxGTK31
}:
let
wxGTK = wxGTK31;
in
stdenv.mkDerivation (finalAttrs: rec {
#!/bin/sh
# Usage: `slurp_align <divisor>`, e.g. `slurp_align 2` will align slurp width + height to multiple of 2
slurp_align() {
slurp | awk "{split(\$0, loc_size); split(loc_size[2], size, \"x\"); print loc_size[1] \" \" (size[1] - (size[1] % ${1:-1})) \"x\" (size[2] - (size[2] % ${1:-1}));}"
}
@pveierland
pveierland / celery_test_util.py
Created September 30, 2022 09:28 — forked from alexgarel/celery_test_util.py
Helper for tests with celery, running tasks in main thread but keeping control on when (alternative to eager)
from functools import partial
from celery.app.task import Task
from celery.app.utils import find_app
class CeleryTestTask(object):
"""A context manager to patch task in order to queue delayed tasks
and eventually run them. This is for tests.
@pveierland
pveierland / jsonb_set_deep.sql
Created September 16, 2022 21:57
jsonb_set_deep
CREATE OR REPLACE FUNCTION jsonb_set_deep(target jsonb, path text[], val jsonb)
RETURNS jsonb AS $$
DECLARE
k text;
p text[];
BEGIN
IF (path = '{}') THEN
RETURN val;
ELSE
IF (target IS NULL) THEN
@pveierland
pveierland / gist:56a4f74eff288724cbec2c0b92420370
Created September 12, 2022 17:18
Google Collaborator Hide Bookmarklet
javascript:(function(){document.head.appendChild(document.createElement("style")).innerHTML='#docs-presence-container,%20g[clip-path=%22url(#punch-page-filmstrip-thumbnail-collaborator-clip-path)%22]{display:%20none%20!important;}'})();
@pveierland
pveierland / .envrc
Created August 22, 2022 17:11
nix-yarn-devshell
use flake
NODE_DIR="${PWD}/.direnv/node"
NODE_MODULES_DIR="${PWD}/node_modules"
export NODE_OPTIONS="--max_old_space_size=65536"
export NODE_PATH="${NODE_DIR}:${NODE_MODULES_DIR}"
export NPM_CONFIG_PREFIX="${NODE_DIR}"
export PATH="${NODE_DIR}/bin:${NODE_MODULES_DIR}/.bin:${PATH}"