Skip to content

Instantly share code, notes, and snippets.

@ReallyLiri
ReallyLiri / krsync.sh
Created July 11, 2019 08:57
KubernetesRsync
#!/bin/bash
# USAGE: ./krsync.sh <src> <dst> , with either src/dst dir pointing to a pod (of the format 'pod:/<path>')
# Check if we are running within --rsh already (remote shell)
if [ -z "$KRSYNC_STARTED" ]; then
# not using --rsh
export KRSYNC_STARTED=true
exec rsync --blocking-io --rsh "$0" -a --progress --stats $@ # re-activate the script as remote shell
fi
@ReallyLiri
ReallyLiri / ServiceCollectionExtensions.cs
Last active August 16, 2024 14:36
ASP.NET dependency injection extensions
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using Microsoft.AspNetCore.Routing;
using Microsoft.Extensions.DependencyInjection;
namespace ServiceCollectionExtensions
{
public static class ServiceCollectionExtensions
@ReallyLiri
ReallyLiri / gist:82082e430569a013c5d3cdac6aec48e4
Last active February 22, 2021 08:15
MetricsLoggingInterceptor.cs
using System;
using System.Collections;
using System.Collections.Concurrent;
using System.Diagnostics;
using System.Linq;
using System.Text;
using Castle.DynamicProxy;
using Microsoft.Extensions.Logging;
using Scrutor;
@ReallyLiri
ReallyLiri / ModuleFilter.py
Last active July 13, 2023 11:39
ModuleFilter.py
class ModuleFilter(logging.Filter):
"""
Filters any logger from outside `root_path` to levels ERROR and above
"""
def __init__(self, root_path: str, *args, **kwargs):
self.root_path = root_path
super.__init__(*args, **kwargs)
def filter(self, record: logging.LogRecord) -> bool:
@ReallyLiri
ReallyLiri / Jira-Disable-Inline.js
Last active February 15, 2024 11:35
Tampermonkey scripts
// ==UserScript==
// @name Jira-Disable-Inline
// @namespace http://tampermonkey.net/
// @version 0.1
// @description disable jira issue click-to-edit (only applies few moments after page load, so you can have some grace time if you actually wanna edit)
// @author You
// @match https://*.atlassian.net/browse/*
// @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant none
// ==/UserScript==
@ReallyLiri
ReallyLiri / stringer.go
Last active August 28, 2024 10:52
stringer generator
package main
import (
"go/ast"
"go/format"
"go/parser"
"go/token"
"log"
"os"
"strings"