Skip to content

Instantly share code, notes, and snippets.

View xamebax's full-sized avatar
🐢

Marta Paciorkowska xamebax

🐢
View GitHub Profile
@xamebax
xamebax / .bashrc
Last active October 11, 2020 14:19
Parts of my .bashrc responsible for the prompt
# get current branch in git repo
function parse_git_branch() {
BRANCH=`git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'`
if [ ! "${BRANCH}" == "" ]
then
STAT=`parse_git_dirty`
echo "( ${BRANCH}${STAT} )"
else
echo ""
fi
@xamebax
xamebax / keybase.md
Created September 25, 2018 08:05
keybase.md

Keybase proof

I hereby claim:

  • I am xamebax on github.
  • I am paciorkowska (https://keybase.io/paciorkowska) on keybase.
  • I have a public key ASBAE3EJFub_1PRGlBt3xDJsiWnzWORKdhsf4UYKOfCxtwo

To claim this, I am signing this object:

@xamebax
xamebax / json2path.rb
Last active December 23, 2015 08:39
require 'json'
def pretty_json(vv, prefix='$')
if vv.is_a?(Array)
vv.each_with_index do |i, v|
pretty_json(v, "#{prefix}[#{i}]")
end
elsif vv.is_a?(Hash)
vv.each do |k, v|
pretty_json(v, "#{prefix}.#{k}")
@xamebax
xamebax / json2path.py
Last active December 23, 2015 06:39 — forked from mpasternacki/json2path.py
#!/usr/bin/env python
import json
import sys
def pp(vv, prefix='$'): # vv = array w/ JSON data, prefix = what's printed at the start of each line
if isinstance(vv, (list,tuple)): # if vv is a list/tuple - an Array in Ruby
for i, v in enumerate(vv): # vv being enumerated means each array element
# is being given an "index", so (a, b, c) => [(0, a), (1, b), (2, c)]...
# so for each "index" & "value" pair of the enumerated vv array...