Skip to content

Instantly share code, notes, and snippets.

deefdragon / migrate.configmap.yaml
Last active May 5, 2024 09:33
Migrating Kubernetes PVC/PVs from one storage class to another
apiVersion: v1
kind: ConfigMap
# any name can be used; Velero uses the labels (below)
# to identify it rather than the name
name: change-storage-class-config
# must be in the velero namespace
namespace: velero
# the below labels should be used verbatim in your
# ConfigMap.
jamiesanson / ViewLifecycleBinding.kt
Last active April 18, 2023 11:25
Kotlin Property Delegate for Fragment view lifecycle binding
fun <T> Fragment.viewLifecycle(bindUntilEvent: Lifecycle.Event = Lifecycle.Event.ON_DESTROY): ReadWriteProperty<Fragment, T> =
object: ReadWriteProperty<Fragment, T>, LifecycleObserver {
// A backing property to hold our value
private var binding: T? = null
private var viewLifecycleOwner: LifecycleOwner? = null
init {
// Observe the View Lifecycle of the Fragment
sarmbruster /
Last active February 27, 2024 17:56
Run Neo4j in a docker container together with apoc and Bloom installed.
# start a neo4j docker container with apoc and bloom (server variant) configured
# this requires to have
# * curl, unzip and jq being installed
# * having a valid bloom license file
# released under the WTFPL (
# (c) Stefan Armbruster
chibatching / FlowThrottleDebounce.kt
Last active May 9, 2024 08:28
Throttle and Debounce on Flow Kotlin Coroutines
fun <T> Flow<T>.throttle(waitMillis: Int) = flow {
coroutineScope {
val context = coroutineContext
var nextMillis = 0L
var delayPost: Deferred<Unit>? = null
collect {
val current = SystemClock.uptimeMillis()
if (nextMillis < current) {
nextMillis = current + waitMillis
scmx /
Last active May 26, 2024 16:59
Using <details> <summary> expandable content on GitHub with Markdown #details #summary #markdown #gfm #html

How to use <details> <summary> expandable content on GitHub with Markdown

Firstly, what is <details> <summary>?

The HTML Details Element (<details>) creates a disclosure widget in which information is visible only when the widget is toggled into an "open" state. A summary or label can be provided using the <summary> element.


aschmu /
Last active May 2, 2024 12:34
Setting up a PyPi mirror

I) Introduction

Taken from: [!topic/devpi-dev/S-3ioWILTiY]).

We wanted to do some python developpement but we had a problem : our working network is completely isolated from any internet access, only having servers providing services like distribution packages repository mirror and web servers. The question then was how to make a full pypi mirror for usig pip install and pip search.

This is possible to be done using devpi, a web server, bandersnatch and an external hard drive. The idea is to dump all pypi packages with bandersnatch, transfer them to the server with the hard drive,

liminal / build.gradle
Created March 29, 2017 12:50 — forked from DariusL/build.gradle
A gradle task to upload android build artifacts to dropbox
task pushDropbox << {
def outName;
if (System.getenv("GITLAB_CI")) {
outName = "app-debug-${System.getenv("CI_BUILD_REF_NAME")}-SNAPSHOT.apk"
} else {
outName = "app-debug.apk"
leogsilva /
Created April 25, 2016 14:26
How to discover ip from hosts inside terraform.tfstate. Execute --hostfile | more in the directory containing the tfstate file. Code by cisco
#!/usr/bin/env python
# Copyright 2015 Cisco Systems, Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
isaac-jordan /
Last active February 2, 2019 19:58
An updated version of django-premailer that works with Django 1.9 and Python 3.
# Put in 'templatetags' folder in your Django app.
from __future__ import absolute_import
from django import template
from django.utils.encoding import smart_text
from django.contrib.staticfiles import finders
from import staticfiles_storage
from django.conf import settings
from premailer import Premailer