Tech Talk

This is where I (Patrick H @gnubyte) blog about tech

19: New linux command I like 'ncdu'

Found a new command I like and would recommend - ncdu - its a graphical disk utilization that bubbles up the files you need to see. Seems to ship with Centos 7 and appear in a few other services so...good find!


2021-09-08 12:44:42

18: Trying to make Quasar app/quasar js scan the network

Initial discovery phase research can be boiled down to this. Taking some inspiration from IoT devices on my network.

 

My ideas are:

1) check to see if theres a native browser feature for this...maybe I can tap some kind of browser native standard..?

2) have a server hold a registry of internal IPs, then when a user signs in, send the details to their app's cache. This is browser specific, may still ask the user in iOS to scan the local network/ask for access to it, and Im not sure how Quasar JS handles that. Might just try sticking a library into the quasar app, plugging it into the emulator, and see what the emulator does. My hope is that it would have some JFM that auto-understands what the apps' intent is, and not mess up a promise chain/async thing inside the app while asking the user for the prompt to scan.

 

 other ideas 

3) SSDP -simple service discovery protocol but this requires having an understanding and some sort of prompt on iOS that lets the device owner grant permission to quasar to access the local network to discover devices

4) other schemes similar to #3 but via different protocols


2021-08-08 20:03:44

17: Mac OSX software and general coding recommendations

Had an awful experience this morning when I saw that my VSCode app was calling home to report what I was typing to Microsofts natural language processing telemetry collection somewhere in Kansas...so henceforth thought I'd document some of my experience this morning...

Microsnitch & Littlesnitch to see network traffic per app/service, and see when an app is using the microphone or camera.

https://obdev.at/products/littlesnitch/index.html

https://obdev.at/products/microsnitch/index.html

VS-Codium, Visual Studio code without Microsoft's boatload of telemetry and natural language typing callbacks to their HQ

https://github.com/VSCodium/vscodium

https://open-vsx.org/

https://stackoverflow.com/questions/52831666/in-which-path-does-visual-studio-code-install-extensions

VSCodium installs extensions on OSX to: /Users/{USERNAME}/.vscode-oss/extensions/

Your existing extensions probably live under: /Users/{USERNAME}/.vscode/extensions

...Just copy and paste them manually.

You can actually use CMD + SHIFT + P within VSCodium, and type "Extensions", and scroll down to see a manual install from "VSIX" files, which is VSCode's extension file. Extensions can be downloaded and manually installed as well.

Fun hot keys I learned this morning in OSX File explorer 'Finder':

Show hidden files, Hold down the Command, Shift and Period keys: cmd + shift + [.]

cmd + shift + PLUSKEY makes the file icons bigger, likewise the minus instead of pluskey makes icons/details smaller.

 

I had about 1.1GB of extensions which is insane so, just be aware that there may be a copius amount of files.


2021-08-03 11:18:22

15: Learning through doing

I had an interesting experience at work today that drove a conversation with a coworker later in the day. I was reflecting on the experience with the coworker and asked him "given the situation, do you think in your experience there is anything that, if I encounter this again, you think I should try doing?". The coworker gave me a few good suggestions and I thanked him promptly.

In a book "The Last Tycoon" by Scott F. Fitzgerald there is a passage that goes something like this:

 

He was looking down at the mountains. "Suppose you were a railroad man," he said. "You have to send a train through there somewhere. Well, you get your surveyors' reports, and you find there's three or four or half a dozen gaps, and not one is better than the other. You've got to decide -- on what basis? You can't test the best way-- except by doing it. So you just do it."

 

I am finding the more work I do that sometimes when you may not know a programming language, or professionally you can't find an angle at which to best work with someone - sometimes you just have to do it and adjust on the fly. Given the nature of whatever topic it is one is evaluating, to understand if they could have done something better, there isn't always hindsight. The coworker passed on an expression he had heard that went something to the effect of "You can't avoid pain but you can try to lessen the suffering". I think this is in that same ballpark.


2021-06-25 02:57:38

14: Homebrew + VSC Powerline Quick 2021 Note

Had a hell of a time figuring this out so here is the link trail.

I use these to essentially show where in my filesystem I am, and if there is a git repo, what branch I am living in/commit status...stuff of that sort.

First the main software:

A new terminal (iTerm2), Homebrew on Mac M1 chipset - a way to install FOSS software, and Powerline - a helpful terminal theme so to speak, and finally some git tools

https://iterm2.com/

https://brew.sh/

https://github.com/jaspernbrouwer/powerline-gitstatus

Issues and install workarounds

https://github.com/Homebrew/brew/issues/10191

https://powerline.readthedocs.io/en/master/usage/shell-prompts.html#bash-prompt

https://gist.github.com/DukeNgn/9312a65e1535b3b1bffd9fed2c892079

https://stackoverflow.com/questions/29957456/change-default-terminal-app-in-visual-studio-code-on-mac

https://coderwall.com/p/h6yfda/use-and-to-jump-forwards-backwards-words-in-iterm-2-on-os-x


2021-04-23 12:17:31

13: A few quotes that helped me in my career

Just a few quotes here that have helped me in my career.

 

"The greatest expression of rebellion is joy" - Joss Whedon

"Perception is often reality" - Mike Cormier

"By default optimists shape the world because pessimists never even try" - Tony Stark

 

Wiping off my whiteboard so I can use it and thought I'd bank a few of these here.

"And so I would submit that the only way for any craftsman to improve at their craft is to rather carefully examine and understand their mistakes. Certainly, Leo, we know this is the case with chess; right? The reason all of the really high-end masters record every move of their game is they're going to take a look at that later and spend a lot of time examining the board at each stage and understand why they lost the game." - Steve Gibson


2021-01-28 21:02:23

12: A quick review of Quart Web Framework

Hey all. I tried Quart and porting a flask app to it this past weekend, on the promise that it was "fairly" plug and play.

Quick burndown:

 - it is not plug and play but rather patch and see if your other flask extensions work

 - the paradigm of async and building web services in it is a paradigm that can be solved with a flask extension

 - the concept behind Quart is brilliant and bleeding edge, especially their use of HTTP3 (QUIC).

 - It is not ready for production yet. I noticed when parsing out POST data that it used different data structures. This creates complications if you are promised an equivalent but are instead greeted with this. Its okay. Just know you need to set aside R&D time to figure it out. In my case I reached an impass where it felt there was not significant cleared path online from others, and documentation that was...fairly dry online...to figure the issues out. 

 - When I attempted to open it up in Wing IDE and do breakpoint based debugging, evaled some types, I noticed that the datastructures they were using were some bastardization framework that an individual wrote. Stuff I don't see often. It would take a hot minute to figure it out and get it prod ready.

 

 

Good stuff though. I want to see it when its been adopted by more major services, should it reach that. It seems like Fastapi is going to get there first.


2021-01-03 17:07:40

11: Better Understanding of Javascript: Ins and Outs (Part 1)

 

Really trying to shape up my javascript skills. This past week I encountered a lot of issues when trying to jump between jQuery, xmlhttprequest, fetch as well as the design patterns people are using in javascript today. Here is what I do know: ECMAscript and its friends are in, jQuery is out, and the browser has come a long way. So lets get more insight on what I need to know, then a brush up of how the browser and DOM works, then either in this post or another, freshen up our understanding of ECMAscript.

 

A few high level notes here:

 - if they talk about "how a promise is just like the promise I make to a boy that I'll do something" then they're just farming 10 minute ad revenue and have little incentive for you to learn anything; I encountered three of these videos on youtube back to back and their presentation seemed like a literal copy and paste script.

- what quantifies a good learning experience is anything that we can take apart, have each component relayed back to standard OOP, and any specifics of the javascript basics in an order starting from relatably simple in basic programming to complex & specific to javascript; the video should build small steps to escalate up to the complication.

- mozillas fetch documentation did not feel beginner friendly. I feel like after watching these videos and playing with javascript 1:1 I can come back to this documentation and read it with comprehension. Its obvious its meant for the "advanced user" but dropping 'service workers' into the first two paragraphs just loses me. The first paragraph feels like a robot wrote it (no offense to the author, I've seen worse).

<hr>

Sites and Links

Arrow Syntax if you haven't seen it yet

This is a quick, no BS 3 minute explanation of all the common arrow functions you might see. Catch 22 here is that it is going to go fast and I recommend this to OOP programmers.

https://www.youtube.com/watch?v=22fyYvxz-do

 

 

Promises, interacting async with fetching data

This really caught me up on how to manage this chaining of promises. My confusion of 

https://www.youtube.com/watch?v=fdOa6jrJ0UM

 

Promises visual breakdown & webapis

A wonderful JSConf presentation with visual representation. Talks about webapis, async visually, and the call stack.

https://www.youtube.com/watch?v=8aGhZQkoFbQ&t

 

 


2020-12-05 20:58:49

10: Another late night: Apple M1 chips & Docker

I just found out that the Apple M1 chipset does not have Docker (or VM) support yet. So here is my short and long term.

Short term I think people are right; never do work on a first gen hardware set. Longterm I think they'll need to work through virtualization security vulnerabilties where intel is "tried and true" (security vulnerabilties sold in private markets). For the developer, I do not think that an M1 chip is a smart move...in my research people mentioned the idea of running on a RISC vs CISC instruction set. I know how people tend to program, and I can guarantee that it will take two years minimum for developers to come to a firm understanding of this before it is working right and most of all before it is optimized.

TLDR for now I am staying away from M1.


2020-11-20 06:18:10

9: FrustrationWorks - Frustration around Frameworks

Its late so keeping this short...

I have been working with Python for 5 years now along with PHP and other languages. I am experiencing a lot of friction around NodeJS, Python and PHP packages; maintainers that produce a package then walk away for 5 years, documentation that never worked in the first place - etc. Recently I had a discussion with a coworker about maintaining existing codebase. I think this begs the question as to when and why write your own code.

 

Lets break this down.

  • Coding your own software/package/framework/etc. does something brilliant: it puts you in the drivers seat for implementing things properly. Your vision of what the end product looks like is your own. However the cost is time, and someone has to be able to make changes or keep this software updated, if someone besides you somehow becomes responsible for maintaining its reimplementation/implementation.
  • Some languages/frameworks are great because they hit cross platform in ways you just wouldn't be able to deliver on. You'd be stuck writing your app in 5 languages for iOS/Web/Android/OSX/Linux/Windows. React-Native or Nativescript are examples of this. However if you do not know that intermediary language or the abstract components you are at the mercy of the gods that wrote that wrote that language/framework...be it their will to have it as is.

Sigh. There is a large part of me that wants to go back to seeing things written in C, PHP, basic Javascript & CSS - and little to no frameworks. Smaller components that are only subject to restrictions the basic browser and operating system itself impose.

I know Javascript and python will be around for awhile especially in enterprise but thinking larger than that - the frustration of writing a "good" app (available on modern platforms) is near to impossible in this atmosphere. At this rate Apple, Google Chrome, Android, Windows, OSX and Linux will require years from a single developer in order to produce a solitary working "good" app for native clients. More thoughts to come. Maybe I just need an Orchestra to conduct...and not people, but one language to produce the subsequent build targets. I'd imagine this is similar to what Facebook's ambitious React-Native team thought.


2020-10-21 06:20:31

8: Shoutout to loaded properties

I was in the chrome dev tools today and was trying to debug a javascript framework that wasn't loading despite both the JS script & CSS being loaded in.

This was immensely helpful just to dump a list of available properties or objects to console:

for (var PropOrObj in window){
if (window.hasOwnProperty(PropOrObj)) console.log(PropOrObj);

}


2020-09-29 16:38:11

5: Nativescript Extension Uninstall

I've had a hell of a time trying to get rid of Typescript. Occasionally in a branch it gets installed and when I switch out to master/prod branch, there are files on .gitignore that maintain the dependency, which gets caught up in my builds and auto-adds typescript to my package. This is a very clean way of uninstalling that typescript package, as it will look for an entrypoint typescript file that you might not have in a vanilla Nativescript project.
Update Attempt #1: Just kidding. That didn't solve my typescript issue either. Still need to do a tns migrate and then edit the webpack.config.js and change its entrypoint - nope that didnt work either.
Update Attempt #2: Problems are related to TNS binary v6.0 vs your current runtime. The nativescript-dev-webpack in package.json used v0.10 and now uses 1.4.1 as well as officially automatically adding typescript 3.4.5 to the package.json. I love the problem typescript tries to solve with multiple ECMAscript standards being transpiled into one all-browser-compatible version of your code, but adding complexity to a complex problem makes for a complexity vaccum, which I am not for.
/rant.
Final update: Lol...just rename your app.js to a .ts file...We'll assume typescript is here to stay and stop fighting it...


2020-09-19 18:59:46

4: Docker exec cantrip

I learned today you can exec into a container by using the unix user ID specification when starting a binary interactive session on docker. Check it out...

docker exec -u 0 -it [container_id] sh


2020-09-19 18:59:21

3: Cleaning up a python runtime quickly snippet

A quick purge of all python compiled code and artifacts from the JIT runtime snippet

find . | grep -E "(__pycache__|\.pyc|\.pyo$)" | xargs rm -rf


2020-09-19 18:58:58

2: Test Article

Here is a test post. Hopefully the first post!


2020-09-19 18:34:18