Skip to content

Instantly share code, notes, and snippets.

"""Extract nested values from a JSON tree."""
def json_extract(obj, key):
"""Recursively fetch values from nested JSON."""
arr = []
def extract(obj, arr, key):
"""Recursively search for values of key in JSON tree."""
if isinstance(obj, dict):
@vasanthk
vasanthk / System Design.md
Last active July 24, 2024 05:07
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
@freakboy3742
freakboy3742 / rapid-mobile-development.rst
Last active December 8, 2022 11:22
Rapid Mobile Application Development with Python

Rapid mobile application development with Python

While there are examples of Python-based apps in mobile App stores, the knowledge of how to actually create a mobile app in Python hasn't been well documented, or simplified for mass use - until now.

In this talk, Dr Russell Keith-Magee will demonstrate a collection of tools from the BeeWare Project that enable you to build a cross-platform mobile app using Python in a matter of minutes.

Audience

@magnetikonline
magnetikonline / README.md
Last active June 22, 2024 13:35
Bash string manipulation cheatsheet.

Bash string manipulation cheatsheet

Assignment
Assign value to variable if variable is not already set, value is returned.

Combine with a : no-op to discard/ignore return value.
${variable="value"}
: ${variable="value"}
@parzonka
parzonka / installantoncentos.sh
Created December 9, 2013 14:26
How to install ant on centos
# download and install
antversion=1.7.1
wget http://archive.apache.org/dist/ant/binaries/apache-ant-${antversion}-bin.tar.gz
sudo tar xvfvz apache-ant-${antversion}-bin.tar.gz -C /opt
sudo ln -sfn /opt/apache-ant-${antversion} /opt/ant
sudo sh -c 'echo ANT_HOME=/opt/ant >> /etc/environment'
sudo ln -sfn /opt/ant/bin/ant /usr/bin/ant
# check installation
ant -version
@ksafranski
ksafranski / expecting.md
Last active November 11, 2023 23:00
Basic principles of using tcl-expect scripts

Intro

TCL-Expect scripts are an amazingly easy way to script out laborious tasks in the shell when you need to be interactive with the console. Think of them as a "macro" or way to programmaticly step through a process you would run by hand. They are similar to shell scripts but utilize the .tcl extension and a different #! call.

Setup Your Script

The first step, similar to writing a bash script, is to tell the script what it's executing under. For expect we use the following:

#!/usr/bin/expect