Skip to content

Instantly share code, notes, and snippets.

View wesley-dean's full-sized avatar

Wes Dean wesley-dean

View GitHub Profile
@Natim
Natim / ini2json.py
Created January 11, 2013 10:21
Convert an ini configuration file into a json file
# -*- coding: utf-8 -*-
import json
import sys
from ConfigParser import (ConfigParser, MissingSectionHeaderError,
ParsingError, DEFAULTSECT)
class StrictConfigParser(ConfigParser):
def _read(self, fp, fpname):
@jrudenstam
jrudenstam / get-field-recursive.php
Created November 19, 2013 20:11
Will get value from an Advanded Custom Field recursively. Meaning traversing up until value is found.
<?php
/*
* Get ACF fields recursivly
* (if post does not have value look upward until found)
*/
function get_field_recursive( $field, $level_id = null ) {
// If no ID is passed set to post ID
$level_id = $level_id == null ? get_queried_object_id() : $level_id;
@olih
olih / jq-cheetsheet.md
Last active June 22, 2024 18:30
jq Cheet Sheet

Processing JSON using jq

jq is useful to slice, filter, map and transform structured json data.

Installing jq

On Mac OS

brew install jq

@dafta
dafta / .sh
Last active October 11, 2020 14:47
ssh with .ssh/sshrc forwarding
# Forwarding your .ssh/sshrc file and sourcing it as .bashrc
# A function sudoi is defined on the remote machine, used
# instead of sudo -i, to run a shell as the specified user,
# or root as default, and source the local .ssh/sshrc.
function ssh() {
tmprc=$(/usr/bin/ssh "$@" "mktemp" 2>/dev/null)
rsync ~/.ssh/sshrc "$1:$tmprc" >/dev/null 2>&1
echo "function sudoi() { sudo -u \"\${1:-root}\" bash --rcfile \"$tmprc\"; }" | /usr/bin/ssh "$@" "cat - >> \"$tmprc\"" >/dev/null 2>&1
/usr/bin/ssh -t "$@" "chmod a+r \"$tmprc\"; bash --rcfile \"$tmprc\" ; rm \"$tmprc\""
@wesley-dean
wesley-dean / .groovylintrc.json
Created November 8, 2021 17:40
Mega-Linter on Jenkins
{
"extends": "recommended",
"rules": {
"convention.CompileStatic": "off",
"convention.NoDef": "off",
"convention.VariableTypeRequired": "off",
"convention.MethodReturnTypeRequired": "off",
"groovyism.ExplicitCallToEqualsMethod": "off",
"groovyism.GStringExpressionWithinString": "off",
"naming.VariableName": "off",