### Start Example App Packager
Source: https://github.com/laurent22/joplin/blob/dev/packages/react-native-saf-x/CONTRIBUTING.md
Starts the Metro server for the example application, allowing for live code updates.
```sh
yarn example start
```
--------------------------------
### Minimal CLI Setup with MagicLI
Source: https://github.com/laurent22/joplin/blob/dev/readme/licenses.md
This snippet shows the most basic setup for MagiCLI. It requires installing the package, adding a 'bin' property to package.json, and creating a main JavaScript file to execute MagicLI.
```javascript
#!/usr/bin/env node
require('magicli')();
```
--------------------------------
### MagiCLI CLI Setup
Source: https://github.com/laurent22/joplin/blob/dev/readme/licenses.md
This JavaScript snippet demonstrates how to set up a CLI for a module using the MagiCLI package. It requires installing the package and adding a 'bin' property to package.json.
```javascript
#!/usr/bin/env node
require('magicli')();
```
--------------------------------
### Install cliss package
Source: https://github.com/laurent22/joplin/blob/dev/readme/licenses.md
Install the cliss package using npm. This is the initial setup step for using the module.
```bash
$ npm install cliss
```
--------------------------------
### Install with npm
Source: https://github.com/laurent22/joplin/blob/dev/readme/licenses.md
Install the readable-web-to-node-stream package using npm.
```bash
npm install readable-web-to-node-stream
```
--------------------------------
### Install with yarn
Source: https://github.com/laurent22/joplin/blob/dev/readme/licenses.md
Install the readable-web-to-node-stream package using yarn.
```bash
yarn add readable-web-to-node-stream
```
--------------------------------
### Start Desktop Application
Source: https://github.com/laurent22/joplin/blob/dev/readme/dev/BUILD.md
Navigate to the desktop application package and start the development server.
```sh
cd packages/app-desktop
yarn start
```
--------------------------------
### Setup Python Virtual Environment for OpenVINO (Windows)
Source: https://github.com/laurent22/joplin/blob/dev/packages/whisper-voice-typing/vendor/whisper.cpp/README.md
Sets up a Python virtual environment and installs dependencies required for OpenVINO model conversion on Windows.
```powershell
cd models
python -m venv openvino_conv_env
openvino_conv_env\Scripts\activate
python -m pip install --upgrade pip
pip install -r requirements-openvino.txt
```
--------------------------------
### Setup Python Virtual Environment for OpenVINO (Linux/macOS)
Source: https://github.com/laurent22/joplin/blob/dev/packages/whisper-voice-typing/vendor/whisper.cpp/README.md
Sets up a Python virtual environment and installs dependencies required for OpenVINO model conversion on Linux and macOS.
```bash
cd models
python3 -m venv openvino_conv_env
source openvino_conv_env/bin/activate
python -m pip install --upgrade pip
pip install -r requirements-openvino.txt
```
--------------------------------
### Install findit with npm
Source: https://github.com/laurent22/joplin/blob/dev/readme/licenses.md
Use npm to install the 'findit' package.
```bash
npm install findit
```
--------------------------------
### Start Terminal Application
Source: https://github.com/laurent22/joplin/blob/dev/readme/dev/BUILD.md
Navigate to the CLI application package and start the development server.
```sh
cd packages/app-cli
yarn start
```
--------------------------------
### Install Growly
Source: https://github.com/laurent22/joplin/blob/dev/readme/licenses.md
Shows how to install the 'growly' Node.js module using npm.
```bash
npm install growly
```
--------------------------------
### Installation with npm
Source: https://github.com/laurent22/joplin/blob/dev/packages/fork-uslug/README.md
Installs the uslug package using npm.
```bash
npm install uslug
```
--------------------------------
### Install https-proxy-agent
Source: https://github.com/laurent22/joplin/blob/dev/readme/licenses.md
Install the module using npm. This is the first step before using it in your project.
```bash
npm install https-proxy-agent
```
--------------------------------
### Object-to-Arguments Installation (CLI)
Source: https://github.com/laurent22/joplin/blob/dev/readme/licenses.md
Command to install the object-to-arguments package globally for CLI usage.
```bash
npm install object-to-arguments -g
```
--------------------------------
### Node Stream Buffers Installation
Source: https://github.com/laurent22/joplin/blob/dev/readme/licenses.md
Example of how to require the stream-buffers module in Node.js.
```javascript
var streamBuffers = require("stream-buffers");
```
--------------------------------
### Build and Start Desktop Application with Plugin
Source: https://github.com/laurent22/joplin/blob/dev/Assets/TinyMCE/JoplinLists/README.md
Execute this command to build the plugin and simultaneously start the desktop application. This is useful for testing the plugin's integration within the application environment.
```bash
npm run buildAndStart
```
--------------------------------
### Identity Provider (IdP) XML Metadata Example
Source: https://github.com/laurent22/joplin/blob/dev/packages/server/SAML.md
This is an example of the Identity Provider metadata XML file obtained from Keycloak. Ensure the entityID and URLs match your Keycloak setup.
```xml
6yRI1mOQyynWBQGgYdJMGKs96yQy5yOzUnOcMAMtRw4MIICmzCCAYMCBgGaKwAPnzANBgkqhkiG9w0BAQsFADARMQ8wDQYDVQQDDAZqb3BsaW4wHhcNMjUxMDI4MTMyNTE1WhcNMzUxMDI4MTMyNjU1WjARMQ8wDQYDVQQDDAZqb3BsaW4wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCmRf7tgM8Bq1P/28kOy8YVoOq/n/GhzBxaIMn10Q1Y9azR6EWmmFf7wdM+APeX53CICW6JWSNlFMI1vsmpWBHYQZxwYUPOmy7WZq5h8stWsgFTKxMvf4vej1JAZHNE/pCMk2i57B/4eqVQIHIXf4gO9W4AbSIYx8ZwxHvLGDH7Bq8ijeUKI2ifIe/NCENctLyhY+DXGAZOX0E0Wot5tONBwX/rJg4j1p1UTTmXj/kBvXb7k/4O38xYmUx6Wmx9JKrBNMuiqdm8W/JCW5/hRUCAHTY/qGK3gurtGug4xpAmHoa6WOYkZnl7VFXpMeev4UxsD8csP+/uL5i2rGVj2Qr1AgMBAAEwDQYJKoZIhvcNAQELBQADggEBAAKm6YvjKgmLNfCP7ylQ3ZVhLZfhlezXYKIEeW+sRt2tIwt6P92ueJbHq2rb5N0f9S3L9Rw1Y35MU2Ar8v9uIMwQYZQSmb0Oi1mvD4BhMa1HETuLNC7GM8p5jnbfvEVppkw84wiZaO7dDp1sfgHDQBg1RNhMowzkaWIF4WNLyLZ1oc9AP9ZK37LhHJuhN66LfNBXXw7hOzc3zZR7vwWe2z4tEg281ZeZ4jud5A4uVsY0PIiWmJ/hrlDOwUT0s8/YlLbLe49XI/LjQcnsJyt3YF0q05fOpXETgLr/NB+QrSnwbyTdTAD9SoW+avLUby056BYI7Ev9oGbVzqFySQ/Ji4E=urn:oasis:names:tc:SAML:2.0:nameid-format:persistenturn:oasis:names:tc:SAML:2.0:nameid-format:transienturn:oasis:names:tc:SAML:1.1:nameid-format:unspecifiedurn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress
```
--------------------------------
### Configure Command Options and Piping
Source: https://github.com/laurent22/joplin/blob/dev/readme/licenses.md
Example of a full magicli configuration, demonstrating how to set up commands, enumerability, subcommand delimiters, parameter validation, help options, version options, and global pipe handlers for stdin, before, and after transformations.
```javascript
magicli({
commands,
enumerability,
subcommandDelimiter,
validateRequiredParameters,
help: {
option,
stripAnsi
},
version: {
option
},
pipe: {
stdin: (stdinValue, args, positionalArgs, argsAfterEndOfOptions) => {},
before: (args, positionalArgs, argsAfterEndOfOptions) => {},
after: (result, parsedArgs, positionalArgs, argsAfterEndOfOptions) => {}
}
});
```
--------------------------------
### GET /events
Source: https://github.com/laurent22/joplin/blob/dev/readme/api/references/rest_api.md
Retrieves a paginated list of recent events, starting from a specified cursor.
```APIDOC
## GET /events
### Description
Returns a paginated list of recent events. A `cursor` parameter can be provided to specify the starting point for retrieving events. The response includes a `cursor` for subsequent calls, an `has_more` flag, and the list of `items`.
### Method
GET
### Endpoint
/events
### Parameters
#### Query Parameters
- **cursor** (string) - Optional - A cursor indicating from what point in time to retrieve events. If not provided, the API responds with the latest change ID.
### Response
#### Success Response
- **cursor** (string) - A cursor to use for retrieving subsequent events.
- **has_more** (boolean) - Indicates if more events can be retrieved.
- **items** (array) - An array of event objects.
- **id** (int) - The event ID.
- **item_type** (int) - The type of the item associated with the event.
- **item_id** (text) - The ID of the item.
- **type** (int) - The type of change (1: created, 2: updated, 3: deleted).
- **created_time** (int) - When the event was generated.
- **source** (int) - Unused.
- **before_change_item** (text) - Unused.
### Response Example
```json
{
"cursor": "latest-event-id",
"has_more": true,
"items": [
{
"id": 123,
"item_type": 1,
"item_id": "note-id-1",
"type": 2,
"created_time": 1678887000,
"source": 0,
"before_change_item": null
}
]
}
```
```
--------------------------------
### Example CLI Help Output
Source: https://github.com/laurent22/joplin/blob/dev/readme/licenses.md
Displays the improved help section generated after configuring options with descriptions and requirements. This shows how the CLI presents information to the user.
```bash
Description:
Just an example that will do nothing but concat all the parameters.
Usage:
$ some-command [options] [args...]
Options:
--param1
--param2
--param3
--args
```
--------------------------------
### Start Sync Fuzzer with Debug Options
Source: https://github.com/laurent22/joplin/blob/dev/readme/dev/spec/server_debug.md
Starts the sync fuzzer with options for debugging, such as specifying a setup file, snapshotting after a certain number of steps, or restoring from a snapshot. Use this in conjunction with a VS Code JavaScript Debug Terminal.
```shell
yarn syncFuzzer start --setup= --snapshot-after= --restore-from-snapshot
```
--------------------------------
### Running CLI with Parameters
Source: https://github.com/laurent22/joplin/blob/dev/readme/licenses.md
Demonstrates how to run the CLI program with specific parameters and arguments. This example shows the expected input format for the command.
```bash
node cli.js --param1=001 --param2=002 --param3=PARAM3 a r g s
```
--------------------------------
### Get Prototype Chain Example
Source: https://github.com/laurent22/joplin/blob/dev/readme/licenses.md
Demonstrates how to use the 'get-prototype-chain' module to retrieve the prototype chain of an object and map it to constructor names.
```javascript
const getPrototypeChain = require('get-prototype-chain');
class A {
}
class B extends A {
}
class C extends B {
}
var obj = new C();
getPrototypeChain(obj).map(x => x.constructor.name)
// returns ['C', 'C', 'B', 'A', 'Object']
```
--------------------------------
### trim package installation instructions
Source: https://github.com/laurent22/joplin/blob/dev/readme/licenses.md
Shows how to install the 'trim' package using npm or component.
```bash
$ npm install trim
$ component install component/trim
```
--------------------------------
### Install whisper.cpp with Conan
Source: https://github.com/laurent22/joplin/blob/dev/packages/whisper-voice-typing/vendor/whisper.cpp/README.md
Install pre-built binaries or build whisper.cpp from source using Conan. Use --build=missing to build from source if needed.
```bash
conan install --requires="whisper-cpp/[*]" --build=missing
```
--------------------------------
### AWS S3 Bucket Policy Example
Source: https://github.com/laurent22/joplin/blob/dev/readme/apps/sync/s3.md
This JSON policy grants necessary S3 permissions for Joplin to list buckets, get bucket location, and perform object operations (get, delete, put). Ensure your bucket name is correctly substituted.
```json
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": [
"s3:ListBucket",
"s3:GetBucketLocation",
"s3:GetObject",
"s3:DeleteObject",
"s3:DeleteObjectVersion",
"s3:PutObject"
],
"Resource": [
"arn:aws:s3:::joplin-bucket",
"arn:aws:s3:::joplin-bucket/*"
]
}
]
}
```
--------------------------------
### JavaScript Usage Example for appdirsjs
Source: https://github.com/laurent22/joplin/blob/dev/readme/licenses.md
Demonstrates how to import and use the appdirsjs library to get platform-specific cache, config, and data directory paths for an application.
```javascript
import appDirs from "appdirsjs";
const dirs = appDirs({ appName: "expo" });
console.log(dirs.cache);
// /home/user/.cache/expo on Linux
// /Users/User/Library/Caches/expo on MacOS
// C:\Users\User\AppData\Local\Temp\expo on Windows
console.log(dirs.config);
// /home/user/.config/expo on Linux
// /Users/User/Library/Preferences/expo on MacOS
// C:\Users\User\AppData\Roaming\expo
console.log(dirs.data);
// /home/user/.local/share/expo on Linux
// /Users/User/Library/Application Support/expo on MacOS
// C:\Users\User\AppData\Local\expo
```
--------------------------------
### Build only the 'main' example binary
Source: https://github.com/laurent22/joplin/blob/dev/packages/whisper-voice-typing/vendor/whisper.cpp/README_sycl.md
Use CMake to build only the 'main' example binary for faster compilation. This is recommended when not all binaries are needed.
```bash
mkdir -p build
cd build
source /opt/intel/oneapi/setvars.sh
cmake .. -DWHISPER_SYCL=ON -DCMAKE_C_COMPILER=icx -DCMAKE_CXX_COMPILER=icpx
#build example/main only
cmake --build . --config Release --target main
```
--------------------------------
### WebSocket Connection Example with SOCKS Proxy
Source: https://github.com/laurent22/joplin/blob/dev/readme/licenses.md
Demonstrates how to establish a WebSocket connection through a SOCKS proxy using the 'ws' and 'socks-proxy-agent' packages. Ensure these modules are installed.
```javascript
var WebSocket = require('ws');
var SocksProxyAgent = require('socks-proxy-agent');
// SOCKS proxy to connect to
var proxy = process.env.socks_proxy || 'socks://127.0.0.1:1080';
console.log('using proxy server %j', proxy);
// WebSocket endpoint for the proxy to connect to
var endpoint = process.argv[2] || 'ws://echo.websocket.org';
console.log('attempting to connect to WebSocket %j', endpoint);
// create an instance of the `SocksProxyAgent` class with the proxy server information
var agent = new SocksProxyAgent(proxy);
// initiate the WebSocket connection
var socket = new WebSocket(endpoint, { agent: agent });
socket.on('open', function () {
console.log('"open" event!');
socket.send('hello world');
});
socket.on('message', function (data, flags) {
console.log('"message" event! %j %j', data, flags);
socket.close();
});
```
--------------------------------
### Run Example App on iOS
Source: https://github.com/laurent22/joplin/blob/dev/packages/react-native-saf-x/CONTRIBUTING.md
Builds and runs the example application on an iOS simulator or device.
```sh
yarn example ios
```
--------------------------------
### Install Joplin Terminal Application
Source: https://github.com/laurent22/joplin/blob/dev/readme/apps/terminal.md
Installs the Joplin Terminal application globally using npm. Ensure Node.js 12+ is installed first. The binary is typically installed in ~/.joplin-bin.
```bash
NPM_CONFIG_PREFIX=~/.joplin-bin npm install --loglevel=error -g joplin
sudo ln -s ~/.joplin-bin/bin/joplin /usr/local/bin/joplin
```
--------------------------------
### Installing Whisper Target and Headers
Source: https://github.com/laurent22/joplin/blob/dev/packages/whisper-voice-typing/vendor/whisper.cpp/CMakeLists.txt
Installs the Whisper library target and its public header file to the specified installation directories.
```cmake
set_target_properties(whisper PROPERTIES PUBLIC_HEADER ${CMAKE_CURRENT_SOURCE_DIR}/include/whisper.h)
install(TARGETS whisper LIBRARY PUBLIC_HEADER)
```
--------------------------------
### Run Example App on Android
Source: https://github.com/laurent22/joplin/blob/dev/packages/react-native-saf-x/CONTRIBUTING.md
Builds and runs the example application on an Android device or emulator.
```sh
yarn example android
```
--------------------------------
### Install Metal Files
Source: https://github.com/laurent22/joplin/blob/dev/packages/whisper-voice-typing/vendor/whisper.cpp/ggml/src/ggml-metal/CMakeLists.txt
Installs the Metal shader source file and the compiled metallib to the installation bin directory when not embedding the library.
```cmake
if (NOT GGML_METAL_EMBED_LIBRARY)
install(
FILES src/ggml-metal/ggml-metal.metal
PERMISSIONS
OWNER_READ
OWNER_WRITE
GROUP_READ
WORLD_READ
DESTINATION ${CMAKE_INSTALL_BINDIR})
install(
FILES ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/default.metallib
DESTINATION ${CMAKE_INSTALL_BINDIR}
)
endif()
```
--------------------------------
### Bootstrap Project Dependencies
Source: https://github.com/laurent22/joplin/blob/dev/packages/react-native-saf-x/CONTRIBUTING.md
Installs all project dependencies and pods, setting up the development environment.
```sh
yarn bootstrap
```
--------------------------------
### Install Devbox Dependencies
Source: https://github.com/laurent22/joplin/blob/dev/readme/dev/BUILD.md
Automatically install required dependencies on Linux or MacOS using devbox. Ensure you have devbox installed by following the provided instructions.
```sh
devbox shell
```
--------------------------------
### Start Joplin Server for Development
Source: https://github.com/laurent22/joplin/blob/dev/packages/server/README.md
Navigate to the 'packages/server' directory and run this command to start the Joplin Server in development mode.
```bash
npm run start-dev
```
--------------------------------
### Install Project Dependencies
Source: https://github.com/laurent22/joplin/blob/dev/packages/react-native-saf-x/CONTRIBUTING.md
Run this command in the root directory to install all required dependencies for each package.
```sh
yarn
```
--------------------------------
### Install chromium-pickle-js
Source: https://github.com/laurent22/joplin/blob/dev/readme/licenses.md
Install the chromium-pickle-js package using npm.
```bash
$ npm install chromium-pickle-js
```
--------------------------------
### Recursive Directory Traversal with findit
Source: https://github.com/laurent22/joplin/blob/dev/readme/licenses.md
This example demonstrates how to use the 'findit' module to recursively walk directory trees. It logs directories, files, and symbolic links, with options to stop traversal for specific directories like '.git' or 'node_modules'.
```javascript
var finder = require('findit')(process.argv[2] || '.');
var path = require('path');
finder.on('directory', function (dir, stat, stop) {
var base = path.basename(dir);
if (base === '.git' || base === 'node_modules') stop()
else console.log(dir + '/')
});
finder.on('file', function (file, stat) {
console.log(file);
});
finder.on('link', function (link, stat) {
console.log(link);
});
```
--------------------------------
### Install socks-proxy-agent
Source: https://github.com/laurent22/joplin/blob/dev/readme/licenses.md
Install the socks-proxy-agent package using npm.
```bash
$ npm install socks-proxy-agent
```
--------------------------------
### Install @polka/url
Source: https://github.com/laurent22/joplin/blob/dev/readme/licenses.md
Install the @polka/url package using npm.
```bash
$ npm install --save @polka/url
```
--------------------------------
### Run Real-time Audio Input Example
Source: https://github.com/laurent22/joplin/blob/dev/packages/whisper-voice-typing/vendor/whisper.cpp/README.md
Run the real-time audio input example using whisper-stream. Specify model, threads, step, and length parameters.
```bash
./build/bin/whisper-stream -m ./models/ggml-base.en.bin -t 8 --step 500 --length 5000
```