Can you bring toys back home?

Tonight, I was reading Puss in the Boots bedtime story to Ayden. Story begins with Old Miller dying.

Ayden asked me if people die in real life. I am not ready for this conversation but I also didn’t want to lie. I said yes and hoped we can move on quickly.

Ayden’s eyes turned teary. In crying voice, he asked, “Why?”

“It just the way it is.” I said.

I watched him as he processed this new information about life. He has seen dead worms, read stories with death in it, but never connected that with people.

Eyes still watery, voice slightly shaky, he asked again, “why do people die?”

I really didn’t know how to respond. I winged it, badly.

He asked, “Do they fix you back to normal?”

One last try to be stoic and I explained that death is normal part of life. There was nothing to be fixed.

“What if you want to play?” he asked with a lot of concern in his voice.

Religion to rescue. I tell him about heaven and how there are all the toys there. He is feeling better, he even smiles when I tell him about all the monster trucks in the heaven. We spent a lot of time discussing heaven and how much fun it is. How we live and play there forever.

“Can you bring toys back home?” he asked.


Avicii - Wake Me Up

Lyrics

Feeling my way through the darkness
Guided by a beating heart
I can't tell where the journey will end
But I know where to start
They tell me I'm too young to understand
They say I'm caught up in a dream
Well life will pass me by if I don't open up my eyes
Well that's fine by me
So wake me up when it's all over
When I'm wiser and I'm older
All this time I was finding myself, and I
Didn't know I was lost
So wake me up when it's all over
When I'm wiser and I'm older
All this time I was finding myself, and I
Didn't know I was lost
I tried carrying the weight of the world
But I only have two hands
Hope I get the chance to travel the world
But I don't have any plans
Wish that I could stay forever this young
Not afraid to close my eyes
Life's a game made for everyone
And love is a prize
So wake me up when it's all over
When I'm wiser and I'm older
All this time I was finding myself, and I
Didn't know I was lost
So wake me up when it's all over
When I'm wiser and I'm older
All this time I was finding myself, and I
I didn't know I was lost
I didn't know I was lost
I didn't know I was lost
I didn't know I was lost
I didn't know

Source: LyricFind

Songwriters: Egbert Nathaniel Dawkins / Michael Aaron Einziger / Tim Bergling


Junoon - Main Kaun Hoon

Lyrics

Jab aasman girnay lagtay hain
Aur zameen jalnay lagtee hai
Aik chhupa huwa khwaab janam leta hai
Sehraon main awaaz aati hai

Mein kaun hoon
Tum kaun ho
Mein kaun hoon
Tum kaun ho
Gham geen hoon
Aur tum mazloom ho

Jab bhook nachtee gaatee hai
Aur nafratein jashan manatein hain
Aik chhupa huwa khwaab janam leta hai
Sehraon main awaaz aati hai

Mein kaun hoon
Tum kaun ho
Mein kaun hoon
Tum kaun ho
Majboor hoon
Aur tum bay naam ho

Aik chhupa huwa khwaab janam leta hai
Sehraon main awaaz aati hai

Mein kaun hoon
Tum kaun ho
Mein kaun hoon
Tum kaun ho
Gham geen hoon
Aur tum mazloom ho

Tum kaun ho
Mein kaun hoon
Tum kaun ho
Gham geen hoon
Aur tum bay naam ho
Tum kaun ho
Mein kaun hoon
Tum kaun ho
Majboor hoon
Aur tum bay naam ho

Poet: Sabir Zafar


Swedish House Mafia ft. John Martin - Don't You Worry Child

Lyrics

There was a time
I used to look into my father's eyes
In a happy home
I was a king, I had a golden throne
Those days are gone
Now they're memories on the wall
I hear the songs from the places where I was born
Up on a hill across the blue lake
That's where I had my first heartbreak
I still remember how it all changed
My father said
Don't you worry, don't you worry, child
See heaven's got a plan for you
Don't you worry, don't you worry now
Yeah
Don't you worry, don't you worry now
Yeah
Don't you worry, don't you worry now
Yeah
There was a time
I met a girl of a different kind
We ruled the world
I thought I'd never lose her out of sight
We were so young
I think of her now and then
I still hear the songs reminding me of a friend
Up on a hill across the blue lake
That's where I had my first heartbreak
I still remember how it all changed
My father said
Don't you worry, don't you worry, child
See heaven's got a plan for you
Don't you worry, don't you worry now
Yeah
Oh-oh-oh-oh-oh-oh-oh
Oh-oh-oh-oh-oh-oh-oh
Oh-oh-oh-oh-oh-oh-oh
Oh-oh-oh-oh-oh-oh-oh
Oh-oh-oh-oh-oh-oh-oh
Oh-oh-oh-oh-oh-oh-oh
Oh-oh-oh-oh-oh-oh-oh
See heaven's got a plan for you
See heaven's got a plan for you
See heaven's got a plan for you
Don't you worry, don't you worry, child
See heaven's got a plan for you
Don't you worry, don't you worry now
Yeah
Oh-oh-oh-oh-oh-oh-oh
Oh-oh-oh-oh-oh-oh-oh
Oh-oh-oh-oh-oh-oh-oh
Yeah

Source: Musixmatch Songwriters: Steve Angello / Sebastian Ingrosso / Axel Hedfors / Martin Lindstrom / Michel Zitron / John Martin


Ask HN: What book changed your life?

Saw this post on Hacker’s News. A lot of interesting books to read.

Book Links
The Stormlight Archive (series) by Brandon Sanderson https://news.ycombinator.com/item?id=30739083
Jacob’s Room, Virginia Woolf https://news.ycombinator.com/user?id=thatjoeoverthr
Dune
Man’s Search For Meaning
How to Practice: The Way to a Meaningful Life - the Dalai Lama
Surely you’re joking Mr. Feynman
Gödel, Escher, Bach: an Eternal Golden Braid
Debt: The First 5000 Years
Crucial Conversations: Tools for Talking when Stakes are High by Kerry Patterson
Difficult Conversations: How to Discuss What Matters Most

Luther Vandross - Dance With My Father

Lyrics

Back when I was a child
Before life removed all the innocence
My father would lift me high
And dance with my mother and me and then
Spin me around till I fell asleep
Then up the stairs he would carry me
And I knew for sure I was loved
If I could get another chance
Another walk, another dance with him
I'd play a song that would never ever end
How I'd love, love, love to dance with my father again, ooh
When I and my mother would disagree
To get my way I would run from her to him
He'd make me laugh just to comfort me, yeah, yeah
Then finally make me do just what my momma said
Later that night when I was asleep
He left a dollar under my sheet
Never dreamed that he would be gone from me
If I could steal one final glance, one final step
One final dance with him
I'd play a song that would never ever end
'Cause I'd love, love, love to dance with my father again
Sometimes I'd listen outside her door
And I'd hear how my mother cried for him
I pray for her even more than me
I pray for her even more than me
I know I'm praying for much too much
But could you send back the only man she loved?
I know you don't do it usually
But dear Lord she's dying to dance with my father again
Every night I fall asleep and this is all I ever dream

Wheels and Engine Sound

Last year, we took Ayden to monster truck show. We didn’t know how loud these trucks can be. So we bought ear protection headphones for him. He was still feeling a little scared.

Later he came up with idea that sound of engine comes from the tires. He would keep telling me that monster trucks tires are loud or they made it louder after he put on his headphone.


How to backup Kubernetes’ Config

The easiest solution seems to be following script by Stackoverflow user, Timothy Perez:

#!/bin/bash

# NAMESPACED EXPORTS
for ns in $(kubectl get ns --no-headers | cut -d " " -f1); do
  kubectl --namespace="${ns}" get -o=json bindings,cm,ep,ev,limits,pvc,po,podtemplates,rc,quota,secrets,sa,svc,controllerrevisions,ds,deploy,rs,sts,localsubjectaccessreviews,hpa,cj,jobs,leases,ev,ds,deploy,ing,netpol,rs,pods,netpol,pdb,roles,rolebindings | \
    jq '.items[] |
    select(.type!="kubernetes.io/service-account-token") |
    del(
        .spec.clusterIP,
        .metadata.uid,
        .metadata.selfLink,
        .metadata.resourceVersion,
        .metadata.creationTimestamp,
        .metadata.generation,
        .status,
        .spec.template.spec.securityContext,
        .spec.template.spec.dnsPolicy,
        .spec.template.spec.terminationGracePeriodSeconds,
        .spec.template.spec.restartPolicy
    )' >> "./${ns}.json"
done

# NON-NAMESPACED EXPORTS
kubectl get -o=json cs,ns,no,pv,mutatingwebhookconfigurations,validatingwebhookconfigurations,crds,apiservices,tokenreviews,selfsubjectaccessreviews,selfsubjectrulesreviews,subjectaccessreviews,csr,psp,nodes,psp,clusterrolebindings,clusterroles,pc,sc,volumeattachments | \
    jq '.items[] |
    select(.type!="kubernetes.io/service-account-token") |
    del(
        .spec.clusterIP,
        .metadata.uid,
        .metadata.selfLink,
        .metadata.resourceVersion,
        .metadata.creationTimestamp,
        .metadata.generation,
        .status,
        .spec.template.spec.securityContext,
        .spec.template.spec.dnsPolicy,
        .spec.template.spec.terminationGracePeriodSeconds,
        .spec.template.spec.restartPolicy
    )' >> "./cluster_non-namespaced_export.json"

Script copied here under CC BY-SA 4.0 license.


Crispy-Skinned Baked Chicken Drumsticks

Ingredients

  • 8 (4 oz each) skin-on chicken drumsticks (about 2 lb. total weight)
  • 2 tablespoons olive oil
  • 1 teaspoon salt
  • ½ teaspoon black pepper
  • 1 teaspoon garlic powder
  • 1 teaspoon onion powder
  • 1 teaspoon smoked paprika
  • 1/4 teaspoon chilli pepper

Instructions

  • Preheat your oven to 400 degrees F. Line a rimmed baking sheet with parchment paper and arrange the drumsticks in a single layer on the parchment.
  • Make the seasoning paste: In a medium bowl, use a fork or a spatula to mix the olive oil, salt, pepper, and spices.
  • Using a pastry brush or your hands, coat the chicken pieces with the seasoning paste.
  • Bake the drumsticks uncovered until their internal temperature reaches 165 degrees F, about 40 minutes.
  • Baste the drumsticks with the pan juices using a clean pastry brush. Serve immediately.

Via https://healthyrecipesblogs.com/wprm_print/22974


LeetCode 605. Can Place Flowers

/**
 * @param {number[]} flowerbed
 * @param {number} n
 * @return {boolean}
 */
var canPlaceFlowers = function(flowerbed, n) {
    for (let i = 0; i<flowerbed.length; i++) {
        if (flowerbed[i] == 0
           && (i == 0 || flowerbed[i-1] == 0)
           && (i == flowerbed.length-1 || flowerbed[i+1] == 0)) {
            n--
            flowerbed[i] = 1
            if (n < 1)
                return true
        }
    }

    return n <= 0
};

LeetCode 1268. Search Suggestions System

/**
 * @param {string[]} products
 * @param {string} searchWord
 * @return {string[][]}
 */
var suggestedProducts = function(products, searchWord) {
    products.sort((a, b) => {
        if (a > b) return 1
        if (a < b) return -1
        return 0
    })

    const r = []

    for (let i = 1; i<=searchWord.length; i++) {
        const arr = products.filter((s) => s.startsWith(searchWord.substring(0, i))).slice(0, 3)
        //console.log(searchWord.substring(0, i))
        r.push(arr)
    }

    return r
};

LeetCode 253. Meeting Rooms II

Lack of built-in Priority Queues in JavaScript makes it a bit hard to do problems like this. I end looking at the solution:

/**
 * @param {number[][]} intervals
 * @return {number}
 */
var minMeetingRooms = function(intervals) {
    if (intervals.length < 1) return 0

    const startTimes = []
    const endTimes = []

    for (let i = 0; i<intervals.length; i++) {
        startTimes[i] = intervals[i][0]
        endTimes[i] = intervals[i][1]
    }

    startTimes.sort((a, b) => a-b)
    endTimes.sort((a, b) => a-b)

    let startPtr = 0
    let endPtr = 0
    let rooms = 0

    for (let i=0; i<intervals.length; i++) {
        if (startTimes[i] >= endTimes[endPtr]) {
            endPtr++
        } else {
            rooms++
        }
    }

    return rooms
};

git error: github.com:abc/xyz.git did not send all necessary objects

I was getting following error when running git pull

git pull
fatal: bad object refs/heads/master 2
error: github.com:abc/xyz.git did not send all necessary objects

I tried running git gc

git gc
error: bad ref for .git/logs/HEAD 2
fatal: bad object refs/heads/master 2
fatal: failed to run repack

The fix was to remove above to files under .git

rm .git/logs/HEAD\ 2
rm .git/refs/heads/master\ 2

After that I was able to run gc and do git pull

git gc
Enumerating objects: 257, done.
Counting objects: 100% (257/257), done.
Delta compression using up to 4 threads
Compressing objects: 100% (224/224), done.
Writing objects: 100% (257/257), done.
Total 257 (delta 85), reused 0 (delta 0), pack-reused 0

LeetCode 937. Reorder Data in Log Files

/**
 * @param {string[]} logs
 * @return {string[]}
 */
var reorderLogFiles = function(logs) {

    const sorted = []
    const numLogs = []
    const charLogs = []

    for (let i = 0; i<logs.length; i++) {
        const log = logs[i]
        const tokenized = log.split(" ")
        if (Number.isInteger(parseInt(tokenized[1]))) {
            numLogs.push(log)
        } else {
            charLogs.push(log)
        }
    }

    charLogs.sort(function (a, b) {
        const stra = a.substr(a.indexOf(' ') + 1)
        const strb = b.substr(b.indexOf(' ') + 1)
        if (stra > strb) {
            return 1
        }
        if (stra < strb) {
            return -1
        }

        const ida = a.substr(0, a.indexOf(' '))
        const idb = b.substr(0, b.indexOf(' '))
        //console.log({ida})
        if (ida > idb) {
            return 1
        }
        if (ida < idb) {
            return -1
        }

        return 0
    })

    return [...charLogs, ...numLogs]

};

LeetCode 49. Group Anagrams

/**
 * @param {string[]} strs
 * @return {string[][]}
 */
var groupAnagrams = function(strs) {
    const map = []

    for (let i = 0; i<strs.length; i++) {
        const str = strs[i].split('').sort().join('')
        if (!map[str]) map[str] = []
        map[str].push(strs[i])
    }
    const ans = []
    for (let k in map) {
        ans.push(map[k])
    }
    return ans
};

LeetCode 71. Simplify Path

/**
 * @param {string} path
 * @return {string}
 */
var simplifyPath = function(path) {
    const simple = [];
    const splitPath = path.split("/").filter(x => x.length>0 && x !== '.')

    for (let i = 0; i<splitPath.length; i++) {
        if (splitPath[i] === '..') {
            simple.pop()
        } else {
            simple.push(splitPath[i])
        }

    }

    return `/${simple.join('/')}`
};