feat: many updates

This commit is contained in:
2023-05-01 00:44:19 +03:00
parent 4f4aee5c4d
commit 34fe71da8e
36 changed files with 1173 additions and 870 deletions

View File

@@ -1,10 +1,16 @@
local mark = require('harpoon.mark')
local ui = require('harpoon.ui')
vim.keymap.set('n', '<leader>a', mark.add_file)
vim.keymap.set('n', '<C-e>', ui.toggle_quick_menu)
vim.keymap.set('n', '<C-h>', function() ui.nav_file(1) end)
vim.keymap.set('n', '<C-t>', function() ui.nav_file(2) end)
vim.keymap.set('n', '<C-n>', function() ui.nav_file(3) end)
vim.keymap.set('n', '<C-s>', function() ui.nav_file(4) end)
vim.keymap.set('n', '<leader>a', mark.add_file, { desc = "Add file to Harpoon" })
vim.keymap.set('n', '<C-H>', ui.toggle_quick_menu, { desc = "Toggle Harpoon Quick Menu" })
vim.keymap.set('n', '<C-1>', function() ui.nav_file(1) end, { desc = "Navigate to Harpoon mark 1" })
vim.keymap.set('n', '<C-2>', function() ui.nav_file(2) end, { desc = "Navigate to Harpoon mark 2" })
vim.keymap.set('n', '<C-3>', function() ui.nav_file(3) end, { desc = "Navigate to Harpoon mark 3" })
vim.keymap.set('n', '<C-4>', function() ui.nav_file(4) end, { desc = "Navigate to Harpoon mark 4" })
vim.keymap.set('n', '<C-5>', function() ui.nav_file(5) end, { desc = "Navigate to Harpoon mark 5" })
vim.keymap.set('n', '<C-6>', function() ui.nav_file(6) end, { desc = "Navigate to Harpoon mark 6" })
vim.keymap.set('n', '<C-7>', function() ui.nav_file(7) end, { desc = "Navigate to Harpoon mark 7" })
vim.keymap.set('n', '<C-8>', function() ui.nav_file(8) end, { desc = "Navigate to Harpoon mark 8" })
vim.keymap.set('n', '<C-9>', function() ui.nav_file(8) end, { desc = "Navigate to Harpoon mark 9" })
vim.keymap.set('n', '<C-0>', function() ui.nav_file(10) end, { desc = "Navigate to Harpoon mark 10" })

View File

@@ -0,0 +1,25 @@
vim.keymap.set("n", "<leader>E", ":NvimTreeToggle<CR>", { noremap = true, silent = true })
vim.keymap.set("n", "<leader>e", ":NvimTreeFindFile<CR>", { noremap = true, silent = true })
-- vim.cmd("vnew splitright")
-- empty setup using defaults
-- require("nvim-tree").setup({
-- on_attach = function()
-- vim.cmd("vnew splitright")
-- end,
-- })
-- OR setup with some options
-- require("nvim-tree").setup({
-- sort_by = "case_sensitive",
-- view = {
-- width = 30,
-- },
-- renderer = {
-- group_empty = true,
-- },
-- filters = {
-- dotfiles = true,
-- },
-- })

View File

@@ -113,4 +113,6 @@ return require('packer').startup(function(use)
use('neoclide/coc.nvim', { branch = 'release' })
use('mfussenegger/nvim-dap')
use('github/copilot.vim')
use('nvim-tree/nvim-tree.lua')
end)

View File

@@ -26,3 +26,8 @@ vim.opt.updatetime = 50
vim.opt.colorcolumn = "100"
vim.g.mapleader = " "
-- nvim-tree
-- disable netrw at the very start of your init.lua (strongly advised)
-- vim.g.loaded_netrw = 1
-- vim.g.loaded_netrwPlugin = 1

View File

@@ -27,3 +27,4 @@
- [x] Make next template incremental (`yarn create next-app` + copy rest of tpl)
- [x] Make CRA template (same)
- [ ] Improve generic user store/api login flow in template
- [ ] Nvim Tree - use Ctrl-E to run `:NvimTreeFindFile` only in appropriate panes

View File

@@ -310,3 +310,4 @@ tn-general () {
# since you just created the session).
tmux attach-session -d -t general
}

View File

@@ -122,6 +122,10 @@ else
echo_cyan "All npm packages already installed."
fi
if [[ ! -d $HOME/.zplug ]]; then
curl -sL --proto-redir -all,https https://raw.githubusercontent.com/zplug/installer/master/installer.zsh | zsh
fi
if [[ ! -d ~/.local/share/nvim/site/pack/packer/start/packer.nvim ]]; then
echo_cyan "Installing packer.nvim..."
git clone --depth 1 https://github.com/wbthomason/packer.nvim ~/.local/share/nvim/site/pack/packer/start/packer.nvim

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>autoUpdate</key>
<true/>
<key>showInPalette</key>
<true/>
</dict>
</plist>

View File

@@ -8,6 +8,32 @@
<string>Internet</string>
<key>connections</key>
<dict>
<key>1BD6325A-1219-4F0A-B4EE-DC9C96450986</key>
<array>
<dict>
<key>destinationuid</key>
<string>4040E349-B23C-4B4A-A496-72D33F51E2B2</string>
<key>modifiers</key>
<integer>0</integer>
<key>modifiersubtext</key>
<string></string>
<key>vitoclose</key>
<false/>
</dict>
</array>
<key>4040E349-B23C-4B4A-A496-72D33F51E2B2</key>
<array>
<dict>
<key>destinationuid</key>
<string>B0199F8A-B91F-4A44-86AF-F910CC94EF82</string>
<key>modifiers</key>
<integer>0</integer>
<key>modifiersubtext</key>
<string></string>
<key>vitoclose</key>
<false/>
</dict>
</array>
<key>58619DEC-D6A7-4344-B557-5617B39F12DF</key>
<array/>
<key>6079855E-22E9-4B4C-8DD5-919CB258064A</key>
@@ -36,6 +62,33 @@
<false/>
</dict>
</array>
<key>B0199F8A-B91F-4A44-86AF-F910CC94EF82</key>
<array>
<dict>
<key>destinationuid</key>
<string>90677662-35FF-41CB-93F4-6758357932B1</string>
<key>modifiers</key>
<integer>0</integer>
<key>modifiersubtext</key>
<string></string>
<key>sourceoutputuid</key>
<string>3A6D3743-A6D3-4E6F-9250-65C6BFFA34E8</string>
<key>vitoclose</key>
<false/>
</dict>
<dict>
<key>destinationuid</key>
<string>B8455555-F05D-4969-83C9-5DE09914B79D</string>
<key>modifiers</key>
<integer>0</integer>
<key>modifiersubtext</key>
<string></string>
<key>sourceoutputuid</key>
<string>63D8D915-7251-4C96-93B5-C3F997C3CB12</string>
<key>vitoclose</key>
<false/>
</dict>
</array>
<key>B8455555-F05D-4969-83C9-5DE09914B79D</key>
<array>
<dict>
@@ -86,29 +139,6 @@
<key>version</key>
<integer>1</integer>
</dict>
<dict>
<key>config</key>
<dict>
<key>concurrently</key>
<false/>
<key>escaping</key>
<integer>0</integer>
<key>script</key>
<string>python3 openurls.py -u="${1}"</string>
<key>scriptargtype</key>
<integer>1</integer>
<key>scriptfile</key>
<string></string>
<key>type</key>
<integer>0</integer>
</dict>
<key>type</key>
<string>alfred.workflow.action.script</string>
<key>uid</key>
<string>58619DEC-D6A7-4344-B557-5617B39F12DF</string>
<key>version</key>
<integer>2</integer>
</dict>
<dict>
<key>config</key>
<dict>
@@ -158,6 +188,124 @@
<key>version</key>
<integer>3</integer>
</dict>
<dict>
<key>config</key>
<dict>
<key>availableviaurlhandler</key>
<false/>
<key>triggerid</key>
<string>mtvID</string>
</dict>
<key>type</key>
<string>alfred.workflow.trigger.external</string>
<key>uid</key>
<string>1BD6325A-1219-4F0A-B4EE-DC9C96450986</string>
<key>version</key>
<integer>1</integer>
</dict>
<dict>
<key>config</key>
<dict>
<key>concurrently</key>
<false/>
<key>escaping</key>
<integer>0</integer>
<key>script</key>
<string>python3 openurls.py -u="${1}"</string>
<key>scriptargtype</key>
<integer>1</integer>
<key>scriptfile</key>
<string></string>
<key>type</key>
<integer>0</integer>
</dict>
<key>type</key>
<string>alfred.workflow.action.script</string>
<key>uid</key>
<string>58619DEC-D6A7-4344-B557-5617B39F12DF</string>
<key>version</key>
<integer>2</integer>
</dict>
<dict>
<key>config</key>
<dict>
<key>conditions</key>
<array>
<dict>
<key>inputstring</key>
<string>{var:split1}</string>
<key>matchcasesensitive</key>
<false/>
<key>matchmode</key>
<integer>0</integer>
<key>matchstring</key>
<string>m</string>
<key>outputlabel</key>
<string>movie</string>
<key>uid</key>
<string>3A6D3743-A6D3-4E6F-9250-65C6BFFA34E8</string>
</dict>
<dict>
<key>inputstring</key>
<string>{var:split1}</string>
<key>matchcasesensitive</key>
<false/>
<key>matchmode</key>
<integer>0</integer>
<key>matchstring</key>
<string>t</string>
<key>outputlabel</key>
<string>tv</string>
<key>uid</key>
<string>63D8D915-7251-4C96-93B5-C3F997C3CB12</string>
</dict>
</array>
<key>elselabel</key>
<string>else</string>
<key>hideelse</key>
<true/>
</dict>
<key>type</key>
<string>alfred.workflow.utility.conditional</string>
<key>uid</key>
<string>B0199F8A-B91F-4A44-86AF-F910CC94EF82</string>
<key>version</key>
<integer>1</integer>
</dict>
<dict>
<key>config</key>
<dict>
<key>delimiter</key>
<string>:</string>
<key>discardemptyarguments</key>
<false/>
<key>outputas</key>
<integer>0</integer>
<key>trimarguments</key>
<true/>
<key>variableprefix</key>
<string>split</string>
</dict>
<key>type</key>
<string>alfred.workflow.utility.split</string>
<key>uid</key>
<string>4040E349-B23C-4B4A-A496-72D33F51E2B2</string>
<key>version</key>
<integer>1</integer>
</dict>
<dict>
<key>config</key>
<dict>
<key>text</key>
<string>Search tv shows for '{query}'</string>
</dict>
<key>type</key>
<string>alfred.workflow.trigger.fallback</string>
<key>uid</key>
<string>FA1D6F95-2A45-46E1-A83E-9C93D722AB02</string>
<key>version</key>
<integer>1</integer>
</dict>
<dict>
<key>config</key>
<dict>
@@ -207,19 +355,6 @@
<key>version</key>
<integer>3</integer>
</dict>
<dict>
<key>config</key>
<dict>
<key>text</key>
<string>Search tv shows for '{query}'</string>
</dict>
<key>type</key>
<string>alfred.workflow.trigger.fallback</string>
<key>uid</key>
<string>FA1D6F95-2A45-46E1-A83E-9C93D722AB02</string>
<key>version</key>
<integer>1</integer>
</dict>
</array>
<key>readme</key>
<string>Run the Movie Search Keyword (default: `movie`) or TV Search Keyword (default: `tv`) to search for movies and TV shows, respectively. Press ↩ to get details and ratings.
@@ -228,40 +363,61 @@
![](img/about/walle-details.png)</string>
<key>uidata</key>
<dict>
<key>1BD6325A-1219-4F0A-B4EE-DC9C96450986</key>
<dict>
<key>xpos</key>
<real>110</real>
<key>ypos</key>
<real>270</real>
</dict>
<key>4040E349-B23C-4B4A-A496-72D33F51E2B2</key>
<dict>
<key>xpos</key>
<real>260</real>
<key>ypos</key>
<real>300</real>
</dict>
<key>58619DEC-D6A7-4344-B557-5617B39F12DF</key>
<dict>
<key>xpos</key>
<real>500</real>
<real>660</real>
<key>ypos</key>
<real>15</real>
<real>275</real>
</dict>
<key>6079855E-22E9-4B4C-8DD5-919CB258064A</key>
<dict>
<key>xpos</key>
<real>100</real>
<real>110</real>
<key>ypos</key>
<real>15</real>
<real>140</real>
</dict>
<key>90677662-35FF-41CB-93F4-6758357932B1</key>
<dict>
<key>xpos</key>
<real>300</real>
<real>460</real>
<key>ypos</key>
<real>15</real>
<real>140</real>
</dict>
<key>B0199F8A-B91F-4A44-86AF-F910CC94EF82</key>
<dict>
<key>xpos</key>
<real>330</real>
<key>ypos</key>
<real>290</real>
</dict>
<key>B8455555-F05D-4969-83C9-5DE09914B79D</key>
<dict>
<key>xpos</key>
<real>300</real>
<real>460</real>
<key>ypos</key>
<real>150</real>
<real>405</real>
</dict>
<key>FA1D6F95-2A45-46E1-A83E-9C93D722AB02</key>
<dict>
<key>xpos</key>
<real>100</real>
<real>110</real>
<key>ypos</key>
<real>150</real>
<real>405</real>
</dict>
</dict>
<key>userconfigurationconfig</key>
@@ -430,7 +586,7 @@
</dict>
</array>
<key>version</key>
<string>2.15.1</string>
<string>2.16.1</string>
<key>webaddress</key>
<string>https://github.com/tmcknight/Movie-and-TV-Show-Search-Alfred-Workflow</string>
</dict>

View File

@@ -303,15 +303,18 @@ def show_item_info(item, media_type):
items.append({"title": omdb_info['Director'],
"subtitle": 'Director',
"icon": {"path": ICON_USER}})
"icon": {"path": ICON_USER},
"text": {"copy": omdb_info['Director']}})
items.append({"title": omdb_info['Writer'],
"subtitle": 'Writer',
"icon": {"path": ICON_USER}})
"icon": {"path": ICON_USER},
"text": {"copy": omdb_info['Writer']}})
items.append({"title": omdb_info['Actors'],
"subtitle": 'Actors',
"icon": {"path": ICON_GROUP}})
"icon": {"path": ICON_GROUP},
"text": {"copy": omdb_info['Actors']}})
generate_item_html(omdb_info, item, media_type)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 70 KiB

After

Width:  |  Height:  |  Size: 115 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 893 KiB

View File

@@ -48,9 +48,9 @@
<key>argumenttype</key>
<integer>0</integer>
<key>escaping</key>
<integer>102</integer>
<integer>0</integer>
<key>keyword</key>
<string>ud</string>
<string>{var:urban_dictionary_keyword}</string>
<key>queuedelaycustom</key>
<integer>3</integer>
<key>queuedelayimmediatelyinitially</key>
@@ -62,17 +62,17 @@
<key>runningsubtext</key>
<string>Fetching results...</string>
<key>script</key>
<string>python3 urban_dictionary.py "{query}"</string>
<key>scriptargtype</key>
<integer>0</integer>
<key>scriptfile</key>
<string></string>
<key>scriptargtype</key>
<integer>1</integer>
<key>scriptfile</key>
<string>urban_dictionary.py</string>
<key>subtext</key>
<string></string>
<key>title</key>
<string>Search Urban Dictionary</string>
<key>type</key>
<integer>0</integer>
<integer>8</integer>
<key>withspace</key>
<true/>
</dict>
@@ -106,7 +106,11 @@
</dict>
</array>
<key>readme</key>
<string>Call `ud` to search through Urban Dictionary definitions and ratings.</string>
<string>## Usage
Search Urban Dictionary definitions via the `ud` keyword.
![demo](images/about/demo.png)</string>
<key>uidata</key>
<dict>
<key>A86052C6-254B-48B5-BA86-3B44B7883695</key>
@@ -125,11 +129,33 @@
</dict>
</dict>
<key>userconfigurationconfig</key>
<array/>
<array>
<dict>
<key>config</key>
<dict>
<key>default</key>
<string>ud</string>
<key>placeholder</key>
<string></string>
<key>required</key>
<false/>
<key>trim</key>
<true/>
</dict>
<key>description</key>
<string></string>
<key>label</key>
<string>Search Keyword</string>
<key>type</key>
<string>textfield</string>
<key>variable</key>
<string>urban_dictionary_keyword</string>
</dict>
</array>
<key>variablesdontexport</key>
<array/>
<key>version</key>
<string>2.3.0</string>
<string>2.4.0</string>
<key>webaddress</key>
<string>https://github.com/xilopaint</string>
</dict>

View File

@@ -15,14 +15,6 @@ HELP_URL = "https://github.com/xilopaint/alfred-urban-dictionary"
def main(wf): # pylint: disable=redefined-outer-name
"""Run workflow."""
if wf.update_available:
wf.add_item(
title="A newer version of Urban Dictionary is available.",
subtitle="Action this item to install the update.",
autocomplete="workflow:update",
icon="update.png",
)
query = wf.args[0]
param = {"term": query}
url = "http://api.urbandictionary.com/v0/define"

View File

@@ -147,12 +147,12 @@ class Download:
@property
def dict(self):
"""Convert `Download` to `dict`."""
return dict(
url=self.url,
filename=self.filename,
version=str(self.version),
prerelease=self.prerelease,
)
return {
"url": self.url,
"filename": self.filename,
"version": str(self.version),
"prerelease": self.prerelease,
}
def __str__(self):
"""Format `Download` for printing."""
@@ -565,7 +565,7 @@ if __name__ == "__main__": # pragma: nocover
if len(argv) != 4:
show_help(1)
action = argv[1]
action = argv[1] # pylint: disable=invalid-name
repo = argv[2] # pylint: disable=invalid-name
version = argv[3] # pylint: disable=invalid-name

View File

@@ -84,8 +84,6 @@ def applescriptify(string):
def run_command(cmd, **kwargs):
"""Run a command and return the output.
.. versionadded:: 1.31
A thin wrapper around :func:`subprocess.check_output` that ensures
all arguments are encoded to UTF-8 first.

View File

@@ -116,8 +116,8 @@ class CaseInsensitiveDictionary(dict):
v = dict.__getitem__(self, key.lower())
except KeyError:
return default
else:
return v["val"]
return v["val"]
def update(self, other):
"""Update values from other ``dict``."""

View File

@@ -857,7 +857,6 @@ class Variables(dict):
def __init__(self, arg=None, **variables):
"""Create a new `Variables` object."""
# print("foo")
self.arg = arg
self.config = {}
super().__init__(**variables)
@@ -883,6 +882,21 @@ class Variables(dict):
return {"alfredworkflow": obj_}
def __str__(self):
"""Convert to ``alfredworkflow`` JSON object.
Returns:
unicode: ``alfredworkflow`` JSON object
"""
if not self and not self.config:
if not self.arg:
return ""
if isinstance(self.arg, str):
return self.arg
return json.dumps(self.obj)
class Modifier:
"""Modify :class:`Item` arg/icon/variables when modifier key is pressed.
@@ -1299,7 +1313,6 @@ class Workflow:
"workflow_uid",
"workflow_version",
):
value = os.getenv("alfred_" + key, "")
if value:
@@ -1377,7 +1390,6 @@ class Workflow:
"""
if self._version is UNSET:
version = None
# environment variable has priority
if self.alfred_env.get("workflow_version"):
@@ -1761,52 +1773,6 @@ class Workflow:
self._data_serializer = serializer_name
def stored_data(self, name):
"""Retrieve data from data directory.
Returns ``None`` if there are no data stored under ``name``.
:param name: name of datastore
"""
metadata_path = self.datafile(f".{name}.alfred-workflow")
if not os.path.exists(metadata_path):
self.logger.debug("no data stored for `%s`", name)
return None
with open(metadata_path, "r", encoding="utf-8") as file_obj:
serializer_name = file_obj.read().strip()
serializer = manager.serializer(serializer_name)
if serializer is None:
raise ValueError(
f"Unknown serializer `{serializer_name}`. "
"Register a corresponding serializer with `manager.register()`"
" to load this data."
)
self.logger.debug("data `%s` stored as `%s`", name, serializer_name)
filename = f"{name}.{serializer_name}"
data_path = self.datafile(filename)
if not os.path.exists(data_path):
self.logger.debug("no data stored: %s", name)
if os.path.exists(metadata_path):
os.unlink(metadata_path)
return None
with open(data_path, "rb") as file_obj:
data = serializer.load(file_obj)
self.logger.debug("stored data loaded: %s", data_path)
return data
def store_data(self, name, data, serializer=None):
"""Save data to data directory.
@@ -1823,6 +1789,7 @@ class Workflow:
:returns: data in datastore or ``None``
"""
# Ensure deletion is not interrupted by SIGTERM
@uninterruptible
def delete_paths(paths):
@@ -1877,22 +1844,137 @@ class Workflow:
self.logger.debug("saved data: %s", data_path)
def cached_data(self, name, data_func=None, max_age=60):
def stored_data(self, name):
"""Retrieve data from data directory.
Returns ``None`` if there are no data stored under ``name``.
:param name: name of datastore
"""
metadata_path = self.datafile(f".{name}.alfred-workflow")
if not os.path.exists(metadata_path):
self.logger.debug("no data stored for `%s`", name)
return None
with open(metadata_path, "r", encoding="utf-8") as file_obj:
serializer_name = file_obj.read().strip()
serializer = manager.serializer(serializer_name)
if serializer is None:
raise ValueError(
f"Unknown serializer `{serializer_name}`. "
"Register a corresponding serializer with `manager.register()`"
" to load this data."
)
self.logger.debug("data `%s` stored as `%s`", name, serializer_name)
filename = f"{name}.{serializer_name}"
data_path = self.datafile(filename)
if not os.path.exists(data_path):
self.logger.debug("no data stored: %s", name)
if os.path.exists(metadata_path):
os.unlink(metadata_path)
return None
with open(data_path, "rb") as file_obj:
data = serializer.load(file_obj)
self.logger.debug("stored data loaded: %s", data_path)
return data
@property
def _session_prefix(self):
"""Filename prefix for current session."""
return f"_wfsess-{self.session_id}-"
def _mk_session_name(self, name):
"""New cache name/key based on session ID."""
return self._session_prefix + name
def clear_session_cache(self, current=False):
"""Remove session data from the cache.
By default, data belonging to the current session won't be
deleted. Set ``current=True`` to also clear current session.
Args:
current (bool, optional): If ``True``, also remove data for
current session.
"""
def _is_session_file(filename):
if current:
return filename.startswith("_wfsess-")
return filename.startswith("_wfsess-") and not filename.startswith(
self._session_prefix
)
self.clear_cache(_is_session_file)
def cache_data(self, name, data, session=False):
"""Save ``data`` to cache under ``name``.
If ``data`` is ``None``, the corresponding cache file will be
deleted.
If ``session`` is ``True``, then ``name`` is prefixed
with :attr:`session_id`.
:param name: name of datastore
:param data: data to store. This may be any object supported by
the cache serializer
:param session: Whether to scope the cache to the current session.
"""
if session:
name = self._mk_session_name(name)
serializer = manager.serializer(self.cache_serializer)
cache_path = self.cachefile(f"{name}.{self.cache_serializer}")
if data is None:
if os.path.exists(cache_path):
os.unlink(cache_path)
self.logger.debug("deleted cache file: %s", cache_path)
return
with serializer.atomic_writer(cache_path, "w") as file_obj:
serializer.dump(data, file_obj)
self.logger.debug("cached data: %s", cache_path)
def cached_data(self, name, data_func=None, max_age=60, session=False):
"""Return cached data if younger than ``max_age`` seconds.
Retrieve data from cache or re-generate and re-cache data if
stale/non-existant. If ``max_age`` is 0, return cached data no
matter how old.
If ``session`` is ``True``, then ``name`` is prefixed
with :attr:`session_id`.
:param name: name of datastore
:param data_func: function to (re-)generate data.
:type data_func: ``callable``
:param max_age: maximum age of cached data in seconds
:type max_age: ``int``
:returns: cached data, return value of ``data_func`` or ``None``
if ``data_func`` is not set
"""
if session:
name = self._mk_session_name(name)
serializer = manager.serializer(self.cache_serializer)
cache_path = self.cachefile(f"{name}.{self.cache_serializer}")
@@ -1911,33 +1993,6 @@ class Workflow:
return data
def cache_data(self, name, data):
"""Save ``data`` to cache under ``name``.
If ``data`` is ``None``, the corresponding cache file will be
deleted.
:param name: name of datastore
:param data: data to store. This may be any object supported by
the cache serializer
"""
serializer = manager.serializer(self.cache_serializer)
cache_path = self.cachefile(f"{name}.{self.cache_serializer}")
if data is None:
if os.path.exists(cache_path):
os.unlink(cache_path)
self.logger.debug("deleted cache file: %s", cache_path)
return
with serializer.atomic_writer(cache_path, "w") as file_obj:
serializer.dump(data, file_obj)
self.logger.debug("cached data: %s", cache_path)
def cached_data_fresh(self, name, max_age):
"""Whether cache `name` is less than `max_age` seconds old.
@@ -2127,7 +2182,7 @@ class Workflow:
)
# sort on keys, then discard the keys
results.sort(reverse=ascending)
results.sort(key=lambda x: x[0], reverse=ascending)
results = [result[1] for result in results]
if min_score:
@@ -2810,6 +2865,7 @@ class Workflow:
def _register_default_magic(self):
"""Register the built-in magic arguments."""
# TODO: refactor & simplify
# Wrap callback and message with callable
def callback(func, msg):

View File

@@ -60,7 +60,7 @@ function runCommand(arguments) {
task.standardOutput = stdout
task.launchAndReturnError(false)
const dataOut = stdout.fileHandleForReading.readDataToEndOfFile
const dataOut = stdout.fileHandleForReading.readDataToEndOfFileAndReturnError(false)
const stringOut = $.NSString.alloc.initWithDataEncoding(dataOut, $.NSUTF8StringEncoding).js
return stringOut
@@ -86,15 +86,22 @@ function copySensitive(text) {
}
// String -> ()
function copyOTP(itemID) {
const allOTP = runOP("item", "get", "--field", "type=otp", itemID) // Can be array of objects, single object, or nothing
function copyOTP(itemID, vaultID, accountID) {
// Can be array of objects, single object, or nothing
const allOTP = runOP("item", "get", itemID,
"--field", "type=otp",
"--vault", vaultID, "--account", accountID)
const otp = allOTP.length > 0 ? allOTP[0]["totp"] : allOTP["totp"] // If more than one, get primary
copySensitive(otp)
}
// String -> ()
function copyByLabel(label, itemID) {
const value = runOP("item", "get", "--field", `label=${label}`, itemID)["value"]
function copyByLabel(label, itemID, vaultID, accountID) {
const value = runOP("item", "get", itemID,
"--field", `label=${label}`,
"--vault", vaultID, "--account", accountID)["value"]
copySensitive(value)
}
@@ -358,9 +365,9 @@ function run(argv) {
writeJSON(itemsFile, {items: sfItems})
break
case "copy_otp":
return copyOTP(argv[1])
return copyOTP(argv[1], argv[2], argv[3])
case "copy_by_label":
return copyByLabel(argv[1], argv[2])
return copyByLabel(argv[1], argv[2], argv[3], argv[4])
case "flip_user_exclusion":
flipExclusion(usersFile, "userID", argv[1])
return prependDataUpdate(itemsFile)

View File

@@ -1920,9 +1920,9 @@ echo "${new_items_hash}" &gt; "${items_hash_file}"</string>
case "${action}" in
'Open and Fill') echo -n 'openandfill';;
'View in 1Password') echo -n 'view';;
'Copy Username') ./1password.js 'copy_by_label' 'username' "${itemID}";;
'Copy Password') ./1password.js 'copy_by_label' 'password' "${itemID}";;
'Copy OTP') ./1password.js 'copy_otp' "${itemID}";;
'Copy Username') ./1password.js 'copy_by_label' 'username' "${itemID}" "${vaultID}" "${accountID}";;
'Copy Password') ./1password.js 'copy_by_label' 'password' "${itemID}" "${vaultID}" "${accountID}";;
'Copy OTP') ./1password.js 'copy_otp' "${itemID}" "${vaultID}" "${accountID}";;
*) echo "Invalid action: ${action}" &gt;&amp;2; exit 1
esac</string>
<key>scriptargtype</key>
@@ -2301,11 +2301,17 @@ fi</string>
## Usage
Interact with your 1Password items via the Search Keyword (default: `1p`). Set the actions for each &lt;kbd&gt;↩&lt;/kbd&gt; modifier in the [Workflows Configuration](https://www.alfredapp.com/help/workflows/user-configuration/).
Interact with your 1Password items via the `1p` keyword.
![Alfred search for 1p](images/about/1p.png)
Uncommon but useful actions, such as toggling vaults, can be accessed via `:1pextras`.
* &lt;kbd&gt;↩&lt;/kbd&gt;: Open and Fill.
* &lt;kbd&gt;⌘&lt;/kbd&gt;&lt;kbd&gt;↩&lt;/kbd&gt;: View in 1Password.
* &lt;kbd&gt;⌥&lt;/kbd&gt;&lt;kbd&gt;↩&lt;/kbd&gt;: Copy Password.
* &lt;kbd&gt;⌃&lt;/kbd&gt;&lt;kbd&gt;↩&lt;/kbd&gt;: Copy Username.
* &lt;kbd&gt;⇧&lt;/kbd&gt;&lt;kbd&gt;↩&lt;/kbd&gt;: Copy One-Time Password
Uncommon but useful actions, such as toggling vaults, can be accessed with `:1pextras`.
![Alfred search for :1pextras](images/about/1pextras.png)
@@ -2917,7 +2923,8 @@ To report a problem, run `!1pdiagnostic`.</string>
</array>
</dict>
<key>description</key>
<string></string>
<string>Actions to perform when pressing modifier keys.
Changes come into effect on next cache update.</string>
<key>label</key>
<string>⇧↩</string>
<key>type</key>
@@ -2984,7 +2991,7 @@ To report a problem, run `!1pdiagnostic`.</string>
</dict>
</array>
<key>version</key>
<string>2023.4</string>
<string>2023.7</string>
<key>webaddress</key>
<string>https://github.com/alfredapp/1password-workflow/</string>
</dict>

View File

Before

Width:  |  Height:  |  Size: 53 KiB

After

Width:  |  Height:  |  Size: 53 KiB

View File

@@ -1,19 +0,0 @@
# alfred-lipsum-workflow
![Screenshot](https://cloud.githubusercontent.com/assets/604167/14924481/ac6037e2-0df7-11e6-8558-b823fe868d1e.png)
An [Alfred 3](https://www.alfredapp.com/) workflow for generating [lorem ipsum](https://en.wikipedia.org/wiki/Lorem_ipsum) dummy text using [joshtronic/php-loremipsum](https://github.com/joshtronic/php-loremipsum).
## Installation
1. [Download the workflow](https://github.com/alexchantastic/alfred-lipsum-workflow/blob/master/alfred-lipsum-workflow.alfredworkflow?raw=true)
2. Double click the `.alfredworkflow` file to install
Note that the [Alfred Powerpack](https://www.alfredapp.com/powerpack/) is required to use workflows.
## Usage
1. Use the keyword `lipsum` to trigger the workflow
2. Select format you want to generate (words, sentences, or paragraphs)
3. (Optional) Type in the number of the format you would like to generate (defaults to 1)
4. Press `ENTER` to copy to clipboard and paste into the forefront application or just `⌘ + C` to copy to clipboard

View File

Before

Width:  |  Height:  |  Size: 53 KiB

After

Width:  |  Height:  |  Size: 53 KiB

View File

@@ -131,7 +131,13 @@
<key>escaping</key>
<integer>127</integer>
<key>script</key>
<string>php -f script.php "characters" "{query}"</string>
<string>count={query}
if [[ $count = "" ]]; then
count=1
fi
sh lipsum.sh -t characters -c $count</string>
<key>scriptargtype</key>
<integer>0</integer>
<key>scriptfile</key>
@@ -215,7 +221,13 @@
<key>escaping</key>
<integer>127</integer>
<key>script</key>
<string>php -f script.php "words" "{query}"</string>
<string>count={query}
if [[ $count = "" ]]; then
count=1
fi
sh lipsum.sh -t words -c $count</string>
<key>scriptargtype</key>
<integer>0</integer>
<key>scriptfile</key>
@@ -230,29 +242,6 @@
<key>version</key>
<integer>2</integer>
</dict>
<dict>
<key>config</key>
<dict>
<key>concurrently</key>
<false/>
<key>escaping</key>
<integer>127</integer>
<key>script</key>
<string>php -f script.php "sentences" "{query}"</string>
<key>scriptargtype</key>
<integer>0</integer>
<key>scriptfile</key>
<string></string>
<key>type</key>
<integer>0</integer>
</dict>
<key>type</key>
<string>alfred.workflow.action.script</string>
<key>uid</key>
<string>BACA329C-E588-479B-9FDC-35863B7E37F6</string>
<key>version</key>
<integer>2</integer>
</dict>
<dict>
<key>config</key>
<dict>
@@ -274,6 +263,35 @@
<key>version</key>
<integer>1</integer>
</dict>
<dict>
<key>config</key>
<dict>
<key>concurrently</key>
<false/>
<key>escaping</key>
<integer>127</integer>
<key>script</key>
<string>count={query}
if [[ $count = "" ]]; then
count=1
fi
sh lipsum.sh -t sentences -c $count</string>
<key>scriptargtype</key>
<integer>0</integer>
<key>scriptfile</key>
<string></string>
<key>type</key>
<integer>0</integer>
</dict>
<key>type</key>
<string>alfred.workflow.action.script</string>
<key>uid</key>
<string>BACA329C-E588-479B-9FDC-35863B7E37F6</string>
<key>version</key>
<integer>2</integer>
</dict>
<dict>
<key>config</key>
<dict>
@@ -303,7 +321,13 @@
<key>escaping</key>
<integer>127</integer>
<key>script</key>
<string>php -f script.php "paragraphs" "{query}"</string>
<string>count={query}
if [[ $count = "" ]]; then
count=1
fi
sh lipsum.sh -t paragraphs -c $count</string>
<key>scriptargtype</key>
<integer>0</integer>
<key>scriptfile</key>
@@ -320,77 +344,79 @@
</dict>
</array>
<key>readme</key>
<string>An Alfred 3 workflow for generating lorem ipsum dummy text using joshtronic/php-loremipsum.</string>
<string>An Alfred 5 workflow for generating lorem ipsum dummy text.</string>
<key>uidata</key>
<dict>
<key>1029C7B6-DB95-4448-B3C5-C33F3DA0F894</key>
<dict>
<key>xpos</key>
<integer>120</integer>
<real>120</real>
<key>ypos</key>
<integer>250</integer>
<real>250</real>
</dict>
<key>125F91DD-9720-45BD-9F14-08966CFC2643</key>
<dict>
<key>xpos</key>
<integer>530</integer>
<real>530</real>
<key>ypos</key>
<integer>10</integer>
<real>15</real>
</dict>
<key>2D3FFB80-A2C2-462F-9D62-82505DDCAEBB</key>
<dict>
<key>xpos</key>
<integer>120</integer>
<real>120</real>
<key>ypos</key>
<integer>10</integer>
<real>15</real>
</dict>
<key>65A6620E-EE2C-4D14-8123-BB4592DBABD2</key>
<dict>
<key>xpos</key>
<integer>320</integer>
<real>320</real>
<key>ypos</key>
<integer>370</integer>
<real>370</real>
</dict>
<key>7BD2998D-4CDE-4653-B6FB-B7BEF837A34C</key>
<dict>
<key>xpos</key>
<integer>120</integer>
<real>120</real>
<key>ypos</key>
<integer>130</integer>
<real>130</real>
</dict>
<key>81786618-C116-42AA-87BB-06537E229EEC</key>
<dict>
<key>xpos</key>
<integer>120</integer>
<real>120</real>
<key>ypos</key>
<integer>370</integer>
<real>370</real>
</dict>
<key>BACA329C-E588-479B-9FDC-35863B7E37F6</key>
<dict>
<key>xpos</key>
<integer>320</integer>
<real>320</real>
<key>ypos</key>
<integer>250</integer>
<real>250</real>
</dict>
<key>E92D3CF8-7C01-42C4-9BB5-6FD3109326A6</key>
<dict>
<key>xpos</key>
<integer>320</integer>
<real>320</real>
<key>ypos</key>
<integer>130</integer>
<real>130</real>
</dict>
<key>FC091BCF-5793-46A2-B88D-EB1A780BB71D</key>
<dict>
<key>xpos</key>
<integer>320</integer>
<real>320</real>
<key>ypos</key>
<integer>10</integer>
<real>15</real>
</dict>
</dict>
<key>userconfigurationconfig</key>
<array/>
<key>variablesdontexport</key>
<array/>
<key>version</key>
<string>2.2.0</string>
<string>4.0.3</string>
<key>webaddress</key>
<string>https://github.com/alexchantastic/alfred-lipsum-workflow</string>
</dict>

View File

@@ -1,372 +0,0 @@
<?php
/**
* Lorem Ipsum Generator
*
* PHP version 5.3+
*
* Licensed under The MIT License.
* Redistribution of these files must retain the above copyright notice.
*
* @author Josh Sherman <hello@joshtronic.com>
* @copyright Copyright 2014, 2015, 2016, 2017, 2018 Josh Sherman
* @license http://www.opensource.org/licenses/mit-license.html
* @link https://github.com/joshtronic/php-loremipsum
*/
namespace joshtronic;
class LoremIpsum
{
/**
* First
*
* Whether or not we should be starting the string with "Lorem ipsum..."
*
* @access private
* @var boolean
*/
private $first = false;
/**
* Words
*
* A lorem ipsum vocabulary of sorts. Not a complete list as I'm unsure if
* a complete list exists and if so, where to get it.
*
* @access private
* @var array
*/
public $words = array(
// Lorem ipsum...
'lorem', 'ipsum', 'dolor', 'sit', 'amet', 'consectetur', 'adipiscing', 'elit',
// and the rest of the vocabulary
'a', 'ac', 'accumsan', 'ad', 'aenean', 'aliquam', 'aliquet', 'ante',
'aptent', 'arcu', 'at', 'auctor', 'augue', 'bibendum', 'blandit',
'class', 'commodo', 'condimentum', 'congue', 'consequat', 'conubia',
'convallis', 'cras', 'cubilia', 'curabitur', 'curae', 'cursus',
'dapibus', 'diam', 'dictum', 'dictumst', 'dignissim', 'dis', 'donec',
'dui', 'duis', 'efficitur', 'egestas', 'eget', 'eleifend', 'elementum',
'enim', 'erat', 'eros', 'est', 'et', 'etiam', 'eu', 'euismod', 'ex',
'facilisi', 'facilisis', 'fames', 'faucibus', 'felis', 'fermentum',
'feugiat', 'finibus', 'fringilla', 'fusce', 'gravida', 'habitant',
'habitasse', 'hac', 'hendrerit', 'himenaeos', 'iaculis', 'id',
'imperdiet', 'in', 'inceptos', 'integer', 'interdum', 'justo',
'lacinia', 'lacus', 'laoreet', 'lectus', 'leo', 'libero', 'ligula',
'litora', 'lobortis', 'luctus', 'maecenas', 'magna', 'magnis',
'malesuada', 'massa', 'mattis', 'mauris', 'maximus', 'metus', 'mi',
'molestie', 'mollis', 'montes', 'morbi', 'mus', 'nam', 'nascetur',
'natoque', 'nec', 'neque', 'netus', 'nibh', 'nisi', 'nisl', 'non',
'nostra', 'nulla', 'nullam', 'nunc', 'odio', 'orci', 'ornare',
'parturient', 'pellentesque', 'penatibus', 'per', 'pharetra',
'phasellus', 'placerat', 'platea', 'porta', 'porttitor', 'posuere',
'potenti', 'praesent', 'pretium', 'primis', 'proin', 'pulvinar',
'purus', 'quam', 'quis', 'quisque', 'rhoncus', 'ridiculus', 'risus',
'rutrum', 'sagittis', 'sapien', 'scelerisque', 'sed', 'sem', 'semper',
'senectus', 'sociosqu', 'sodales', 'sollicitudin', 'suscipit',
'suspendisse', 'taciti', 'tellus', 'tempor', 'tempus', 'tincidunt',
'torquent', 'tortor', 'tristique', 'turpis', 'ullamcorper', 'ultrices',
'ultricies', 'urna', 'ut', 'varius', 'vehicula', 'vel', 'velit',
'venenatis', 'vestibulum', 'vitae', 'vivamus', 'viverra', 'volutpat',
'vulputate',
);
/**
* Word
*
* Generates a single word of lorem ipsum.
*
* @access public
* @param mixed $tags string or array of HTML tags to wrap output with
* @return string generated lorem ipsum word
*/
public function word($tags = false)
{
return $this->words(1, $tags);
}
/**
* Words Array
*
* Generates an array of lorem ipsum words.
*
* @access public
* @param integer $count how many words to generate
* @param mixed $tags string or array of HTML tags to wrap output with
* @return array generated lorem ipsum words
*/
public function wordsArray($count = 1, $tags = false)
{
return $this->words($count, $tags, true);
}
/**
* Words
*
* Generates words of lorem ipsum.
*
* @access public
* @param integer $count how many words to generate
* @param mixed $tags string or array of HTML tags to wrap output with
* @param boolean $array whether an array or a string should be returned
* @return mixed string or array of generated lorem ipsum words
*/
public function words($count = 1, $tags = false, $array = false)
{
$words = array();
$word_count = 0;
// Shuffles and appends the word list to compensate for count
// arguments that exceed the size of our vocabulary list
while ($word_count < $count) {
$shuffle = true;
while ($shuffle) {
$this->shuffle();
// Checks that the last word of the list and the first word of
// the list that's about to be appended are not the same
if (!$word_count || $words[$word_count - 1] != $this->words[0]) {
$words = array_merge($words, $this->words);
$word_count = count($words);
$shuffle = false;
}
}
}
$words = array_slice($words, 0, $count);
return $this->output($words, $tags, $array);
}
/**
* Sentence
*
* Generates a full sentence of lorem ipsum.
*
* @access public
* @param mixed $tags string or array of HTML tags to wrap output with
* @return string generated lorem ipsum sentence
*/
public function sentence($tags = false)
{
return $this->sentences(1, $tags);
}
/**
* Sentences Array
*
* Generates an array of lorem ipsum sentences.
*
* @access public
* @param integer $count how many sentences to generate
* @param mixed $tags string or array of HTML tags to wrap output with
* @return array generated lorem ipsum sentences
*/
public function sentencesArray($count = 1, $tags = false)
{
return $this->sentences($count, $tags, true);
}
/**
* Sentences
*
* Generates sentences of lorem ipsum.
*
* @access public
* @param integer $count how many sentences to generate
* @param mixed $tags string or array of HTML tags to wrap output with
* @param boolean $array whether an array or a string should be returned
* @return mixed string or array of generated lorem ipsum sentences
*/
public function sentences($count = 1, $tags = false, $array = false)
{
$sentences = array();
for ($i = 0; $i < $count; $i++) {
$sentences[] = $this->wordsArray($this->gauss(24.46, 5.08));
}
$this->punctuate($sentences);
return $this->output($sentences, $tags, $array);
}
/**
* Paragraph
*
* Generates a full paragraph of lorem ipsum.
*
* @access public
* @param mixed $tags string or array of HTML tags to wrap output with
* @return string generated lorem ipsum paragraph
*/
public function paragraph($tags = false)
{
return $this->paragraphs(1, $tags);
}
/**
* Paragraph Array
*
* Generates an array of lorem ipsum paragraphs.
*
* @access public
* @param integer $count how many paragraphs to generate
* @param mixed $tags string or array of HTML tags to wrap output with
* @return array generated lorem ipsum paragraphs
*/
public function paragraphsArray($count = 1, $tags = false)
{
return $this->paragraphs($count, $tags, true);
}
/**
* Paragraphss
*
* Generates paragraphs of lorem ipsum.
*
* @access public
* @param integer $count how many paragraphs to generate
* @param mixed $tags string or array of HTML tags to wrap output with
* @param boolean $array whether an array or a string should be returned
* @return mixed string or array of generated lorem ipsum paragraphs
*/
public function paragraphs($count = 1, $tags = false, $array = false)
{
$paragraphs = array();
for ($i = 0; $i < $count; $i++) {
$paragraphs[] = $this->sentences($this->gauss(5.8, 1.93));
}
return $this->output($paragraphs, $tags, $array, "\n\n");
}
/**
* Gaussian Distribution
*
* This is some smart kid stuff. I went ahead and combined the N(0,1) logic
* with the N(m,s) logic into this single function. Used to calculate the
* number of words in a sentence, the number of sentences in a paragraph
* and the distribution of commas in a sentence.
*
* @access private
* @param double $mean average value
* @param double $std_dev stadnard deviation
* @return double calculated distribution
*/
private function gauss($mean, $std_dev)
{
$x = mt_rand() / mt_getrandmax();
$y = mt_rand() / mt_getrandmax();
$z = sqrt(-2 * log($x)) * cos(2 * pi() * $y);
return $z * $std_dev + $mean;
}
/**
* Shuffle
*
* Shuffles the words, forcing "Lorem ipsum..." at the beginning if it is
* the first time we are generating the text.
*
* @access private
*/
private function shuffle()
{
if ($this->first) {
$this->first = array_slice($this->words, 0, 8);
$this->words = array_slice($this->words, 8);
shuffle($this->words);
$this->words = $this->first + $this->words;
$this->first = false;
} else {
shuffle($this->words);
}
}
/**
* Punctuate
*
* Applies punctuation to a sentence. This includes a period at the end,
* the injection of commas as well as capitalizing the first letter of the
* first word of the sentence.
*
* @access private
* @param array $sentences the sentences we would like to punctuate
*/
private function punctuate(&$sentences)
{
foreach ($sentences as $key => $sentence) {
$words = count($sentence);
// Only worry about commas on sentences longer than 4 words
if ($words > 4) {
$mean = log($words, 6);
$std_dev = $mean / 6;
$commas = round($this->gauss($mean, $std_dev));
for ($i = 1; $i <= $commas; $i++) {
$word = round($i * $words / ($commas + 1));
if ($word < ($words - 1) && $word > 0) {
$sentence[$word] .= ',';
}
}
}
$sentences[$key] = ucfirst(implode(' ', $sentence) . '.');
}
}
/**
* Output
*
* Does the rest of the processing of the strings. This includes wrapping
* the strings in HTML tags, handling transformations with the ability of
* back referencing and determining if the passed array should be converted
* into a string or not.
*
* @access private
* @param array $strings an array of generated strings
* @param mixed $tags string or array of HTML tags to wrap output with
* @param boolean $array whether an array or a string should be returned
* @param string $delimiter the string to use when calling implode()
* @return mixed string or array of generated lorem ipsum text
*/
private function output($strings, $tags, $array, $delimiter = ' ')
{
if ($tags) {
if (!is_array($tags)) {
$tags = array($tags);
} else {
// Flips the array so we can work from the inside out
$tags = array_reverse($tags);
}
foreach ($strings as $key => $string) {
foreach ($tags as $tag) {
// Detects / applies back reference
if ($tag[0] == '<') {
$string = str_replace('$1', $string, $tag);
} else {
$string = sprintf('<%1$s>%2$s</%1$s>', $tag, $string);
}
$strings[$key] = $string;
}
}
}
if (!$array) {
$strings = implode($delimiter, $strings);
}
return $strings;
}
}

View File

@@ -0,0 +1,218 @@
#!/bin/sh
# lipsum-shell
# https://github.com/alexchantastic/lipsum-shell
# MIT License
#
# Copyright (c) 2022 Alex Chan
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
version="1.0.1"
word_pool=("ad" "adipiscing" "aliqua" "aliquip" "amet" "anim" "aute" "cillum" "commodo"
"consectetur" "consequat" "culpa" "cupidatat" "deserunt" "do" "dolor" "dolore"
"duis" "ea" "eiusmod" "elit" "enim" "esse" "est" "et" "eu" "ex" "excepteur"
"exercitation" "fugiat" "id" "in" "incididunt" "ipsum" "irure" "labore" "laboris"
"laborum" "lorem" "magna" "minim" "mollit" "nisi" "non" "nostrud" "nulla"
"occaecat" "officia" "pariatur" "proident" "qui" "quis" "reprehenderit" "sed"
"sint" "sit" "sunt" "tempor" "ullamco" "ut" "velit" "veniam" "voluptate")
default_min_words=4
default_max_words=8
default_min_sentences=5
default_max_sentences=10
# Generate a series of characters
#
# @param int $count Number of characters to generate
# @return string
generate_characters() {
local count word words characters
count=$1
while [ ${#characters} -lt $count ]
do
word=$(generate_words 1)
words+=($word)
characters=${words[@]}
done
echo ${characters:0:$count}
}
# Generate a series of words
#
# @param int $count Number of words to generate
# @return string
generate_words() {
local i count rand word words
count=$1
for ((i=0; i<$count; i++))
do
rand=$(( RANDOM % ${#word_pool[*]} ))
word=${word_pool[$rand]}
words+=($word)
done
echo ${words[@]}
}
# Generate a series of sentences
#
# @param int $count Number of sentences to generate
# @param int $min Minimum number of words per sentence (default: 4)
# @param int $max Maximum number of words per sentence (default: 8)
# @return string
generate_sentences() {
local i count min max len placement sentence sentences
count=$1
min=${2:-$default_min_words}
max=${3:-$default_max_words}
for ((i=0; i<$count; i++))
do
len=$(( RANDOM % (${max} - ${min} + 1 ) + ${min} ))
sentence=$(generate_words $len)
sentence=$(capitalize "$sentence")
# Randomly distribute commas throughout the sentences
if [[ $len > 1 && $(( RANDOM % 2 )) = 1 ]]; then
placement=$(( RANDOM % ($len - 1) + 1 ))
sentence=$(sed "s/ /, /"$placement <<<$sentence)
fi
sentences+=($sentence.)
done
echo ${sentences[@]}
}
# Generate a series of paragraphs
#
# @param int $count Number of paragraphs to generate
# @param int $min Minimum number of sentences per paragraph (default: 5)
# @param int $max Maximum number of sentences per paragraph (default: 10)
# @param int $min_words Minimum number of words per sentence (default: 4)
# @param int $max_words Maximum number of words per sentence (default: 8)
# @return string
generate_paragraphs() {
local i count min max len min_words max_words paragraph paragraphs
count=$1
min=${2:-$default_min_sentences}
max=${3:-$default_max_sentences}
min_words=${4:-$default_min_words}
max_words=${5:-$default_max_words}
for ((i=0; i<$count; i++))
do
len=$(( RANDOM % (${max} - ${min} + 1) + ${min} ))
paragraph=$(generate_sentences $len $min_words $max_words)
paragraphs+=$paragraph
# Add linebreaks
if [ ! $i = $(( $count - 1 )) ]; then
paragraphs+="\n\n"
fi
done
echo ${paragraphs[@]}
}
# Capitalize the first letter in a string
#
# @param string $string String to capitalize
# @return string
capitalize() {
local string first_letter ord
string=$1
first_letter=${string:0:1}
if [[ ${first_letter} == [a-z] ]]; then
ord=$(printf '%o' "'${first_letter}")
ord=$(( ord - 40 ))
first_letter=$(printf '%b' '\'${ord})
fi
echo "${first_letter}${string:1}"
}
# Show help information
#
# @return string
show_help() {
echo "Generates lorem ipsum dummy text"
echo
echo "Usage: lipsum [-t] [-c] [-m|M|w|W|h|v]"
echo "Options:"
echo " -t Type of text structure to generate (characters|words|sentences|paragraphs)"
echo " -c Number of structures to generate"
echo " -m Minimum number of structures to generate (applies to sentence and paragraph only)"
echo " -M Maximum number of structures to generate (applies to sentence and paragraph only)"
echo " -w Minimum number of words to generate per sentence (applies to paragraph only)"
echo " -W Maximum number of words to generate per sentence (applies to paragraph only)"
echo " -v Print version"
echo " -h Print help"
exit 0
}
# Show version information
#
# @return string
show_version() {
echo "lipsum $version"
exit 0
}
while getopts t:c:m:M:w:W:hv option
do
case $option in
t) type=${OPTARG};;
c) count=${OPTARG};;
m) min=${OPTARG};;
M) max=${OPTARG};;
w) min_words=${OPTARG};;
W) max_words=${OPTARG};;
h) show_help;;
v) show_version;;
*) exit 1;;
esac
done
case $type in
characters|character|char|c)
printf "$(capitalize "$(generate_characters $count)")"
;;
words|word|w)
printf "$(capitalize "$(generate_words $count)")"
;;
sentences|sentence|sent|s)
printf "$(generate_sentences $count $min $max)"
;;
paragraphs|paragraph|para|p)
printf "$(generate_paragraphs $count $min $max $min_words $max_words)"
;;
esac

View File

@@ -1,66 +0,0 @@
<?php
include_once('lib/LoremIpsum.php');
$lipsum = new joshtronic\LoremIpsum();
$type = $argv[1];
$length = $argv[2];
$length = $length ? $length : 1;
/**
* Characters
*
* Generates characters of lorem ipsum.
*
* @param integer $count how many characters to generate
* @return string generated lorem ipsum characters
*/
function characters($count) {
global $lipsum;
$character_count = 0;
$words_count = 0;
$words_array = array();
while ($character_count < $count) {
$word = $lipsum->word();
$word_length = strlen($word);
if ($word !== $words_array[$words_count - 1]) {
$character_count += $word_length + count($words_array);
array_push($words_array, $word);
$words_count = count($words_array);
}
}
$words = implode(' ', $words_array);
$words = substr($words, 0, $count);
$last_character = substr($words, -1);
if ($last_character === ' ') {
$words = substr($words, 0, -1) . substr($lipsum->word(), 0, 1);
}
return $words;
}
switch ($type) {
case 'characters':
$output = characters($length);
break;
case 'words':
$output = $lipsum->words($length);
break;
case 'sentences':
$output = $lipsum->sentences($length);
break;
case 'paragraphs':
$output = $lipsum->paragraphs($length);
break;
}
echo ucfirst($output);

View File

@@ -236,6 +236,77 @@
<string>Pause Tabs</string>
<key>objects</key>
<array>
<dict>
<key>config</key>
<dict>
<key>concurrently</key>
<false/>
<key>escaping</key>
<integer>102</integer>
<key>script</key>
<string>const chromium_variants = ['Google Chrome', 'Chromium', 'Opera', 'Vivaldi', 'Brave Browser', 'Microsoft Edge']
const webkit_variants = ['Safari', 'Webkit']
const browser_variants = chromium_variants.concat(webkit_variants)
Application('System Events')
.applicationProcesses.where({ backgroundOnly: false })()
.filter(app =&gt; {
app_name = app.name()
if (app_name.startsWith('firefox')) console.log('Firefox is not scriptable')
return browser_variants.some(variant =&gt; app_name.startsWith(variant))
})
.map(browser =&gt; browser.name())
.join(',')</string>
<key>scriptargtype</key>
<integer>1</integer>
<key>scriptfile</key>
<string></string>
<key>type</key>
<integer>7</integer>
</dict>
<key>type</key>
<string>alfred.workflow.action.script</string>
<key>uid</key>
<string>1D78F34E-7704-4119-8370-27B728AAE507</string>
<key>version</key>
<integer>2</integer>
</dict>
<dict>
<key>config</key>
<dict>
<key>tasksettings</key>
<dict/>
<key>taskuid</key>
<string>com.alfredapp.automation.core/macOS/app.current</string>
</dict>
<key>type</key>
<string>alfred.workflow.automation.task</string>
<key>uid</key>
<string>2E537D85-C9B0-43CB-8485-B136A1ABB446</string>
<key>version</key>
<integer>1</integer>
</dict>
<dict>
<key>config</key>
<dict>
<key>argumenttype</key>
<integer>2</integer>
<key>keyword</key>
<string>{var:pause_all_keyword}</string>
<key>subtext</key>
<string>Pause video and audio in all browser tabs</string>
<key>text</key>
<string>Pause All</string>
<key>withspace</key>
<false/>
</dict>
<key>type</key>
<string>alfred.workflow.input.keyword</string>
<key>uid</key>
<string>00AE9D16-4A4A-4371-9B6C-4A57F90B0FD8</string>
<key>version</key>
<integer>1</integer>
</dict>
<dict>
<key>config</key>
<dict>
@@ -315,77 +386,6 @@ target_browsers.forEach(browser_name =&gt; {
<key>version</key>
<integer>2</integer>
</dict>
<dict>
<key>config</key>
<dict>
<key>concurrently</key>
<false/>
<key>escaping</key>
<integer>102</integer>
<key>script</key>
<string>const chromium_variants = ['Google Chrome', 'Chromium', 'Opera', 'Vivaldi', 'Brave Browser', 'Microsoft Edge']
const webkit_variants = ['Safari', 'Webkit']
const browser_variants = chromium_variants.concat(webkit_variants)
Application('System Events')
.applicationProcesses.where({ backgroundOnly: false })()
.filter(app =&gt; {
app_name = app.name()
if (app_name.startsWith('firefox')) console.log('Firefox is not scriptable')
return browser_variants.some(variant =&gt; app_name.startsWith(variant))
})
.map(browser =&gt; browser.name())
.join(',')</string>
<key>scriptargtype</key>
<integer>1</integer>
<key>scriptfile</key>
<string></string>
<key>type</key>
<integer>7</integer>
</dict>
<key>type</key>
<string>alfred.workflow.action.script</string>
<key>uid</key>
<string>1D78F34E-7704-4119-8370-27B728AAE507</string>
<key>version</key>
<integer>2</integer>
</dict>
<dict>
<key>config</key>
<dict>
<key>tasksettings</key>
<dict/>
<key>taskuid</key>
<string>com.alfredapp.automation.core/macOS/app.current</string>
</dict>
<key>type</key>
<string>alfred.workflow.automation.task</string>
<key>uid</key>
<string>2E537D85-C9B0-43CB-8485-B136A1ABB446</string>
<key>version</key>
<integer>1</integer>
</dict>
<dict>
<key>config</key>
<dict>
<key>argumenttype</key>
<integer>2</integer>
<key>keyword</key>
<string>{var:pause_all_keyword}</string>
<key>subtext</key>
<string>Pause video and audio in all browser tabs</string>
<key>text</key>
<string>Pause All</string>
<key>withspace</key>
<false/>
</dict>
<key>type</key>
<string>alfred.workflow.input.keyword</string>
<key>uid</key>
<string>00AE9D16-4A4A-4371-9B6C-4A57F90B0FD8</string>
<key>version</key>
<integer>1</integer>
</dict>
<dict>
<key>config</key>
<dict>
@@ -494,6 +494,10 @@ Application('System Events')
<false/>
<key>focusedappvariablename</key>
<string></string>
<key>hotkey</key>
<integer>0</integer>
<key>hotmod</key>
<integer>0</integer>
<key>leftcursor</key>
<false/>
<key>modsmode</key>
@@ -519,6 +523,10 @@ Application('System Events')
<false/>
<key>focusedappvariablename</key>
<string></string>
<key>hotkey</key>
<integer>0</integer>
<key>hotmod</key>
<integer>0</integer>
<key>leftcursor</key>
<false/>
<key>modsmode</key>
@@ -587,6 +595,10 @@ Application('System Events')
<false/>
<key>focusedappvariablename</key>
<string></string>
<key>hotkey</key>
<integer>0</integer>
<key>hotmod</key>
<integer>0</integer>
<key>leftcursor</key>
<false/>
<key>modsmode</key>
@@ -634,6 +646,10 @@ Application('System Events')
<false/>
<key>focusedappvariablename</key>
<string></string>
<key>hotkey</key>
<integer>0</integer>
<key>hotmod</key>
<integer>0</integer>
<key>leftcursor</key>
<false/>
<key>modsmode</key>
@@ -656,7 +672,7 @@ Turn on `Allow JavaScript from Apple Events` in the browsers you want to control
## Usage
Pause audio and video in tabs of all open web browsers via the Pause All Keyword (default: `pause all`). The Pause Others Keyword (default: `pause others`) does the same except for the current tab. &lt;kbd&gt;⌘&lt;/kbd&gt;&lt;kbd&gt;↩&lt;/kbd&gt; makes it only pause tabs from the current browser.
Pause audio and video in tabs of all open web browsers via the `pause all` keyword. `pause others` does the same except for the current tab. &lt;kbd&gt;⌘&lt;/kbd&gt;&lt;kbd&gt;↩&lt;/kbd&gt; makes it only pause tabs from the current browser.
![Alfred search for pause](images/about/pause.png)</string>
<key>uidata</key>
@@ -852,7 +868,7 @@ Do not skip active tab</string>
</dict>
</array>
<key>version</key>
<string>2022.4</string>
<string>2023.1</string>
<key>webaddress</key>
<string>https://github.com/alfredapp/pause-tabs-workflow/</string>
</dict>

View File

@@ -229,7 +229,7 @@ fi</string>
</array>
<key>readme</key>
<string>## Usage
Create a temporary email address via the `tmpmail` keyword. A random inbox name is used unless you type one.
![Creating a temporary email](images/about/tmpmail.png)
@@ -326,10 +326,8 @@ On supported web browsers, the email inbox will open in a background tab and the
<key>variable</key>
<string>email_service</string>
</dict>
</array>
<key>variablesdontexport</key>
</array>
<key>version</key>
<key>version</key>
<string>2023.2</string>
<key>webaddress</key>
<string>https://github.com/vitorgalvao/temporary-email-workflow/</string>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 29 KiB

View File

@@ -31,6 +31,19 @@
<false/>
</dict>
</array>
<key>3263DF37-2A1F-486F-BCC1-E902E59320DC</key>
<array>
<dict>
<key>destinationuid</key>
<string>D6AD9678-C017-40CD-BD91-5E4102C39AD3</string>
<key>modifiers</key>
<integer>0</integer>
<key>modifiersubtext</key>
<string></string>
<key>vitoclose</key>
<false/>
</dict>
</array>
<key>4B30C050-DEC1-4375-8B11-20FA04A89596</key>
<array>
<dict>
@@ -43,6 +56,44 @@
<key>vitoclose</key>
<false/>
</dict>
<dict>
<key>destinationuid</key>
<string>4F542EDC-0D2D-48F5-9593-5A78470AFEE4</string>
<key>modifiers</key>
<integer>1048576</integer>
<key>modifiersubtext</key>
<string>Reopen Universal Actions after renaming</string>
<key>vitoclose</key>
<false/>
</dict>
</array>
<key>4F542EDC-0D2D-48F5-9593-5A78470AFEE4</key>
<array>
<dict>
<key>destinationuid</key>
<string>2D996A5F-76DB-4596-BAC7-C918B0EFD902</string>
<key>modifiers</key>
<integer>0</integer>
<key>modifiersubtext</key>
<string></string>
<key>vitoclose</key>
<false/>
</dict>
</array>
<key>A6B5E6E1-D926-4D07-A505-6821DDD8AD23</key>
<array>
<dict>
<key>destinationuid</key>
<string>9D441C22-CD20-4CCA-8CF2-8AC879F994A1</string>
<key>modifiers</key>
<integer>0</integer>
<key>modifiersubtext</key>
<string></string>
<key>sourceoutputuid</key>
<string>084A03F0-9303-4D0B-8E6A-1969BC7CB1DE</string>
<key>vitoclose</key>
<false/>
</dict>
</array>
<key>D307CADD-36C3-4EF0-98C3-1CA47407436A</key>
<array>
@@ -56,9 +107,30 @@
<key>vitoclose</key>
<false/>
</dict>
<dict>
<key>destinationuid</key>
<string>3263DF37-2A1F-486F-BCC1-E902E59320DC</string>
<key>modifiers</key>
<integer>1048576</integer>
<key>modifiersubtext</key>
<string>Reopen Universal Actions after renaming</string>
<key>vitoclose</key>
<false/>
</dict>
</array>
<key>D6AD9678-C017-40CD-BD91-5E4102C39AD3</key>
<array/>
<array>
<dict>
<key>destinationuid</key>
<string>A6B5E6E1-D926-4D07-A505-6821DDD8AD23</string>
<key>modifiers</key>
<integer>0</integer>
<key>modifiersubtext</key>
<string></string>
<key>vitoclose</key>
<false/>
</dict>
</array>
</dict>
<key>createdby</key>
<string>Vítor Galvão</string>
@@ -70,29 +142,6 @@
<string>Rename Action</string>
<key>objects</key>
<array>
<dict>
<key>config</key>
<dict>
<key>concurrently</key>
<false/>
<key>escaping</key>
<integer>0</integer>
<key>script</key>
<string>mv "${origFullPath}" "${1}"</string>
<key>scriptargtype</key>
<integer>1</integer>
<key>scriptfile</key>
<string></string>
<key>type</key>
<integer>5</integer>
</dict>
<key>type</key>
<string>alfred.workflow.action.script</string>
<key>uid</key>
<string>D6AD9678-C017-40CD-BD91-5E4102C39AD3</string>
<key>version</key>
<integer>2</integer>
</dict>
<dict>
<key>config</key>
<dict>
@@ -119,16 +168,21 @@
<key>runningsubtext</key>
<string>Please wait…</string>
<key>script</key>
<string>ObjC.import('stdlib')
<string>function envVar(varName) {
return $.NSProcessInfo
.processInfo
.environment
.objectForKey(varName).js
}
function run(argv) {
const origExtension = $.getenv("origExtension")
const origExtension = envVar("origExtension")
const newExtension = origExtension.length === 0 ? "" : "." + origExtension
const newBasenameNoExtension = argv[0]
const newFullPath = $.getenv("origDirname") + "/" + newBasenameNoExtension + newExtension
const newFullPath = envVar("origDirname") + "/" + newBasenameNoExtension + newExtension
if (newBasenameNoExtension === $.getenv("origBasenameNoExtension")) {
if (newBasenameNoExtension === envVar("origBasenameNoExtension")) {
return JSON.stringify({ "items": [{
"title": "Rename to",
"subtitle": "File extension is preserved",
@@ -136,17 +190,17 @@ function run(argv) {
}]})
}
if (Application('Finder').exists(Path(newFullPath))) {
if ($.NSFileManager.defaultManager.fileExistsAtPath(newFullPath)) {
return JSON.stringify({ "items": [{
"title": "Path already exists!",
"subtitle": newFullPath,
"subtitle": $(newFullPath).stringByAbbreviatingWithTildeInPath.js,
"valid": false
}]})
}
return JSON.stringify({ "items": [{
"title": "Rename to",
"subtitle": newFullPath,
"subtitle": $(newFullPath).stringByAbbreviatingWithTildeInPath.js,
"valid": true,
"arg": newFullPath
}]})
@@ -171,6 +225,69 @@ function run(argv) {
<key>version</key>
<integer>3</integer>
</dict>
<dict>
<key>config</key>
<dict>
<key>concurrently</key>
<false/>
<key>escaping</key>
<integer>0</integer>
<key>script</key>
<string>readonly newFullPath="${1}"
# Rename
mv "${origFullPath}" "${newFullPath}"
# Send to reopen Universal Actions
echo -n "${newFullPath}"</string>
<key>scriptargtype</key>
<integer>1</integer>
<key>scriptfile</key>
<string></string>
<key>type</key>
<integer>5</integer>
</dict>
<key>type</key>
<string>alfred.workflow.action.script</string>
<key>uid</key>
<string>D6AD9678-C017-40CD-BD91-5E4102C39AD3</string>
<key>version</key>
<integer>2</integer>
</dict>
<dict>
<key>config</key>
<dict>
<key>jumpto</key>
<string>_popUpItemAction:</string>
<key>path</key>
<string></string>
<key>type</key>
<integer>1</integer>
</dict>
<key>type</key>
<string>alfred.workflow.action.actioninalfred</string>
<key>uid</key>
<string>9D441C22-CD20-4CCA-8CF2-8AC879F994A1</string>
<key>version</key>
<integer>1</integer>
</dict>
<dict>
<key>config</key>
<dict>
<key>acceptsmulti</key>
<integer>0</integer>
<key>filetypes</key>
<array/>
<key>name</key>
<string>Rename</string>
</dict>
<key>type</key>
<string>alfred.workflow.trigger.action</string>
<key>uid</key>
<string>4B30C050-DEC1-4375-8B11-20FA04A89596</string>
<key>version</key>
<integer>1</integer>
</dict>
<dict>
<key>config</key>
<dict>
@@ -214,17 +331,32 @@ function run(argv) {
<dict>
<key>config</key>
<dict>
<key>acceptsmulti</key>
<integer>0</integer>
<key>filetypes</key>
<array/>
<key>name</key>
<string>Rename</string>
<key>conditions</key>
<array>
<dict>
<key>inputstring</key>
<string>{var:reopen_ua}</string>
<key>matchcasesensitive</key>
<false/>
<key>matchmode</key>
<integer>5</integer>
<key>matchstring</key>
<string></string>
<key>outputlabel</key>
<string>Reopen Universal Actions</string>
<key>uid</key>
<string>084A03F0-9303-4D0B-8E6A-1969BC7CB1DE</string>
</dict>
</array>
<key>elselabel</key>
<string>else</string>
<key>hideelse</key>
<true/>
</dict>
<key>type</key>
<string>alfred.workflow.trigger.action</string>
<string>alfred.workflow.utility.conditional</string>
<key>uid</key>
<string>4B30C050-DEC1-4375-8B11-20FA04A89596</string>
<string>A6B5E6E1-D926-4D07-A505-6821DDD8AD23</string>
<key>version</key>
<integer>1</integer>
</dict>
@@ -249,6 +381,46 @@ function run(argv) {
<key>version</key>
<integer>1</integer>
</dict>
<dict>
<key>config</key>
<dict>
<key>argument</key>
<string>{query}</string>
<key>passthroughargument</key>
<false/>
<key>variables</key>
<dict>
<key>reopen_ua</key>
<string>true</string>
</dict>
</dict>
<key>type</key>
<string>alfred.workflow.utility.argument</string>
<key>uid</key>
<string>3263DF37-2A1F-486F-BCC1-E902E59320DC</string>
<key>version</key>
<integer>1</integer>
</dict>
<dict>
<key>config</key>
<dict>
<key>argument</key>
<string>{query}</string>
<key>passthroughargument</key>
<false/>
<key>variables</key>
<dict>
<key>reopen_ua</key>
<string>true</string>
</dict>
</dict>
<key>type</key>
<string>alfred.workflow.utility.argument</string>
<key>uid</key>
<string>4F542EDC-0D2D-48F5-9593-5A78470AFEE4</string>
<key>version</key>
<integer>1</integer>
</dict>
</array>
<key>readme</key>
<string>## Usage
@@ -257,16 +429,25 @@ Rename a file or folder via the [Universal Action](https://www.alfredapp.com/hel
![Rename action](images/about/ua.png)
![Choosing new file name](images/about/rename.png)</string>
![Choosing new file name](images/about/rename.png)
Press &lt;kbd&gt;⌘&lt;/kbd&gt;&lt;kbd&gt;↩&lt;/kbd&gt; at any state to reopen the Universal Actions panel after renaming.</string>
<key>uidata</key>
<dict>
<key>2D996A5F-76DB-4596-BAC7-C918B0EFD902</key>
<dict>
<key>xpos</key>
<real>225</real>
<real>315</real>
<key>ypos</key>
<real>20</real>
</dict>
<key>3263DF37-2A1F-486F-BCC1-E902E59320DC</key>
<dict>
<key>xpos</key>
<real>695</real>
<key>ypos</key>
<real>150</real>
</dict>
<key>4B30C050-DEC1-4375-8B11-20FA04A89596</key>
<dict>
<key>xpos</key>
@@ -274,26 +455,47 @@ Rename a file or folder via the [Universal Action](https://www.alfredapp.com/hel
<key>ypos</key>
<real>20</real>
</dict>
<key>4F542EDC-0D2D-48F5-9593-5A78470AFEE4</key>
<dict>
<key>xpos</key>
<real>215</real>
<key>ypos</key>
<real>150</real>
</dict>
<key>947A1C83-3935-488B-BBBC-A01B072DD9A0</key>
<dict>
<key>note</key>
<string>Select argument</string>
<key>xpos</key>
<real>425</real>
<real>515</real>
<key>ypos</key>
<real>150</real>
</dict>
<key>9D441C22-CD20-4CCA-8CF2-8AC879F994A1</key>
<dict>
<key>xpos</key>
<real>1040</real>
<key>ypos</key>
<real>20</real>
</dict>
<key>A6B5E6E1-D926-4D07-A505-6821DDD8AD23</key>
<dict>
<key>xpos</key>
<real>960</real>
<key>ypos</key>
<real>50</real>
</dict>
<key>D307CADD-36C3-4EF0-98C3-1CA47407436A</key>
<dict>
<key>xpos</key>
<real>425</real>
<real>515</real>
<key>ypos</key>
<real>20</real>
</dict>
<key>D6AD9678-C017-40CD-BD91-5E4102C39AD3</key>
<dict>
<key>xpos</key>
<real>625</real>
<real>795</real>
<key>ypos</key>
<real>20</real>
</dict>
@@ -301,7 +503,7 @@ Rename a file or folder via the [Universal Action](https://www.alfredapp.com/hel
<key>userconfigurationconfig</key>
<array/>
<key>version</key>
<string>2022.2</string>
<string>2023.2</string>
<key>webaddress</key>
<string>https://github.com/vitorgalvao/rename-action-workflow/</string>
</dict>

View File

@@ -32,6 +32,21 @@
<string>Google Suggest</string>
<key>objects</key>
<array>
<dict>
<key>config</key>
<dict>
<key>browser</key>
<string></string>
<key>searcher</key>
<integer>1635215215</integer>
</dict>
<key>type</key>
<string>alfred.workflow.action.systemwebsearch</string>
<key>uid</key>
<string>B8FFA3AB-AD7D-4316-A84F-5958A671D4FF</string>
<key>version</key>
<integer>1</integer>
</dict>
<dict>
<key>config</key>
<dict>
@@ -123,26 +138,11 @@ function run(argv) {
<key>version</key>
<integer>3</integer>
</dict>
<dict>
<key>config</key>
<dict>
<key>browser</key>
<string></string>
<key>searcher</key>
<integer>1635215215</integer>
</dict>
<key>type</key>
<string>alfred.workflow.action.systemwebsearch</string>
<key>uid</key>
<string>B8FFA3AB-AD7D-4316-A84F-5958A671D4FF</string>
<key>version</key>
<integer>1</integer>
</dict>
</array>
<key>readme</key>
<string>## Usage
Get in-line suggestions from Googles search results via the Search Keyword (default: `g`). Press &lt;kbd&gt;↩&lt;/kbd&gt; to open the search results page in the default web browser.
Get in-line suggestions from Googles search results via the `g` keyword ([configurable](https://www.alfredapp.com/help/workflows/user-configuration/)). Press &lt;kbd&gt;↩&lt;/kbd&gt; to open the search results page in the default web browser.
![Google in-line results](images/about/google-search-results.png)</string>
<key>uidata</key>
@@ -189,7 +189,7 @@ Get in-line suggestions from Googles search results via the Search Keyword (d
</dict>
</array>
<key>version</key>
<string>2022.2</string>
<string>2023.1</string>
<key>webaddress</key>
<string>https://github.com/alfredapp/google-suggest-workflow/</string>
</dict>

View File

@@ -9,7 +9,18 @@
<key>connections</key>
<dict>
<key>00EFFEBD-C714-4CAB-B92C-BDDBE67722E7</key>
<array/>
<array>
<dict>
<key>destinationuid</key>
<string>268AF531-D3CC-4EB8-BAA0-059955CBFF2F</string>
<key>modifiers</key>
<integer>0</integer>
<key>modifiersubtext</key>
<string></string>
<key>vitoclose</key>
<false/>
</dict>
</array>
<key>03643B46-4437-4668-B20D-2426B2945D5A</key>
<array>
<dict>
@@ -46,15 +57,13 @@
<false/>
</dict>
</array>
<key>35C8230F-B24B-433B-AD8A-97530A5C5B86</key>
<array/>
<key>39AEE376-1119-4C0E-BF24-CB23030EE283</key>
<array/>
<key>45EDDC71-B661-4406-B076-64091AE6AC94</key>
<array>
<dict>
<key>destinationuid</key>
<string>35C8230F-B24B-433B-AD8A-97530A5C5B86</string>
<string>268AF531-D3CC-4EB8-BAA0-059955CBFF2F</string>
<key>modifiers</key>
<integer>0</integer>
<key>modifiersubtext</key>
@@ -352,7 +361,7 @@ add_note(title: ARGV[0], content: ENV['action_text'] || Open3.capture2('pbpaste'
<string>require "#{Dir.pwd}/notetaker_functions.rb"
New_note = add_note(title: ARGV[0], content: ENV['action_text'] || '')
edit_note(path: New_note.to_path)</string>
print New_note.to_path</string>
<key>scriptargtype</key>
<integer>1</integer>
<key>scriptfile</key>
@@ -388,6 +397,21 @@ edit_note(path: New_note.to_path)</string>
<key>version</key>
<integer>1</integer>
</dict>
<dict>
<key>config</key>
<dict>
<key>openwith</key>
<string></string>
<key>sourcefile</key>
<string></string>
</dict>
<key>type</key>
<string>alfred.workflow.action.openfile</string>
<key>uid</key>
<string>268AF531-D3CC-4EB8-BAA0-059955CBFF2F</string>
<key>version</key>
<integer>3</integer>
</dict>
<dict>
<key>config</key>
<dict>
@@ -405,31 +429,6 @@ edit_note(path: New_note.to_path)</string>
<key>version</key>
<integer>1</integer>
</dict>
<dict>
<key>config</key>
<dict>
<key>concurrently</key>
<false/>
<key>escaping</key>
<integer>102</integer>
<key>script</key>
<string>require "#{Dir.pwd}/notetaker_functions.rb"
edit_note(path: ARGV[0])</string>
<key>scriptargtype</key>
<integer>1</integer>
<key>scriptfile</key>
<string></string>
<key>type</key>
<integer>2</integer>
</dict>
<key>type</key>
<string>alfred.workflow.action.script</string>
<key>uid</key>
<string>35C8230F-B24B-433B-AD8A-97530A5C5B86</string>
<key>version</key>
<integer>2</integer>
</dict>
<dict>
<key>config</key>
<dict>
@@ -624,7 +623,7 @@ copy_note(path: ARGV[0])</string>
<key>readme</key>
<string>## Usage
Create new notes via the Add Note Keyword (default: `nadd`). Type a name and press &lt;kbd&gt;↩&lt;/kbd&gt; to open the file for editing. Use &lt;kbd&gt;⌘&lt;/kbd&gt;&lt;kbd&gt;↩&lt;/kbd&gt; to save a file with the clipboard contents.
Create new notes via the `nadd` keyword. Type a name and press &lt;kbd&gt;↩&lt;/kbd&gt; to open the file for editing. Use &lt;kbd&gt;⌘&lt;/kbd&gt;&lt;kbd&gt;↩&lt;/kbd&gt; or configure the [Hotkey](https://www.alfredapp.com/help/workflows/triggers/hotkey/) to save a file with the clipboard contents.
![Alfred search for nadd](images/about/nadd.png)
@@ -632,7 +631,7 @@ With the [Universal Action](https://www.alfredapp.com/help/features/universal-ac
![Universal Action for add note](images/about/ua.png)
Search your notes with the View Notes Keyword (default: `nview`).
Search your notes with the `nview` keyword.
![Alfred search for nview](images/about/nview.png)
@@ -656,6 +655,17 @@ Search your notes with the View Notes Keyword (default: `nview`).
<key>ypos</key>
<real>350</real>
</dict>
<key>268AF531-D3CC-4EB8-BAA0-059955CBFF2F</key>
<dict>
<key>colorindex</key>
<integer>8</integer>
<key>note</key>
<string>Edit to set a custom application to open notes</string>
<key>xpos</key>
<real>1035</real>
<key>ypos</key>
<real>475</real>
</dict>
<key>3078BCDF-E3A8-45C7-9EB8-8EE49B29FC2E</key>
<dict>
<key>xpos</key>
@@ -663,13 +673,6 @@ Search your notes with the View Notes Keyword (default: `nview`).
<key>ypos</key>
<real>65</real>
</dict>
<key>35C8230F-B24B-433B-AD8A-97530A5C5B86</key>
<dict>
<key>xpos</key>
<real>860</real>
<key>ypos</key>
<real>475</real>
</dict>
<key>39AEE376-1119-4C0E-BF24-CB23030EE283</key>
<dict>
<key>xpos</key>
@@ -872,10 +875,8 @@ Search your notes with the View Notes Keyword (default: `nview`).
<string>input_asterisk</string>
</dict>
</array>
<key>variablesdontexport</key>
<array/>
<key>version</key>
<string>2022.2</string>
<string>2023.2</string>
<key>webaddress</key>
<string>https://github.com/vitorgalvao/note-taker-workflow/</string>
</dict>

View File

@@ -78,10 +78,6 @@ def copy_note(path:)
Open3.capture2('pbcopy', stdin_data: Pathname.new(path).read)
end
def edit_note(path:)
system('open', '-t', path)
end
def trash(path:)
system('osascript', '-l', 'JavaScript', '-e', 'function run(argv) { Application("Finder").delete(Path(argv[0])) }', path)
end

View File

@@ -200,7 +200,7 @@ Upload files and folders via the [Universal Action](https://www.alfredapp.com/he
![Upload file](images/about/ua.png)
When done, the download link is copied to the clipboard. Check upload progress via the Progress Keyword (default: `ufp`).
When done, the download link is copied to the clipboard. Check upload progress via the `ufp` keyword.
![Upload progress](images/about/ufp.png)
@@ -257,6 +257,10 @@ Press &lt;kbd&gt;⌘&lt;/kbd&gt;&lt;kbd&gt;↩&lt;/kbd&gt; to cancel.</string>
<string>litterbox.catbox.moe</string>
<string>litterbox.catbox.moe</string>
</array>
<array>
<string>bashupload.com</string>
<string>bashupload.com</string>
</array>
<array>
<string>bayfiles.com</string>
<string>bayfiles.com</string>
@@ -306,10 +310,8 @@ Press &lt;kbd&gt;⌘&lt;/kbd&gt;&lt;kbd&gt;↩&lt;/kbd&gt; to cancel.</string>
<string>progress_keyword</string>
</dict>
</array>
<key>variablesdontexport</key>
<array/>
<key>version</key>
<string>2022.1</string>
<string>2023.2</string>
<key>webaddress</key>
<string>https://github.com/vitorgalvao/upload-file-workflow/</string>
</dict>

View File

@@ -57,7 +57,7 @@ function transfer {
echo -n "${file_name}" > "${name_file}"
notification "Uploading “${file_name}”"
local -r hosts=('transfer.sh' '0x0.st' 'litterbox.catbox.moe' 'bayfiles.com' 'anonfile.com' 'megaupload.is' 'forumfiles.com')
local -r hosts=('transfer.sh' '0x0.st' 'litterbox.catbox.moe' 'bashupload.com' 'bayfiles.com' 'anonfile.com' 'megaupload.is' 'forumfiles.com')
local -r default_host="${hosts[0]}"
if [[ -n "${upload_file_to}" ]]; then
@@ -77,6 +77,8 @@ function transfer {
curl --globoff --progress-bar --form "file=@\"${escaped_file_path}\"" "https://${upload_host}" 2> "${progress_file}" | tr -d '\n' | pbcopy
elif [[ "${upload_host}" == 'litterbox.catbox.moe' ]]; then
curl --globoff --progress-bar --form 'reqtype=fileupload' --form 'time=72h' --form "fileToUpload=@\"${escaped_file_path}\"" "https://${upload_host}/resources/internals/api.php" 2> "${progress_file}" | tr -d '\n' | pbcopy
elif [[ "${upload_host}" == *'bashupload.com' ]]; then
curl --globoff --progress-bar --upload-file "${file_path}" "https://${upload_host}/" 2> "${progress_file}" | grep '^wget' | sed 's/^wget //' | tr -d '\n' | pbcopy
else
curl --globoff --progress-bar --form "file=@\"${escaped_file_path}\"" "https://api.${upload_host}/upload" 2> "${progress_file}" | ruby -r 'json' -e 'data = JSON.parse(gets); abort "There was an error uploading" if data["status"] == false; puts data["data"]["file"]["url"]["full"]' | tr -d '\n' | pbcopy
fi