teleren/devto huggingface dataset:
jsonparse library. Search deeply nested JSON based on keys.
Tags: python, showdev, json
Published: 2022-10-02 05:20:43

[jsonparse](https://github.com/ctomkow/jsonparse) is a simple JSON parsing python library. It is used to pull out the values you need from deeply nested JSON based on the keys provided.

The main use-case for building this library is to easily extract values based on your chosen key(s) from deeply nested JSON that is returned from many API's.

### Quick Example

Lets install the library to get going.
```bash
pip install jsonparse
```

Now, some sample python code to show how it works.

1. import the library
2. instantiate the Parser class
3. populate test data
4. call methods to parse data with given key(s)

```python
from jsonparse import Parser

p = Parser()

data = {
	"temperature": "+15 °C",
	"wind": "13 km/h",
	"description": "Partly cloudy",
	"forecast": [{
		"day": "1",
		"temperature": "20 °C",
		"wind": "5 km/h"
	}, {
		"day": "2",
		"temperature": "21 °C",
		"wind": "4 km/h"
	}, {
		"day": "3",
		"temperature": "25 °C",
		"wind": "4 km/h"
	}]
}

p.find_key(data, 'temperature')
['20 °C', '21 °C', '25 °C', '+15 °C']

p.find_key_chain(data, ['forecast', 'wind'])
['5 km/h', '4 km/h', '4 km/h']
```
The previous code shows us calling two different methods. The first one, `find_key()` searches all instances of one key, returning a list of all values.

The second method, `find_key_chain()` searches for the ordered list of keys starting at the first level of data.

Notice, the nested list in the JSON data is handled automatically. The jsonparse library focuses on the user providing the keys to be found.

Another feature of the `find_key_chain()` method is to provide a wildcard `*` to match any.
```python
p.find_key_chain(data, ['forecast', '*'])
['1', '20 °C', '5 km/h', '2', '21 °C', '4 km/h', '3', '25 °C', '4 km/h']
```

This is a quick example of what jsonparse does.

Additional information describing all available methods and additional examples are on [jsonparse github page](https://github.com/ctomkow/jsonparse).

I hope this little library helps someone and any feedback is welcome. Cheers!
In One minute : Node.JS
Tags: node, beginners, tutorial, oneminute
Published: 2022-10-02 05:16:54

Node.js is an open-source, cross-platform, back-end JavaScript runtime environment that runs on a JavaScript Engine (i.e. V8 engine) and executes JavaScript code outside a web browser, which was designed to build scalable network applications.

{% embed https://youtu.be/2Pcxt5K1khk %}

There are thousands of open-source libraries for Node.js, most of them hosted on the npm website. There are multiple developer conferences and events that support the Node.js community, including NodeConf, Node Interactive, and Node Summit as well as a number of regional events.

New major releases of Node.js are cut from the GitHub master branch every six months. Even-numbered versions are cut in April and odd-numbered versions are cut in October. When a new odd version is released, the previous even version undergoes transition to Long Term Support (LTS).

Node.js is supported across a number of cloud-hosting platforms like Jelastic, Google Cloud Platform, AWS Elastic Beanstalk, Joyent and others.
How to Hide/unhide columns with google AppsScript
Published: 2022-10-02 04:50:02

Hello,
I'm a beginer in js & google apps script and trying to get this done to no avail...
I've divided my google sheet in 3 working zones [Range1(E:I), Range2(J:N), Range3(O:S)]
so, I'm trying to write a script to hide and unhide each range in the way that 
if Range1 is showing/unhidden, Range2 & Range3 should be hidden and so should it be for the other 2 ranges...
The script I tried to write(see below) for Range1 returns no error; but won't do anything either

Please your contribution and help will be apprciated...

=============

function hideRange1(){
	var wb= SpreadsheetApp.getActiveSpreadsheet();
	var sh= wb.getActiveSheet();
	var range1= homesh.getActiveRange(E:I);

  if (range1.getA1Notation() !="E1:I") return;

  if(range1=="True"){
    SpreadsheetApp.getActiveSpreadsheet().getActiveSheet().hideColumns(10, 19);

  }
  else if (range1 == "FALSE") {
    SpreadsheetApp.getActiveSpreadsheet().getActiveSheet().showColumns(10, 19);
  }
}
OSD600 - Enhancing Siteit’s markdown features
Tags: opensource, javascript, cli, beginners
Published: 2022-10-02 04:39:27

## About Siteit
Siteit is a CLI tool that can `.txt` and `.md` files into HTML. Read more about Siteit [here](https://dev.to/tdaw/osd600-siteit-is-not-a-citation-tool-5cc9) or check out the [GitHub](https://github.com/SerpentBytes/siteit) repo. 

### New Features
Over a week ago, my peer implemented initial markdown support to bolster Siteit’s existing SSG capabilities. This week, I am to add new markdown features to the repo. 

#### Feature #1
I started by filing an [issue] (https://github.com/SerpentBytes/siteit/issues/14) regarding Siteit’s lack of ability to process `code` blocks. Then I began by implementing its source code and frequently committing it to a new git branch. After thoroughly testing my work, I pushed the [changes](https://github.com/SerpentBytes/siteit/commit/ecb92bdef3ba6522caf95b773cb04cf3a6fe192f) to GitHub.

#### Feature #2
I filed another [issue] (https://github.com/SerpentBytes/siteit/issues/16) regarding Siteit’s lack of ability to add Horizontal Rule in rendered HTML. Then I implemented the code, tested it, and pushed the [changes](https://github.com/SerpentBytes/siteit/commit/575aadd7b2dcc04dbf7f2ddc402afa2dc3501f3b) to GitHub.

### Outcome 
Users can now supply a markdown file containing lines of source code enclosed within a pair of backticks. 
When Siteit is processing markdown files and encounters lines containing an instance of a backtick, followed by some text and one or more backticks, it will accurately render the text within a pair of `<code>…</code>` blocks. Furthermore, instances of `---` in markdown files are rendered as `<hr>` in generated HTML. 

Overall it was fun to practice several features of Git while adding new features to Siteit.
Jupyter notebook logo in Python
Tags: python, chiki1601
Published: 2022-10-02 04:25:55

Hello friends...

I created Jupyter notebook logo using Python...

which is shown below:


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ishs4mzsgoymp9qlkt0b.png)

I am glad that I am implementing Python turtle graphics by making various logos🥳🥳🥳🥳🥳
Reflect for Lab 4
Published: 2022-10-02 03:27:04

# What did I do and how did I do
In Lab 4, I added JSON config file support to Piotr's GitHub repo. Since Python language is arguably an easy-to-use language, most of the commonly used functions are natively supported. Of course, JSON is natively supported so parsing JSON is quite simple; I just used the file reader to read the config file that is passed with the argument '-c' or '--config', and pass this file object to the JSON parser function named ` load() ` in the JSON package and a JSON object will be returned. However, it wasn't actually going that smoothly, I had two issues in coding this lab. 

## Problem 1

The first one was with the JSON parsing function. There was a JSON object returned by ` JSON.load() ` that I mentioned earlier, although it truly returned a JSON map object after a successful parsing, the return type of JSON map object is a generic object which means the IDE can't infer what functions can be called onto the object and which function I can make a call on to check if an element exists in this JSON map object. I tried to google it, but nothing seemed to be useful. When I started to feel desperate, I realized maybe I can add a breakpoint to that JSON map object to see what it looks like in runtime. Luckily this solution worked. I noticed there was a function named ` __contains__ `(weird name..), I tried to make a call on it and it finally checked if the passed key exists in the JSON map.

## Problem 2

Another issue was the way how Piotr coded the argument parsing code was hard-cording, which means it only accepts the argument in the designed sequence, for example, if I make the argument passing sequence ` -i ./input -c ./config.json` work, then if I pass ` -c ./config.json -i ./input `, only ` -i ./input ` will be taken. Apparently, this doesn't meet the requirement. To fix it, I refactored the code of this part and it worked well in the end.

## My careless self..

Also, this shouldn't be counted as an issue, but I forgot to update my forked project before starting working on it, I tried to create a PR on my forked project to merge back the new update after I came to the realization that I had not done so. This time I wasn't that lucky, I had to deal with 3 conflicts since the part I had rewritten overlapped with Piotr's update.  Resolving conflict wasn't very pleasant, but still, I did it.

## Something makes my life easier

From this lab, the useful thing I've learned is the Draft Pull Request because it's very useful since it can be used as a way to create a pre-created Pull Request without actually posting it for review. 

## Don't be sorry be better

The biggest lesson I've learned is don't even think about coding before you've made sure that the your base branch's code is up-to-date, otherwise, have fun resolving conflicts.
Find All Anagrams in a String
Tags: javascript, leetcode
Published: 2022-10-02 03:13:27

Given two strings s and p, return an array of all the start indices of p's anagrams in s. You may return the answer in any order.

An Anagram is a word or phrase formed by rearranging the letters of a different word or phrase, typically using all the original letters exactly once.

 

Example 1:

Input: s = "cbaebabacd", p = "abc"
Output: [0,6]
Explanation:
The substring with start index = 0 is "cba", which is an anagram of "abc".
The substring with start index = 6 is "bac", which is an anagram of "abc".


Approach 1: 
```js
var findAnagrams = function (s, p) {
  if (!s || s.length < p.length) return [];

  // Result is the output array that stores start indices,
  // freqMap maps each character in p to its count

  const result = [],
    freqMap = {};
  let count = 0,
    start = 0,
    end = 0;

  for (let char of p) {
    if (freqMap[char] === undefined) count++;
    freqMap[char] = (freqMap[char] || 0) + 1;
  }

  // Iterate over s using two pointers (start and end)
  while (end < s.length) {
    let char = s[end]; // The 'current' character
    // If the current character exists in the frequency map, then decrement it's count
    // and if the count reaches 0, then we know we got the right # of occurences for it
    if (freqMap[char] !== undefined) {
      freqMap[char] -= 1;
      if (freqMap[char] === 0) count--;
    }

    end++;

    // Once we reach count = 0, then check to see if it is
    // a valid anagram and move the window to the right
    while (count === 0) {
      let temp = s[start];
      if (freqMap[temp] !== undefined) {
        freqMap[temp] += 1;
        if (freqMap[temp] > 0) count++;
      }

      // If it is valid, then add the start index to the result
      if (end - start === p.length) result.push(start);
      start++;
    }
  }

  return result;
};

```

Approach 2: 

```js
var findAnagrams = function (s, p) {
  let sCount = new Array(26).fill(0);
  let pCount = new Array(26).fill(0);

  let result = [];

  for (let i = 0; i < p.length; i++) {
    sCount[s.charCodeAt(i) - 97]++;
    pCount[p.charCodeAt(i) - 97]++;
  }

  if (matching(sCount, pCount)) result.push(0);

  for (let i = p.length; i < s.length; i++) {
    // remove letter count which is not in window
    sCount[s.charCodeAt(i - p.length) - 97]--;
    // add letter count
    sCount[s.charCodeAt(i) - 97]++;

    if (matching(sCount, pCount)) result.push(i - p.length + 1);
  }

  return result;
};

const matching = (arr1, arr2) => {
  for (let i = 0; i < arr1.length; i++) {
    if (arr1[i] !== arr2[i]) return false;
  }
  return true;
};


```
introducing T-RY method , logging per category vs time Rhythm
Tags: productivity, vue, javascript, github
Published: 2022-10-02 02:32:31


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mf7a9bvmbxeat0bre5ar.png)

**INTRO :**
What usually happens with most category-based time trackers is that we accumulate a big set of time data that is not very useful, it feels like noise and random data.

If you asked what is the most persistent general pattern that is causing delays or unnecessary complexity in our projects ?, what are the top three things that could be done to complete steps faster? What work should you delegate ?

## and most importantly why some parts of our work are more complicated than others?


The data tracked using basic standard filtering is not very informative for most developers. 

This is how the idea of **per Rhythm** tracking came from 

**Key insight : Hours are not equal .**

Instead of _absolute_ thinking that treats every point in time as equal , we shift to _relativistic_ thinking per Rhythm or intensity of different chunks of time, this is especially useful for programming since the flow of the process itself is not very predictable .

[This youtube video  demonstrate this in action for a Vue.js solar project ](https://www.youtube.com/watch?v=OpHJD3ydX2o)

If you fast forward to minute 10:12 , there is five stats calculated by the app engine 

Red = most complex 
Grey = no note 
Yellow = average / okay 
Green = in flow 
Blue = easiest /delegable

we currently set the rhythms is to focus on filtering most complex and easiest points in our time, we move away from calendar deadline time predictions,  and focus on capturing **what is happening now.**

The video example shows us that only 0.078% of 28.75 hours  is actually the most important, the red dots highlight the complex parts.

That is roughly two hours out of 28hours 45 minutes, again **Hours are not Equal**.

**On Data storage :**

Minimalist release of the system is optimized to allow users to have more control and privacy of their time data , the data structure is set to encourage easy json export, and reset of logs.

We aim to progressively adjust the system to work offline, and for now we are focusing on gathering constructive feedback from our most enthusiastic users through the web release.


**who should use the system ?**

The usefulness of the system increases with the complexity of the project and with more combined hours, if you are working on something simple , then the app would be too much for you.

but if you are working on something complex, and like to see patterns within a year worth of work, and be prepared for increasing work demands, and like to make higher level decisions on what to delegate / automate.

compare the efficiency of different methods and tools.

and use a system that allow you to experiment, and possibly build things on top of JSON data.

then : 
**welcome to the future!**

[This is our signup list]( https://waitlist.time-ry.io/ ).
newbie in training
Tags: beginners, codenewbie
Published: 2022-10-02 01:37:56

hello there!

This post begins my journey and deep dive into learning about coding, web developing, code reviewing and a bunch more of -ings that I can't think off the top of my head. I genuinely will put my best foot forward and keep my mind open for new opportunities to learn and expand my knowledge about this field.

This has been brought to fruition to my understanding, albeit a bit stubborn, that I cannot continue working my self to the brink of exhaustion and think it's a sustainable path in life. For context I have been working 12 hour shifts at my job consistently for the better part of 4-5 years and I'm at a standstill. I have always been headstrong and let my actions speak rather than my words. And through my work ethic and determination I have been rather successful in some regards but also am falling short of where I want to be at. I don't wanna reach a brick wall in a sense where I am not able to keep learning and succeeding in life. This journey will be an effort to keep true to that as it will help me reach a life where I can have the enjoyment of free time and have energy to pursue the things I have a passion for.

{% embed https://youtu.be/BODHsU3hDo4 %}


The following video was first brought to my attention by my high school physics teacher. It was one of those things that might've bore some people to death and it was really cliché for a teacher to show a inspirational video to a bunch of bright-eyed 15-16 year old's but for me it really meant a lot. I didn't really excel in class but through the constant badgering by the teacher I began to realize how much effort he put into his lessons. As the years went on and I kept ending in his classes I realized he wasn't like most, through constant tales about his raising and his diligent efforts in the classroom he was able to reach a point in his life where he wanted for nothing. His character was a step above the rest as shown through his words and actions. An example, He gave those who stuck with him through his AP Physics Class, from regular physics and honors, a little picture frame with a brick wall because he genuinely believed in all of his students that they'll do great.

This post may be the only post I dedicate to someone but Mr.Cartegna I hope you'll realize that you gave this kid some sort of hope. I'm going to break through some brick walls to reach sucesss :D .
2 Way Syncing between 2 Servers using lsyncd
Tags: lsync, 2waysync
Published: 2022-10-01 22:58:04

## Requirements
1. At least 2 servers
2. **lsyncd** installed on both servers
3. ssh access between both servers

## Assumptions
1. username for both servers is: **forge**
2. IP for server #1: **111.111.111**
3. IP for server #2: **222.222.222**
4. Folder to sync between the 2 servers (can be different, this example both same path and directory): **syncro**
5. SSH key (can be different, this example same key name): **syncro_key**

## Setup
This setup is for server #1, to setup server #2 it's the same. Just see the comments in the code in step #4
1. Install **lsyncd** 
  - `sudo apt install lsyncd`
2. Create lsyncd log folder 
  - `sudo mkdir /var/log/lsyncd`
3. Create log and status files 
  - `sudo touch /var/log/lsyncd/lsyncd.{log,status}`
4. Create config file
  - `sudo nano /etc/lsyncd.conf.lua`
  - **Note**: Anything after `--` are comments in the code

    ```lua
    -- server #1 setup
    settings {
          logfile = "/var/log/lsyncd/lsyncd.log", -- location of log file created in step 3
          statusFile = "/var/log/lsyncd/lsyncd.status", -- location of status file created in step 3
    }
  
    targetlist = {
        "forge@222.222.222:/home/forge/syncro", -- server #2 will have target forge@111.111.111
    }
  
    for _, server in ipairs( targetlist ) do
        sync {
            default.rsync,
            source = "/home/forge/syncro", -- folder which to sync from
            target = server,
            delete = 'running',
            rsync = {
                rsh = "ssh -i /home/forge/.ssh/syncro_key", -- ssh key
                update = true,
                archive = true,
                compress = true,
            }
        }
    end
    ```
5. Start the lsyncd service
  - `sudo service lsyncd start`
6. Set the config lsyncd service will use 
  - `sudo lsyncd /etc/lsyncd.conf.lua`
  - **IMPORTANT** When the server restarts run this again

## Notes
There is a limit to how many files/folders that can be watched
- To check the current limit: 
  - `cat /proc/sys/fs/inotify/max_user_watches`
- To permanently alter the limit : (500000 is an example number)
  - `sudo sysctl fs.inotify.max_user_watches=500000`
New Video: Coding Shorts - Static Site Generation with Eleventy
Tags: ssg, webdev, 11ty
Published: 2022-11-13 07:22:20

---
title: New Video: Coding Shorts - Static Site Generation with Eleventy
published: true
date: 2022-10-02 00:00:00 UTC
tags: 
  - SSG
  - webdev
  - 11ty
canonical_url: https://wildermuth.com/2022/10/02/coding-shorts-static-site-generation-11ty/
cover_image: "https://wilderminds.blob.core.windows.net/img/2022/10/02/cover.jpg"
---

For some of my personal sites that aren’t the dynamic, I’ve moved them from [ASP.NET](http://asp.net/) to static site generation. I find it the right solution for a myriad of smaller websites. In this video I’ll show you how you can do it with Eleventy (@11ty):

<iframe src="https://www.youtube.com/embed/JiC9JWRsfcE" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen=""></iframe>

> [Subscribe to my YouTube Channel](https://shawnl.ink/yt)

[![Creative Commons License](http://i.creativecommons.org/l/by-nc-nd/3.0/88x31.png)](http://creativecommons.org/licenses/by-nc-nd/3.0/)

 This work by [Shawn Wildermuth](http://wildermuth.com) is licensed under a [Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License](http://creativecommons.org/licenses/by-nc-nd/3.0/).  
 Based on a work at [wildermuth.com](http://wildermuth.com).

* * *

If you liked this article, see Shawn's courses on [Pluralsight](http://shawnw.me/pscourses).
Enjoy your weekends
Tags: qa, softwaredeployment, incidentresponse
Published: 2022-11-09 11:20:49

---
title: Enjoy your weekends
published: true
date: 2022-10-02 00:00:00 UTC
tags: qa,softwaredeployment,incidentresponse
canonical_url: https://jhall.io/archive/2022/10/02/enjoy-your-weekends/
cover_image: https://jhall.io/images/bn-picnic-blanket.jpg
---

Happy Sunday!

It’s 9:30pm where I live as I write this. I spent my Sunday with my toddler, roughhousing in the living room. When he took his nap, I spent a couple hours relaxing with the PlayStation, while my wife organized some things for the baby we’re expecting in a month. Later the three of us took a walk around the neighborhood before stopping by the neighborhood restaurant for dinner.

You know what I didn’t do?

I didn’t fix any customer outages. I didn’t debug any mysterious behavior. I didn’t revert any bad merges. I didn’t even check my work e-mail.

Not every Sunday is as relaxing. When I started with this team back in June, almost every weekend involved fire-fighting. We still have a few of those. But they’re increasingly more rare, as we’re improving our deployment process, and getting better at building quality software.

How does your average weekend look?

* * *
_If you enjoyed this message, [subscribe](https://jhall.io/daily) to <u>The Daily Commit</u> to get future messages to your inbox._