Skip to content

Instantly share code, notes, and snippets.

View LoveDuckie's full-sized avatar
🤓
Hacking mainframes

Luc Shelton LoveDuckie

🤓
Hacking mainframes
View GitHub Profile
@v0lkan
v0lkan / kubedump.sh
Created October 24, 2022 01:38
Dump everything in your Kubernetes cluster into folders a YAML files
#!/usr/bin/env bash
# Dumps everything in your Kubernetes cluster into folders a YAML files.
# Use it at your own risk.
set -e
CONTEXT=“$1
if [[ -z ${CONTEXT} ]]; then
@idleberg
idleberg / vscode-macos-context-menu.md
Last active March 14, 2024 02:55
“Open in Visual Studio Code” in macOS context-menu

Open in Visual Studio Code

  • Open Automator
  • Create a new document
  • Select Quick Action
  • Set “Service receives selected” to files or folders in any application
  • Add a Run Shell Script action
    • your default shell should already be selected, otherwise use /bin/zsh for macOS 10.15 (”Catalina”) or later
    • older versions of macOS use /bin/bash
  • if you're using something else, you probably know what to do 😉
@aaronpolhamus
aaronpolhamus / redis_handlers.py
Created August 9, 2020 02:06
task locking with redis + celery
"""Task locking with redis in celery is hard, and good examples are tough to come by. This is the approach that's
worked for me, based on great work that other folks have posted:
* https://breadcrumbscollector.tech/what-is-celery-beat-and-how-to-use-it-part-2-patterns-and-caveats/
* http://loose-bits.com/2010/10/distributed-task-locking-in-celery.html
* https://redis.io/topics/distlock
This isn't polished,but hopefully it's useful. To verify it in our local test env we register the following test task in
our definitions file:
*** definitions.py ***
@oktomus
oktomus / fork-custom-commands.md
Last active January 30, 2024 22:52
Fork custom commands

With custom commands, you are one shortcut away to run commands thanks to the Quick Launch (Ctrl+P, ⌘+P).

Custom commands can be configured in File > Preferences > Custom commands, or by editing the json file custom-commands.json located in AppData/Local/Fork on Windows and ~/Library/Application Support/com.DanPristupov.Fork/custom-commands.json on MacOS.

Please share your own custom commands :)

How to use

Fork commands are posted as comments on this gist. Press CTRL+F to search for commands.

@jonom
jonom / UniqueURLSegmentExtension.php
Created January 30, 2020 19:23
Unique URL Segment extension
<?php
class UniqueURLSegmentExtension extends DataExtension
{
private static $db = array(
'URLSegment' => 'Varchar(255)',
);
public function onBeforeWrite()
{
@Horusiath
Horusiath / Fibers.cs
Created November 24, 2019 22:09
Minimal example of working async method builder
using System;
using System.Runtime.CompilerServices;
using System.Runtime.ExceptionServices;
using System.Threading;
namespace Fibers
{
public struct AsyncFiberMethodBuilder<T>
{
private Fiber<T>? fiber;
@DavidKuennen
DavidKuennen / minimal-analytics-snippet.js
Last active March 28, 2024 01:45
Minimal Analytics Snippet
(function (context, trackingId, options) {
const history = context.history;
const doc = document;
const nav = navigator || {};
const storage = localStorage;
const encode = encodeURIComponent;
const pushState = history.pushState;
const typeException = 'exception';
const generateId = () => Math.random().toString(36);
const getId = () => {
@mramanathan
mramanathan / collectenv.groovy
Last active October 9, 2023 23:12
Jenkins Pipeline: How to run stage(s) in all nodes that match label string ?
import jenkins.model.*
collectBuildEnv = [:]
@NonCPS
def getNodes(String label) {
jenkins.model.Jenkins.instance.nodes.collect { thisAgent ->
if (thisAgent.labelString.contains("${label}")) {
// this works too
// if (thisAagent.labelString == "${label}") {
@luzfcb
luzfcb / installing_pyenv_on_ubuntu_based_distros.md
Last active March 7, 2024 19:25
Quick install pyenv and Python

Tested only on Ubuntu 22.04, KDE Neon User Edition (based on Ubuntu 22.04) and OSX Mojave or higher.

will probably work on other newer versions, with no changes, or with few changes in non-python dependencies (apt-get packages)

NOTE: Don't create a .sh file and run it all at once. It will not work. Copy, paste, and execute each command below manually. :-)

Ubuntu

# DO NOT RUN THIS AS A ROOT USER

SSH into AWS ec2/ Digitalocean droplet/ or else other PAAS, linux machine

  1. Install Docker
$sudo apt install docker.io
$sudo usermod -aG docker $USER

I already installed docker