Skip to content

Instantly share code, notes, and snippets.

View sldenazis's full-sized avatar
🧟

Santiago LD sldenazis

🧟
  • Buenos Aires
View GitHub Profile
@sldenazis
sldenazis / ktx.sh
Created January 31, 2025 12:52
Basic kubectl config get|use-context wrapper
function ktx() {
# Current context
local current_context=$(kubectl config current-context)
if [[ "${1}" == "get" ]] || [[ "${1}" == "set" ]]; then
# Get kube contexts list
declare -a contexts=($(kubectl config get-contexts -o name))
# Map contexts to an associative array
declare -A context_map
function is_in_array {
# Return 0 if element is found, 1 if not
if [[ $# -lt 2 ]]; then
echo "Usage: $FUNCNAME string array" >&2
else
local element=${1} i=""
shift
declare -a list=$@
for i in ${list[@]}; do
if [[ $i == $element ]]; then
---
- hosts: all
become: yes
vars:
remote_path: /etc/grafana
local_path: ./
tasks:
@sldenazis
sldenazis / gradle.eselect
Created August 31, 2017 15:24
Eselect module for gradle-bin
# Copyright 1999-2017 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2
# $Id: $
DESCRIPTION="Manage gradle symlinks"
MAINTAINER="[email protected]"
SVN_DATE='20170830'
VERSION=${SVN_DATE}
find_targets() {
local f
@sldenazis
sldenazis / selectallstars.user.js
Last active May 27, 2017 16:20
Greasemonkey's script for opr.ingress.com that allows you to select all the stars at once.
// ==UserScript==
// @name selectallstars
// @namespace selectallstars
// @include https://opr.ingress.com/recon
// @version 0.2
// @grant none
// ==/UserScript==
var newButtons = document.createElement('div');
@sldenazis
sldenazis / stopjumpopr.user.js
Created May 15, 2017 19:40
greasemonkey script for prevent opr.ingress.com to jump after it is visually unique section
// ==UserScript==
// @name stopjumpopr
// @namespace stopjumpopr
// @include https://opr.ingress.com/*
// @version 1
// @grant none
// ==/UserScript==
document.body.innerHTML= document.body.innerHTML.replace(/answerCtrl\.goToLocation\(\'streetViewHeader\'\)/g,"");
#!/usr/bin/python
from xml.dom.minidom import parse
import argparse
import sys
import re
import os
class PomEditor():
@sldenazis
sldenazis / clean_rundeck.sh
Created March 29, 2017 15:45
Clean execution logs for rundeck (with mysql database)
#!/bin/bash
export PATH=/bin:/sbin:/usr/bin:/usr/sbin
function getFileConfig()
{
local file_config="/etc/rundeck/rundeck-config.properties"
echo ${file_config}
}
@sldenazis
sldenazis / ruleset.py
Created March 16, 2017 20:07
Working version
#!/bin/env python
class RuleSet():
def __init__(self):
self._newRuleSet()
self.is_coherent = True
def _newRuleSet(self):
self.ruleset = {}
18,19c18,23
< #self.ruleset[option] = {'depends': [], 'conflict': []}
< self.ruleset[option] = {'depends': [], 'conflict': [], 'enabled': False}
---
> self.ruleset[option] = {
> 'depends': [],
> 'conflict': [],
> 'enabled': False,
> 'enabled_by_dependency': False
> }