Location of startup items and applications on MACOS

Quick cheatsheet to know where to look when you need to rid off some startup item, app or service.

Applications that run on Startup

1/Library/StartupItems

Property list (plist) items running on startup

1/Library/LaunchDaemons
1/System/Library/LaunchDaemons

Applications that launch on User Login

You should be able to add/remove most applications from your user account. Go to System preferences -> Users and groups -> Select user -> Login Items.

By console you can check in the following folders:

1~/Library/LaunchAgents
1/Library/LaunchAgents/
1/System/Library/LaunchAgents/

Applications that run on a set schedule

Check your crontab with crontab -l

Check Kernel Extensions

In the command line:

1kextstat

Check Login and Logout Hooks

for Login:

1defaults readcom.apple.loginwindow LoginHook

for Logout:

1defaults readcom.apple.loginwindow LogoutHook

or see both with:

1/usr/libexec/PlistBuddy-c Print

source:

Create entire disk backup with DD

Most of the times if you just need to make a drive backup

sudo dd if=/dev/disk# conv=sync,noerror bs=64k | gzip -c  > <ouput filename>.img.gz

if you need trottling because you have a bad disk drive

sudo dd if=/dev/disk# conv=sync,noerror bs=#k | pv -L 10m -s 500g | gzip -c  > <ouput filename>.img.gz.img.gz

Disable https for asp.net core 5.0 API project

As default asp.net api project created by CLI have https enabled by default. Disabling it is simple if you do it correctly :). Nowadays all backends relay on some sort of WAF (web application firewall) to do the security tasks for you so there is less need to support https in our projects.

so.

First you remove the:

app.UseHttpsRedirection();

from Startup.cs to remove the http -> https redirection

and than you remove the applicationUrl https reference from launchSettings.json

http://localhost:5001

TypeScript/Node.js build&run&debug configuration for Visual Studio Code

After reading allot of pages and pseudo professional opinions on SO, I came up with my simple build end debug configuration for Visual Studio Code.

You basically need three files. tsconfig.json to “compile” your .ts files to appropriate .js files.

tasks.json to actually start the compilation process inside the VSCode GUI

and launch.json to setup the launch end debug process of your nodejs app.

tsconfig.json
{ 
    "compilerOptions": { 
    "target": "ES6", 
    "module":"CommonJS", 
    "outDir": "app", 
    "rootDir": "src", 
    "sourceMap": true, 
    "noImplicitAny": true, 
    "removeComments": true, 
    "preserveConstEnums": true 
    } 
}
tasks.json
{ 
"version": "2.0.0", 
"tasks": [ 
{ 
"type": "typescript", 
"tsconfig": "tsconfig.json", 
"problemMatcher": [ "$tsc" ], 
"group": { "kind": "build", "isDefault": true }, 
"label": "tsc: build - tsconfig.json" } 
]}
launch.json
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"preLaunchTask": "tsc: build - tsconfig.json",
"program": "${workspaceFolder}/app/wallet.js"
}
]
}

take notice of the preLaunchTask which launches the compilation process

Need a node.js dev project?

Why clutter your mac or PC. Run it inside a container. Simple as:

https://code.visualstudio.com/docs/remote/containers-tutorial

But than you discover that your files mounted with the -v command inside the container are not available directly to the host OS if it’s on macOS. Basically is a container inside a container and you need another container to acces your files or synchronize your dev folder with the data folder inside the container:

https://stackoverflow.com/a/55648186

Well, I’ll go with the sync command:

docker cp access_volume:/data local-data
# modify local-data
docker cp local-data access_volume:/data

[EDIT 20200925]: as per:

https://code.visualstudio.com/docs/remote/containers-advanced

you can create a:

"mounts": [
  "source=/local/source/path/goes/here,target=/target/path/in/container/goes/here,type=bind,consistency=cached"
]

inside your devcontainer.json to map your local folder inside the container.