From 9565a7dc34a8936324e4487f2c3f2459c3e88b9f Mon Sep 17 00:00:00 2001 From: Mike Phares Date: Tue, 22 Jul 2025 18:33:28 -0700 Subject: [PATCH] Job search and people-to-sql with Bun --- .vscode/launch.json | 134 +++++++++++++++++++++++---------------- .vscode/mklink.md | 4 ++ Scripts/immich.js | 50 +++++++++++++++ Scripts/job-search.js | 36 +++++++++++ Scripts/people-to-sql.js | 27 ++++++++ package.json | 15 +++++ tsconfig.json | 29 +++++++++ 7 files changed, 241 insertions(+), 54 deletions(-) create mode 100644 Scripts/immich.js create mode 100644 Scripts/job-search.js create mode 100644 Scripts/people-to-sql.js create mode 100644 package.json create mode 100644 tsconfig.json diff --git a/.vscode/launch.json b/.vscode/launch.json index 82911c2..646a431 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -1,56 +1,82 @@ { - "version": "0.2.0", - "configurations": [ - { - "name": "Compare", - "type": "coreclr", - "request": "launch", - "preLaunchTask": "Build-Compare", - "program": "${workspaceFolder}/Compare/bin/Debug/net9.0/win-x64/AA.Compare.dll", - "args": [ - "s" - ], - "env": { - "ASPNETCORE_ENVIRONMENT": "Development" - }, - "cwd": "${workspaceFolder}", - "console": "integratedTerminal", - "stopAtEntry": false, - "requireExactSource": false - }, - { - "name": "Rename", - "type": "coreclr", - "request": "launch", - "preLaunchTask": "Build-Rename", - "program": "${workspaceFolder}/Rename/bin/Debug/net9.0/win-x64/AA.Rename.dll", - "args": [ - "s" - ], - "env": { - "ASPNETCORE_ENVIRONMENT": "Development" - }, - "cwd": "${workspaceFolder}", - "console": "integratedTerminal", - "stopAtEntry": false, - "requireExactSource": false - }, - { - "name": "Windows", - "type": "coreclr", - "request": "launch", - "preLaunchTask": "Build-Windows", - "program": "${workspaceFolder}/Windows/bin/Debug/net9.0/win-x64/AA.Windows.dll", - "args": [ - "s" - ], - "env": { - "ASPNETCORE_ENVIRONMENT": "Development" - }, - "cwd": "${workspaceFolder}", - "console": "integratedTerminal", - "stopAtEntry": false, - "requireExactSource": false - } - ] + "version": "0.2.0", + "configurations": [ + { + "name": "Compare", + "type": "coreclr", + "request": "launch", + "preLaunchTask": "Build-Compare", + "program": "${workspaceFolder}/Compare/bin/Debug/net9.0/win-x64/AA.Compare.dll", + "args": [ + "s" + ], + "env": { + "ASPNETCORE_ENVIRONMENT": "Development" + }, + "cwd": "${workspaceFolder}", + "console": "integratedTerminal", + "stopAtEntry": false, + "requireExactSource": false + }, + { + "name": "Rename", + "type": "coreclr", + "request": "launch", + "preLaunchTask": "Build-Rename", + "program": "${workspaceFolder}/Rename/bin/Debug/net9.0/win-x64/AA.Rename.dll", + "args": [ + "s" + ], + "env": { + "ASPNETCORE_ENVIRONMENT": "Development" + }, + "cwd": "${workspaceFolder}", + "console": "integratedTerminal", + "stopAtEntry": false, + "requireExactSource": false + }, + { + "name": "Windows", + "type": "coreclr", + "request": "launch", + "preLaunchTask": "Build-Windows", + "program": "${workspaceFolder}/Windows/bin/Debug/net9.0/win-x64/AA.Windows.dll", + "args": [ + "s" + ], + "env": { + "ASPNETCORE_ENVIRONMENT": "Development" + }, + "cwd": "${workspaceFolder}", + "console": "integratedTerminal", + "stopAtEntry": false, + "requireExactSource": false + }, + { + "type": "node", + "request": "launch", + "name": "node Launch Current Opened File", + "program": "${file}" + }, + { + "type": "bun", + "internalConsoleOptions": "neverOpen", + "request": "launch", + "name": "Debug File", + "program": "${file}", + "cwd": "${workspaceFolder}", + "stopOnEntry": false, + "watchMode": false + }, + { + "type": "bun", + "internalConsoleOptions": "neverOpen", + "request": "launch", + "name": "Run File", + "program": "${file}", + "cwd": "${workspaceFolder}", + "noDebug": true, + "watchMode": false + } + ] } \ No newline at end of file diff --git a/.vscode/mklink.md b/.vscode/mklink.md index 7f1e7c3..9f7290f 100644 --- a/.vscode/mklink.md +++ b/.vscode/mklink.md @@ -40,3 +40,7 @@ mklink /J "L:\Git\AA\Windows\.vscode\.iCloudPhotos2025" "D:\7-Question\iCloud Ph { "label": "Build-Rename", "command": "dotnet", "type": "process", "args": [ "build", "${workspaceFolder}/Rename/AA.Rename.csproj", "/property:GenerateFullPaths=true", "/consoleloggerparameters:NoSummary" ], "problemMatcher": "$msCompile" }, { "label": "Build-Shared", "command": "dotnet", "type": "process", "args": [ "build", "${workspaceFolder}/Shared/AA.Shared.csproj", "/property:GenerateFullPaths=true", "/consoleloggerparameters:NoSummary" ], "problemMatcher": "$msCompile" }, ``` + +```bash 1753233168670 = 638888299686700000 = 2025-3.Summer = Tue Jul 22 2025 18:12:48 GMT-0700 (Mountain Standard Time) +mklink /J "L:\Git\AA\.vscode\helper\.638443643487798783" "D:\5-Other-Small\DigiKam\0113C7C3FED381A-hidden-c\638443643487798783" +``` diff --git a/Scripts/immich.js b/Scripts/immich.js new file mode 100644 index 0000000..0d50d05 --- /dev/null +++ b/Scripts/immich.js @@ -0,0 +1,50 @@ +const axios = require('axios'); + +const url = 'https://immich.bchs.duckdns.org'; + +let config = { + method: 'get', + maxBodyLength: Infinity, + // url: url + '/api/users', + url: url + '/api/assets/f89d0de1-2762-4f9e-b60e-c7eeec93c4e9', + headers: { + 'Accept': 'application/json', + 'x-api-key': 'Pm2CbhJvgStEPAFKRVclW88qrOAy79OeIEcfj3k' + } +}; + + +axios.request(config) + .then((response) => { + console.log(JSON.stringify(response.data)); + }) + .catch((error) => { + console.log(error); + }); + +// let data = JSON.stringify({ +// "avatar": { +// "color": "green" +// } +// }); + +// let configB = { +// method: 'put', +// maxBodyLength: Infinity, +// url: url + '/api/users/me/preferences', +// headers: { +// 'Content-Type': 'application/json', +// 'Accept': 'application/json', +// 'x-api-key': 'Pm2CbhJvgStEPAFKRVclW88qrOAy79OeIEcfj3k' +// }, +// data: data +// }; + +// axios.request(configB) +// .then((response) => { +// console.log(JSON.stringify(response.data)); +// }) +// .catch((error) => { +// console.log(error); +// }); + diff --git a/Scripts/job-search.js b/Scripts/job-search.js new file mode 100644 index 0000000..ef8baf4 --- /dev/null +++ b/Scripts/job-search.js @@ -0,0 +1,36 @@ +import year from '../.vscode/helper/year.job.json' with { type: 'json' }; +import event from '../.vscode/helper/event.job.json' with { type: 'json' }; + +let file; +let fromYear = []; +let fromEvent = []; +let fromYearEventPresent = []; +let fromEventYearPresent = []; +const pathA = 'L:/Git/AA/.vscode/helper/from-year-event-present.json'; +const pathB = 'L:/Git/AA/.vscode/helper/from-event-year-present.json'; + +year.Files.forEach(element => { + file = element.RelativePath.split('\\')[1]; + fromYear.push(file); +}); + +event.Files.forEach(element => { + file = element.RelativePath.split('\\')[1]; + fromEvent.push(file); + if (fromYear.includes(file)){ + fromYearEventPresent.push(file); + } +}); + +year.Files.forEach(element => { + file = element.RelativePath.split('\\')[1]; + if (fromEvent.includes(file)){ + fromEventYearPresent.push(file); + }; +}); + +const jsonA = JSON.stringify(fromYearEventPresent); +await Bun.write(pathA, jsonA); + +const jsonB = JSON.stringify(fromEventYearPresent); +await Bun.write(pathB, jsonB); diff --git a/Scripts/people-to-sql.js b/Scripts/people-to-sql.js new file mode 100644 index 0000000..10fae59 --- /dev/null +++ b/Scripts/people-to-sql.js @@ -0,0 +1,27 @@ +import people from '../.vscode/helper/.638443643487798783/people.json' with { type: 'json' }; + +const pathA = 'L:/Git/AA/.vscode/helper/.638443643487798783/id-name.sql'; +const pathB = 'L:/Git/AA/.vscode/helper/.638443643487798783/id-name.json'; + +let results = []; +let name = ''; +let person = {}; +let line = ''; +let lines = []; +for (const property in people) { + person = people[property]; + name = person.Name.Suffix == undefined || person.Name.Suffix.length === 0 + ? person.Name.ForwardSlashFull + : person.Name.ForwardSlashFull + ' ' + person.Name.Suffix; + line = `update Tags set name = '${name}' where name = '${person.Birth.Note}';` + lines.push(line); + line = `update TagProperties set value = '${name}' where value = '${person.Birth.Note}';` + lines.push(line); + results.push({ id: person.Birth.Note, name: name }); +} + +const text = lines.join('\n'); +await Bun.write(pathA, text); + +const json = JSON.stringify(results); +await Bun.write(pathB, json); \ No newline at end of file diff --git a/package.json b/package.json new file mode 100644 index 0000000..d5e4f0f --- /dev/null +++ b/package.json @@ -0,0 +1,15 @@ +{ + "name": "adaptation", + "module": "index.ts", + "type": "module", + "private": true, + "devDependencies": { + "@types/bun": "latest" + }, + "peerDependencies": { + "typescript": "^5" + }, + "scripts": { + "garbage-collect": "git gc" + } +} \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..bfa0fea --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,29 @@ +{ + "compilerOptions": { + // Environment setup & latest features + "lib": ["ESNext"], + "target": "ESNext", + "module": "Preserve", + "moduleDetection": "force", + "jsx": "react-jsx", + "allowJs": true, + + // Bundler mode + "moduleResolution": "bundler", + "allowImportingTsExtensions": true, + "verbatimModuleSyntax": true, + "noEmit": true, + + // Best practices + "strict": true, + "skipLibCheck": true, + "noFallthroughCasesInSwitch": true, + "noUncheckedIndexedAccess": true, + "noImplicitOverride": true, + + // Some stricter flags (disabled by default) + "noUnusedLocals": false, + "noUnusedParameters": false, + "noPropertyAccessFromIndexSignature": false + } +}