A Swift script using Apple's built-in Vision framework for fully offline, private OCR on images and PDFs. Tested on macOS 26 (Tahoe).
- Paste the script into a file:
nano ~/.local/bin/ocr
| -------------------- HELPERS ------------------------------- | |
| local cmd = vim.cmd -- to execute Vim commands e.g. cmd('pwd') | |
| local fn = vim.fn -- to call Vim functions e.g. fn.bufnr() | |
| local g = vim.g -- a table to access global variables | |
| local opt = vim.opt -- to set options | |
| local function map(mode, lhs, rhs, opts) | |
| local options = {noremap = true} | |
| if opts then options = vim.tbl_extend('force', options, opts) end | |
| vim.api.nvim_set_keymap(mode, lhs, rhs, options) |
| Assuming you have followed all the steps to install / setup WSL2 -> https://docs.microsoft.com/en-us/windows/wsl/install-win10 | |
| **Tested on Ubuntu 20.04** | |
| Step 1 - Find out default gateway and DNS servers | |
| - Navigate to `Control Panel\Network and Internet\Network Connections` | |
| - Right click on relevant connection type WiFi or Ethernet and select `Status` | |
| - Status screen will be displayed, click on `Details` button | |
| - Network Connection details screen will be displayed | |
| - Note down `IPv4 default gateway` and `IPv4 DNS Servers` if available |
Here are some of my notes from Programming Rust. I'm posting them here and in a gist on github so they're searchable to me and anyone else that needs them, and show up in my search results.
(omitted for brevity)
Typical for function's return value to "fall off the end of the function"
Tests marked with #[test] attribute
| # Get all XML files - xml can be replaced with any other file extension | |
| $files = Get-ChildItem *.xml -Recurse | |
| # Loop over files to rename and create individual zip copies | |
| foreach ($file in $files) { | |
| # Get file name without xml extension | |
| $zipFileName = (Get-Item $file).BaseName | |
| # Get dir name for each file and append file name without extension | |
| $combinedPath = $file.DirectoryName+'\'+$zipFileName |
| // Highcharts CheatSheet Part 1. | |
| // Create interactive charts easily for your web projects. | |
| // Download: http://www.highcharts.com/download | |
| // More: http://api.highcharts.com/highcharts | |
| // 1. Installation. | |
| // Highcharts requires two files to run, highcharts.js and either jQuery, MooTools or Prototype or the Highcharts Standalone Framework which are used for some common JavaScript tasks. | |
| // <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script> | |
| // <script src="https://code.highcharts.com/highcharts.js"></script> |