jq is useful to slice, filter, map and transform structured json data.
brew install jq
| #!/usr/bin/env Rscript | |
| # Title : Execute Shiny App | |
| # Objective : Initialize Plumber and run Shiny app as "future" (background) worker as defined by local app.R or server.R/ui.R | |
| # Created by: John Hall | |
| library("future") | |
| library("httr") | |
| library("httpuv") | |
| library("magrittr") | |
| library("plumber") | |
| library("shiny") |
| #Requires -Modules @{ ModuleName = 'PwshSpectreConsole'; RequiredVersion = '2.1.1' } | |
| Set-SpectreColors -AccentColor DeepPink1 | |
| # Build root layout scaffolding for: | |
| # .--------------------------------. | |
| # | Title | <- Update-TitleComponent will render the title | |
| # |--------------------------------| | |
| # | | <- Update-MessageListComponent will display the list of messages here | |
| # | | |
| <# | |
| .SYNOPSIS | |
| PUT SHORT SCRIPT DESCRIPTION HERE AND ADD ANY ADDITIONAL KEYWORD SECTIONS AS NEEDED (.PARAMETER, .EXAMPLE, ETC.). | |
| #> | |
| [CmdletBinding()] | |
| param ( | |
| # PUT PARAMETER DEFINITIONS HERE AND DELETE THIS COMMENT. | |
| ) | |
| process { |
| function Invoke-ScriptBlockWithRetries { | |
| [CmdletBinding(DefaultParameterSetName = 'RetryNonTerminatingErrors')] | |
| param ( | |
| [Parameter(Mandatory = $true, HelpMessage = "The script block to execute.")] | |
| [ValidateNotNull()] | |
| [scriptblock] $ScriptBlock, | |
| [Parameter(Mandatory = $false, HelpMessage = "The maximum number of times to attempt the script block when it returns an error.")] | |
| [ValidateRange(1, [int]::MaxValue)] | |
| [int] $MaxNumberOfAttempts = 5, |
| .PHONY: buildsite check clean coverage docs getwd initialize install load render setwd start test usegit | |
| .DEFAULT_GOAL := help | |
| define BROWSER_PYSCRIPT | |
| import os, webbrowser, sys | |
| from urllib.request import pathname2url | |
| # The input is expected to be the full HTML filename | |
| filename = sys.argv[1] | |
| filepath = os.path.abspath(os.path.join("./vignettes/", filename)) |
| sfThemeSelector = function() { | |
| # -------------------------------------------------------------------------- | |
| # Allow dynamic update of bootstrap theme. | |
| # -------------------------------------------------------------------------- | |
| div( | |
| div( | |
| selectInput( | |
| "shinytheme-selector", "Select theme:", | |
| c("default", shinythemes:::allThemes()), |
https://speakerdeck.com/jcheng5/shiny-x-ai
| from typing import Any, Dict, List, Type | |
| import instructor | |
| from anthropic import Anthropic | |
| from config.settings import get_settings | |
| from openai import OpenAI | |
| from pydantic import BaseModel, Field | |
| class LLMFactory: |
| // 2022-04-03, tested with Chrome 99.0.4844.84 on MacBook Pro m1 | |
| /* | |
| Open chrome://flags/ | |
| F12 open developer console, swtich to tab "Console" | |
| Paste below codes | |
| - input backup() to download flags backup file | |
| - input restore() to select one backup to restore | |
| */ | |
| function saveFile(filename, data) { |