This commit is contained in:
2024-09-02 19:24:13 -07:00
parent 23d686908d
commit d1f2ecbc14
29 changed files with 54 additions and 234 deletions

View File

@@ -0,0 +1,155 @@
# If a config.py file exists, this file is ignored unless it's explicitly loaded
# via config.load_autoconfig(). For more information, see:
# https://github.com/qutebrowser/qutebrowser/blob/master/doc/help/configuring.asciidoc#loading-autoconfigyml
# DO NOT edit this file by hand, qutebrowser will overwrite it.
# Instead, create a config.py - see :help for details.
config_version: 2
settings:
content.blocking.method:
global: both
content.javascript.enabled:
'*://*.01.emailinboundprocessing.eu/*': true
'*://*.127.0.0.1/*': true
'*://*.4chanlit.fandom.com/*': true
'*://*.account.proton.me/*': true
'*://*.account.protonvpn.com/*': true
'*://*.ancientdead.com/*': true
'*://*.app.netdata.cloud/*': true
'*://*.app.simplelogin.io/*': true
'*://*.askubuntu.com/*': true
'*://*.babeground.com/*': true
'*://*.babeground.net/*': true
'*://*.babegrounds.live/*': true
'*://*.bandcamp.com/*': true
'*://*.chmodcommand.com/*': true
'*://*.codeberg.org/*': true
'*://*.confluence.atg-corp.com/*': false
'*://*.crontab.guru/*': true
'*://*.customer.xfinity.com/*': true
'*://*.demo.uptime.kuma.pet/*': true
'*://*.docs.google.com/*': true
'*://*.drop.download/*': true
'*://*.duckduckgo.com/*': true
'*://*.features.jellyfin.org/*': true
'*://*.flathub.org/*': true
'*://*.fleet.linuxserver.io/*': true
'*://*.fmovies.to/*': true
'*://*.framatube.org/*': true
'*://*.get.adobe.com/*': true
'*://*.github.com/*': true
'*://*.gitlab.com/*': true
'*://*.goauthentik.io/*': true
'*://*.greyzone.com/*': true
'*://*.heretic.camp/*': true
'*://*.html.duckduckgo.com/*': true
'*://*.hub.docker.com/*': true
'*://*.id.atlassian.com/*': true
'*://*.idcs-3359adb31e35415e8c1729c5c8098c6d.identity.oraclecloud.com/*': true
'*://*.imgflip.com/*': true
'*://*.inv.odyssey346.dev/*': true
'*://*.jf.opal.sh/*': true
'*://*.jira.atg-corp.com/*': true
'*://*.layoffs.fyi/*': true
'*://*.learningnetwork.cisco.com/*': true
'*://*.listen.20buckspin.com/*': true
'*://*.localhost/*': true
'*://*.login.seattle.gov/*': true
'*://*.login.xfinity.com/*': true
'*://*.looking-glass.io/*': true
'*://*.lotrproject.com/*': true
'*://*.mail.proton.me/*': true
'*://*.main.realsecure.flyingcroc.net/*': true
'*://*.metalodyssey.8merch.com/*': true
'*://*.my.uscis.gov/*': true
'*://*.my.vultr.com/*': true
'*://*.myaccount.standingstonegames.com/*': true
'*://*.myutilities.seattle.gov/*': true
'*://*.nagios.realsecure.flyingcroc.net/*': true
'*://*.netbox.realsecure.flyingcroc.net/*': true
'*://*.online.adp.com/*': true
'*://*.onlinebanking.becu.org/*': true
'*://*.onyxboox.com/*': true
'*://*.openscrobbler.com/*': true
'*://*.payments.xfinity.com/*': true
'*://*.portainer.opal.sh/*': true
'*://*.protesilaos.com/*': true
'*://*.proton.me/*': true
'*://*.rateyourmusic.com/*': true
'*://*.register.be.xfinity.com/*': false
'*://*.reverb.com/*': true
'*://*.sack.realsecure.flyingcroc.net/*': true
'*://*.search.brave.com/*': true
'*://*.seattle.bibliocommons.com/*': true
'*://*.seattle.craigslist.org/*': true
'*://*.shop.bulletproof.com/*': true
'*://*.spl.overdrive.com/*': true
'*://*.stackoverflow.com/*': true
'*://*.stash.atg-corp.com/*': true
'*://*.superuser.com/*': true
'*://*.support-acquia.force.com/*': true
'*://*.thecirclemusic.gr/*': true
'*://*.thegrayzone.com/*': true
'*://*.translate.google.com/*': true
'*://*.twitter.com/*': true
'*://*.unix.stackexchange.com/*': true
'*://*.uploadev.org/*': true
'*://*.utilities-self-service.ebill.seattle.gov/*': true
'*://*.veganmenshoes.com/*': true
'*://*.vid.puffyan.us/*': true
'*://*.wooddove.fciis.net/*': true
'*://*.www.20buckspin.com/*': true
'*://*.www.airplane.dev/*': true
'*://*.www.amazon.com/*': true
'*://*.www.astound.com/*': true
'*://*.www.budgetbytes.com/*': true
'*://*.www.calculator.net/*': true
'*://*.www.carhartt.com/*': true
'*://*.www.dancarlin.com/*': true
'*://*.www.drmartens.com/*': true
'*://*.www.duluthtrading.com/*': true
'*://*.www.easyime.com/*': true
'*://*.www.ebay.com/*': true
'*://*.www.filson.com/*': true
'*://*.www.foodnetwork.com/*': true
'*://*.www.geoguessr.com/*': true
'*://*.www.goodreads.com/*': true
'*://*.www.google.com/*': true
'*://*.www.harddrivesdirect.com/*': true
'*://*.www.knoll.com/*': true
'*://*.www.kobo.com/*': true
'*://*.www.last.fm/*': true
'*://*.www.lastpodcastontheleft.com/*': true
'*://*.www.lotro.com/*': true
'*://*.www.metal-archives.com/*': true
'*://*.www.mmorpg.com/*': true
'*://*.www.moddb.com/*': true
'*://*.www.netaddictionrecovery.com/*': true
'*://*.www.nightshiftmerch.com/*': true
'*://*.www.openstreetmap.org/*': true
'*://*.www.patagonia.com/*': true
'*://*.www.paypal.com/*': true
'*://*.www.raspberrypi.com/*': true
'*://*.www.reddit.com/*': true
'*://*.www.seattle.gov/*': true
'*://*.www.startpage.com/*': true
'*://*.www.thisisclassicalguitar.com/*': true
'*://*.www.vegetarian-shoes.co.uk/*': true
'*://*.www.vultr.com/*': true
'*://*.www.wills-vegan-store.com/*': true
'*://*.www.xfinity.com/*': true
'*://*.www.youtube.com/*': true
'*://*.www.zillow.com/*': true
'*://gethomepage.dev/*': true
'*://jf.opal.sh/*': true
'*://jsonformatter.curiousconcept.com/*': true
'*://rateyourmusic.com/*': true
'*://revelationofdoom.com/*': true
'*://www.duplicati.com/*': true
'*://www.newegg.com/*': true
'*://www.vitamix.com/*': true
'*://www.youtube.com/*': true
content.notifications.enabled:
https://jf.opal.sh: false
content.register_protocol_handler:
https://mail.proton.me#mailto=%25s: false

View File

View File

@@ -0,0 +1,67 @@
#!/usr/bin/env python3
from PyQt5.QtCore import QUrl
from qutebrowser.api import interceptor
#import dracula.draw
# Load existing settings made via :set
config.load_autoconfig()
#dracula.draw.blood(c, {"spacing": {"vertical": 6, "horizontal": 8}})
# def intercept(info: interceptor.Request):
# if info.request_url.host() == "youtube.com":
# new_url = QUrl(info.request_url)
# new_url.setHost("vid.puffyan.us")
# try:
# info.redirect(new_url)
# except interceptor.interceptors.RedirectException:
# pass
# interceptor.register(intercept)
c.qt.highdpi = True
c.fonts.default_size = "15pt"
c.fonts.tabs.selected = "13pt default_family"
c.fonts.tabs.unselected = "13pt default_family"
c.zoom.default = "130%"
c.content.javascript.enabled = False
c.downloads.location.directory = "~/downloads"
c.editor.command = ["alacritty", "-e", "vim", "{}"]
c.editor.encoding = "utf-8"
c.auto_save.session = True
c.colors.webpage.preferred_color_scheme = "dark"
# privacy
c.content.cookies.accept = "no-3rdparty"
c.content.webrtc_ip_handling_policy = "default-public-interface-only"
c.content.site_specific_quirks.enabled = False
c.content.headers.user_agent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.5112.79 Safari/537.36"
config.bind("j", "scroll-px 0 100")
config.bind("k", "scroll-px 0 -100")
config.bind("K", "tab-next")
config.bind("J", "tab-prev")
c.url.searchengines = {
"DEFAULT": "https://duckduckgo.com/?q={}",
}
c.url.start_pages = ["http://localhost:80"]
# Bitwarden Password Management
config.bind(
",p",
"spawn --userscript qute-bitwarden --dmenu-invocation 'bemenu -b -x --prompt=Pass'",
)
config.bind(
",u",
"spawn --userscript qute-bitwarden -e --dmenu-invocation 'bemenu -b -p 'Username Only''",
)
config.bind(
",P",
"spawn --userscript qute-bitwarden --dmenu-invocation 'bemenu -b -x -p 'Password Only''",
)

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,8 @@
[FileDialog]
history=file:///home/opal/pictures
lastVisited=file:///home/opal/pictures
qtVersion=5.15.6
shortcuts=file:, file:///home/opal
sidebarWidth=87
treeViewHeader="@ByteArray(\0\0\0\xff\0\0\0\0\0\0\0\x1\0\0\0\0\0\0\0\0\x1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x1\xd1\0\0\0\x4\x1\x1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x64\xff\xff\xff\xff\0\0\0\x81\0\0\0\0\0\0\0\x4\0\0\0\xf5\0\0\0\x1\0\0\0\0\0\0\0\x39\0\0\0\x1\0\0\0\0\0\0\0=\0\0\0\x1\0\0\0\0\0\0\0\x66\0\0\0\x1\0\0\0\0\0\0\x3\xe8\0\xff\xff\xff\xff)"
viewMode=Detail

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,343 @@
#!/usr/bin/env python3
#!/usr/bin/env python3
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# Copyright 2014-2021 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
# Copyright 2014-2018 Claude (longneck) <longneck@scratchbook.ch>
# This file is part of qutebrowser.
#
# qutebrowser is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# qutebrowser is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with qutebrowser. If not, see <https://www.gnu.org/licenses/>.
"""Tool to import data from other browsers.
Currently importing bookmarks from Netscape HTML Bookmark files, Chrome
profiles, and Mozilla profiles is supported.
"""
import argparse
import textwrap
import sqlite3
import os
import urllib.parse
import json
import string
def main():
args = get_args()
bookmark_types = []
output_format = None
input_format = args.input_format
if args.search_output:
bookmark_types = ["search"]
if args.oldconfig:
output_format = "oldsearch"
else:
output_format = "search"
else:
if args.bookmark_output:
output_format = "bookmark"
elif args.quickmark_output:
output_format = "quickmark"
if args.import_bookmarks:
bookmark_types.append("bookmark")
if args.import_keywords:
bookmark_types.append("keyword")
if not bookmark_types:
bookmark_types = ["bookmark", "keyword"]
if not output_format:
output_format = "quickmark"
import_function = {
"html": import_html_bookmarks,
"mozilla": import_moz_places,
"chrome": import_chrome,
}
import_function[input_format](args.bookmarks, bookmark_types, output_format)
def get_args():
"""Get the argparse parser."""
parser = argparse.ArgumentParser(
formatter_class=argparse.RawDescriptionHelpFormatter,
epilog=textwrap.dedent(
"""
To import bookmarks, you'll need the path to your profile or an
exported HTML file from your browser's bookmark manager. Redirect
the output from this script to the appropriate file in your
qutebrowser config directory (listed in the output of :version),
usually done with the '>' operator; for example,
./importer.py -i mozilla your_profile_path > ~/.config/qutebrowser/quickmarks
Common browsers with native input format support:
chrome: Chrome, Chromium, Edge
mozilla: Firefox, SeaMonkey, Pale Moon
"""
),
)
parser.add_argument(
"-i",
"--input-format",
help="Which input format? Defaults to html",
choices=["html", "mozilla", "chrome"],
default="html",
required=False,
)
parser.add_argument(
"-b",
"--bookmark-output",
help="Output in bookmark format.",
action="store_true",
default=False,
required=False,
)
parser.add_argument(
"-q",
"--quickmark-output",
help="Output in quickmark format (default).",
action="store_true",
default=False,
required=False,
)
parser.add_argument(
"-s",
"--search-output",
help="Output config.py search engine format (negates -B and -K)",
action="store_true",
default=False,
required=False,
)
parser.add_argument(
"--oldconfig",
help="Output search engine format for old qutebrowser.conf format",
default=False,
action="store_true",
required=False,
)
parser.add_argument(
"-B",
"--import-bookmarks",
help="Import plain bookmarks (can be combiend with -K)",
action="store_true",
default=False,
required=False,
)
parser.add_argument(
"-K",
"--import-keywords",
help="Import keywords (can be combined with -B)",
action="store_true",
default=False,
required=False,
)
parser.add_argument(
"bookmarks",
help="Bookmarks file (html format) or " "profile folder (Mozilla format)",
)
args = parser.parse_args()
return args
def search_escape(url):
"""Escape URLs such that preexisting { and } are handled properly.
Will obviously trash a properly-formatted qutebrowser URL.
"""
return url.replace("{", "{{").replace("}", "}}")
def opensearch_convert(url):
"""Convert a basic OpenSearch URL into something qutebrowser can use.
Exceptions:
KeyError:
An unknown and required parameter is present in the URL. This
usually means there's browser/addon specific functionality needed
to build the URL (I'm looking at you and your browser, Google) that
obviously won't be present here.
"""
subst = {
"searchTerms": "%s", # for proper escaping later
"language": "*",
"inputEncoding": "UTF-8",
"outputEncoding": "UTF-8",
}
# remove optional parameters (even those we don't support)
for param in string.Formatter().parse(url):
if param[1]:
if param[1].endswith("?"):
url = url.replace("{" + param[1] + "}", "")
elif param[2] and param[2].endswith("?"):
url = url.replace("{" + param[1] + ":" + param[2] + "}", "")
return search_escape(url.format(**subst)).replace("%s", "{}")
def import_html_bookmarks(bookmarks_file, bookmark_types, output_format):
"""Import bookmarks from a NETSCAPE-Bookmark-file v1.
Generated by Chromium, Firefox, IE and possibly more browsers. Not all
export all possible bookmark types:
- Firefox mostly works with everything
- Chrome doesn't support keywords at all; searches are a separate
database
"""
import bs4
with open(bookmarks_file, encoding="utf-8") as f:
soup = bs4.BeautifulSoup(f, "html.parser")
bookmark_query = {
"search": lambda tag: (
(tag.name == "a") and ("shortcuturl" in tag.attrs) and ("%s" in tag["href"])
),
"keyword": lambda tag: (
(tag.name == "a")
and ("shortcuturl" in tag.attrs)
and ("%s" not in tag["href"])
),
"bookmark": lambda tag: (
(tag.name == "a") and ("shortcuturl" not in tag.attrs) and (tag.string)
),
}
output_template = {
"search": {
"search": "c.url.searchengines['{tag[shortcuturl]}'] = "
"'{tag[href]}' #{tag.string}"
},
"oldsearch": {
"search": "{tag[shortcuturl]} = {tag[href]} #{tag.string}",
},
"bookmark": {
"bookmark": "{tag[href]} {tag.string}",
"keyword": "{tag[href]} {tag.string}",
},
"quickmark": {
"bookmark": "{tag.string} {tag[href]}",
"keyword": "{tag[shortcuturl]} {tag[href]}",
},
}
bookmarks = []
for typ in bookmark_types:
tags = soup.findAll(bookmark_query[typ])
for tag in tags:
if typ == "search":
tag["href"] = search_escape(tag["href"]).replace("%s", "{}")
if tag["href"] not in bookmarks:
bookmarks.append(output_template[output_format][typ].format(tag=tag))
for bookmark in bookmarks:
print(bookmark)
def import_moz_places(profile, bookmark_types, output_format):
"""Import bookmarks from a Mozilla profile's places.sqlite database."""
place_query = {
"bookmark": (
"SELECT DISTINCT moz_bookmarks.title,moz_places.url "
"FROM moz_bookmarks,moz_places "
"WHERE moz_places.id=moz_bookmarks.fk "
"AND moz_places.id NOT IN (SELECT place_id FROM moz_keywords) "
"AND moz_places.url NOT LIKE 'place:%';"
), # Bookmarks with no keywords assigned
"keyword": (
"SELECT moz_keywords.keyword,moz_places.url "
"FROM moz_keywords,moz_places,moz_bookmarks "
"WHERE moz_places.id=moz_bookmarks.fk "
"AND moz_places.id=moz_keywords.place_id "
"AND moz_places.url NOT LIKE '%!%s%' ESCAPE '!';"
), # Bookmarks with keywords assigned but no %s substitution
"search": (
"SELECT moz_keywords.keyword, "
" moz_bookmarks.title, "
" search_conv(moz_places.url) AS url "
"FROM moz_keywords,moz_places,moz_bookmarks "
"WHERE moz_places.id=moz_bookmarks.fk "
"AND moz_places.id=moz_keywords.place_id "
"AND moz_places.url LIKE '%!%s%' ESCAPE '!';"
), # bookmarks with keyword and %s substitution
}
out_template = {
"bookmark": {"bookmark": "{url} {title}", "keyword": "{url} {keyword}"},
"quickmark": {"bookmark": "{title} {url}", "keyword": "{keyword} {url}"},
"oldsearch": {"search": "{keyword} {url} #{title}"},
"search": {"search": "c.url.searchengines['{keyword}'] = '{url}' #{title}"},
}
def search_conv(url):
return search_escape(url).replace("%s", "{}")
places = sqlite3.connect(os.path.join(profile, "places.sqlite"))
places.create_function("search_conv", 1, search_conv)
places.row_factory = sqlite3.Row
c = places.cursor()
for typ in bookmark_types:
c.execute(place_query[typ])
for row in c:
print(out_template[output_format][typ].format(**row))
def import_chrome(profile, bookmark_types, output_format):
"""Import bookmarks and search keywords from Chrome-type profiles.
On Chrome, keywords and search engines are the same thing and handled in
their own database table; bookmarks cannot have associated keywords. This
is why the dictionary lookups here are much simpler.
"""
out_template = {
"bookmark": "{url} {name}",
"quickmark": "{name} {url}",
"search": "c.url.searchengines['{keyword}'] = '{url}'",
"oldsearch": "{keyword} {url}",
}
if "search" in bookmark_types:
webdata = sqlite3.connect(os.path.join(profile, "Web Data"))
c = webdata.cursor()
c.execute("SELECT keyword,url FROM keywords;")
for keyword, url in c:
try:
url = opensearch_convert(url)
print(out_template[output_format].format(keyword=keyword, url=url))
except KeyError:
print(
"# Unsupported parameter in url for {}; skipping....".format(
keyword
)
)
else:
with open(os.path.join(profile, "Bookmarks"), encoding="utf-8") as f:
bookmarks = json.load(f)
def bm_tree_walk(bm, template):
"""Recursive function to walk through bookmarks."""
if not isinstance(bm, dict):
return
assert "type" in bm, bm
if bm["type"] == "url":
if urllib.parse.urlparse(bm["url"]).scheme != "chrome":
print(template.format(**bm))
elif bm["type"] == "folder":
for child in bm["children"]:
bm_tree_walk(child, template)
for root in bookmarks["roots"].values():
bm_tree_walk(root, out_template[output_format])
if __name__ == "__main__":
main()

View File

@@ -0,0 +1,356 @@
#!/usr/bin/env python3
# Copyright 2017 Chris Braun (cryzed) <cryzed@googlemail.com>
# Adapted for Bitwarden by Jonathan Haylett (JonnyHaystack) <jonathan@haylett.dev>
#
# This file is part of qutebrowser.
#
# qutebrowser is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# qutebrowser is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with qutebrowser. If not, see <https://www.gnu.org/licenses/>.
"""
Insert login information using Bitwarden CLI and a dmenu-compatible application
(e.g. dmenu, rofi -dmenu, ...).
"""
USAGE = """The domain of the site has to be in the name of the Bitwarden entry, for example: "github.com/cryzed" or
"websites/github.com". The login information is inserted by emulating key events using qutebrowser's fake-key command in this manner:
[USERNAME]<Tab>[PASSWORD], which is compatible with almost all login forms.
If enabled, with the `--totp` flag, it will also move the TOTP code to the
clipboard, much like the Firefox add-on.
You must log into Bitwarden CLI using `bw login` prior to use of this script.
The session key will be stored using keyctl for the number of seconds passed to
the --auto-lock option.
To use in qutebrowser, run: `spawn --userscript qute-bitwarden`
"""
EPILOG = """Dependencies: tldextract (Python 3 module), pyperclip (optional
Python module, used for TOTP codes), Bitwarden CLI (1.7.4 is known to work
but older versions may well also work)
WARNING: The login details are viewable as plaintext in qutebrowser's debug log
(qute://log) and might be shared if you decide to submit a crash report!"""
import argparse
import enum
import functools
import os
import shlex
import subprocess
import sys
import json
import tldextract
argument_parser = argparse.ArgumentParser(
description=__doc__,
usage=USAGE,
epilog=EPILOG,
)
argument_parser.add_argument("url", nargs="?", default=os.getenv("QUTE_URL"))
argument_parser.add_argument(
"--dmenu-invocation",
"-d",
default="bemenu -x -b --prompt=Pass",
help="Invocation used to execute a dmenu-provider",
)
argument_parser.add_argument(
"--password-prompt-invocation",
"-p",
default='bemenu -x -b -p "Master Password"',
help="Invocation used to prompt the user for their Bitwarden password",
)
argument_parser.add_argument(
"--no-insert-mode",
"-n",
dest="insert_mode",
action="store_false",
help="Don't automatically enter insert mode",
)
argument_parser.add_argument(
"--totp", "-t", action="store_true", help="Copy TOTP key to clipboard"
)
argument_parser.add_argument(
"--io-encoding",
"-i",
default="UTF-8",
help="Encoding used to communicate with subprocesses",
)
argument_parser.add_argument(
"--merge-candidates",
"-m",
action="store_true",
help="Merge pass candidates for fully-qualified and registered domain name",
)
argument_parser.add_argument(
"--auto-lock",
type=int,
default=900,
help="Automatically lock the vault after this many seconds",
)
group = argument_parser.add_mutually_exclusive_group()
group.add_argument(
"--username-only", "-e", action="store_true", help="Only insert username"
)
group.add_argument(
"--password-only", "-w", action="store_true", help="Only insert password"
)
group.add_argument(
"--totp-only", "-T", action="store_true", help="Only insert totp code"
)
stderr = functools.partial(print, file=sys.stderr)
class ExitCodes(enum.IntEnum):
SUCCESS = 0
FAILURE = 1
# 1 is automatically used if Python throws an exception
NO_PASS_CANDIDATES = 2
COULD_NOT_MATCH_USERNAME = 3
COULD_NOT_MATCH_PASSWORD = 4
def qute_command(command):
with open(os.environ["QUTE_FIFO"], "w") as fifo:
fifo.write(command + "\n")
fifo.flush()
def ask_password(password_prompt_invocation):
process = subprocess.run(
shlex.split(password_prompt_invocation),
text=True,
stdout=subprocess.PIPE,
)
if process.returncode > 0:
raise Exception("Could not unlock vault")
master_pass = process.stdout.strip()
return subprocess.check_output(
["bw", "unlock", "--raw", master_pass],
text=True,
).strip()
def get_session_key(auto_lock, password_prompt_invocation):
if auto_lock == 0:
subprocess.call(["keyctl", "purge", "user", "bw_session"])
return ask_password(password_prompt_invocation)
else:
process = subprocess.run(
["keyctl", "request", "user", "bw_session"],
text=True,
stdout=subprocess.PIPE,
)
key_id = process.stdout.strip()
if process.returncode > 0:
session = ask_password(password_prompt_invocation)
if not session:
raise Exception("Could not unlock vault")
key_id = subprocess.check_output(
["keyctl", "add", "user", "bw_session", session, "@u"],
text=True,
).strip()
if auto_lock > 0:
subprocess.call(["keyctl", "timeout", str(key_id), str(auto_lock)])
return subprocess.check_output(
["keyctl", "pipe", str(key_id)],
text=True,
).strip()
def pass_(domain, encoding, auto_lock, password_prompt_invocation):
session_key = get_session_key(auto_lock, password_prompt_invocation)
process = subprocess.run(
["bw", "list", "items", "--session", session_key, "--url", domain],
capture_output=True,
)
err = process.stderr.decode(encoding).strip()
if err:
msg = "Bitwarden CLI returned for {:s} - {:s}".format(domain, err)
stderr(msg)
if process.returncode:
return "[]"
out = process.stdout.decode(encoding).strip()
return out
def get_totp_code(
selection_id, domain_name, encoding, auto_lock, password_prompt_invocation
):
session_key = get_session_key(auto_lock, password_prompt_invocation)
process = subprocess.run(
["bw", "get", "totp", "--session", session_key, selection_id],
capture_output=True,
)
err = process.stderr.decode(encoding).strip()
if err:
# domain_name instead of selection_id to make it more user-friendly
msg = "Bitwarden CLI returned for {:s} - {:s}".format(domain_name, err)
stderr(msg)
if process.returncode:
return "[]"
out = process.stdout.decode(encoding).strip()
return out
def dmenu(items, invocation, encoding):
command = shlex.split(invocation)
process = subprocess.run(
command, input="\n".join(items).encode(encoding), stdout=subprocess.PIPE
)
return process.stdout.decode(encoding).strip()
def fake_key_raw(text):
for character in text:
# Escape all characters by default, space requires special handling
sequence = '" "' if character == " " else r"\{}".format(character)
qute_command("fake-key {}".format(sequence))
def main(arguments):
if not arguments.url:
argument_parser.print_help()
return ExitCodes.FAILURE
extract_result = tldextract.extract(arguments.url)
# Try to find candidates using targets in the following order: fully-qualified domain name (includes subdomains),
# the registered domain name and finally: the IPv4 address if that's what
# the URL represents
candidates = []
for target in filter(
None,
[
extract_result.fqdn,
extract_result.registered_domain,
extract_result.subdomain + "." + extract_result.domain,
extract_result.domain,
extract_result.ipv4,
],
):
target_candidates = json.loads(
pass_(
target,
arguments.io_encoding,
arguments.auto_lock,
arguments.password_prompt_invocation,
)
)
if not target_candidates:
continue
candidates = candidates + target_candidates
if not arguments.merge_candidates:
break
else:
if not candidates:
stderr("No pass candidates for URL {!r} found!".format(arguments.url))
return ExitCodes.NO_PASS_CANDIDATES
if len(candidates) == 1:
selection = candidates.pop()
else:
choices = []
for c in candidates:
if c["login"]["username"] is None:
c["login"]["username"] = ""
choices.append("{:s} | {:s}".format(c["name"], c["login"]["username"]))
# choices = [
# "{:s} | {:s}".format(c["name"], c["login"]["username"]) for c in candidates
# ]
choice = dmenu(choices, arguments.dmenu_invocation, arguments.io_encoding)
choice_tokens = choice.split("|")
choice_name = choice_tokens[0].strip()
choice_username = choice_tokens[1].strip()
selection = next(
(
c
for (i, c) in enumerate(candidates)
if c["name"] == choice_name
and c["login"]["username"] == choice_username
),
None,
)
# Nothing was selected, simply return
if not selection:
return ExitCodes.SUCCESS
username = selection["login"]["username"]
password = selection["login"]["password"]
totp = selection["login"]["totp"]
if arguments.username_only:
fake_key_raw(username)
elif arguments.password_only:
fake_key_raw(password)
elif arguments.totp_only:
# No point in moving it to the clipboard in this case
fake_key_raw(
get_totp_code(
selection["id"],
selection["name"],
arguments.io_encoding,
arguments.auto_lock,
arguments.password_prompt_invocation,
)
)
else:
# Enter username and password using fake-key and <Tab> (which seems to work almost universally), then switch
# back into insert-mode, so the form can be directly submitted by
# hitting enter afterwards
fake_key_raw(username)
qute_command("fake-key <Tab>")
fake_key_raw(password)
if arguments.insert_mode:
qute_command("mode-enter insert")
# If it finds a TOTP code, it copies it to the clipboard,
# which is the same behavior as the Firefox add-on.
if not arguments.totp_only and totp and arguments.totp:
# The import is done here, to make pyperclip an optional dependency
import pyperclip
pyperclip.copy(
get_totp_code(
selection["id"],
selection["name"],
arguments.io_encoding,
arguments.auto_lock,
arguments.password_prompt_invocation,
)
)
return ExitCodes.SUCCESS
if __name__ == "__main__":
arguments = argument_parser.parse_args()
sys.exit(main(arguments))

152
archive/rofi/config.rasi Normal file
View File

@@ -0,0 +1,152 @@
// Config //
configuration {
modi: "drun,filebrowser,window";
show-icons: true;
display-drun: "󰣚";
display-run: "";
display-filebrowser: "";
display-window: "";
drun-display-format: "{name}";
window-format: "{w}{t}";
font: "Hack Font 10";
icon-theme: "Papirus";
}
@theme "~/.config/rofi/graphite-mono.rasi"
// Main //
window {
height: 200px;
width: 600px;
transparency: "real";
fullscreen: false;
enabled: true;
cursor: "default";
spacing: 0px;
padding: 0px;
border: 2px;
border-radius: 40px;
border-color: @main-br;
background-color: transparent;
}
mainbox {
enabled: true;
spacing: 0px;
padding: 0px;
orientation: vertical;
children: [ "listbox" , "inputmode" ];
background-color: rgba(32, 32, 32, 0.88);
}
// Lists //
listbox {
padding: 0px;
spacing: 0px;
orientation: horizontal;
children: [ "listview" ];
background-color: transparent;
}
listview {
padding: 10px;
spacing: 0px;
enabled: true;
columns: 5;
cycle: true;
dynamic: true;
scrollbar: false;
layout: vertical;
reverse: false;
fixed-height: true;
fixed-columns: true;
cursor: "default";
background-color: @main-bg;
text-color: @main-fg;
}
// Inputs //
inputmode {
padding: 0px;
spacing: 0px;
orientation: horizontal;
children: [ "inputbar" , "mode-switcher" ];
background-color: transparent;
}
inputbar {
enabled: true;
width: 400px;
height: 0px;
spacing: 0px;
padding: 30px 10px 30px 65px;
children: [ "entry" ];
background-color: transparent;
}
entry {
vertical-align: 0.5;
border-radius: 50px;
enabled: true;
spacing: 0px;
padding: 10px;
text-color: @main-fg;
background-color: @main-bg;
}
// Modes //
mode-switcher {
width: 200px;
orientation: horizontal;
enabled: true;
padding: 30px 65px 30px 0px;
spacing: 10px;
background-color: transparent;
}
button {
cursor: pointer;
padding: 0px;
border-radius: 50px;
background-color: @main-bg;
text-color: @main-fg;
}
button selected {
background-color: @main-fg;
text-color: @main-bg;
}
// Elements //
element {
orientation: vertical;
enabled: true;
spacing: 0px;
padding: 10px;
border-radius: 25px;
cursor: pointer;
background-color: transparent;
text-color: @main-fg;
}
@media(max-aspect-ratio: 1.8) {
element {
orientation: vertical;
}
}
element selected.normal {
background-color: @select-bg;
text-color: @select-fg;
}
element-icon {
size: 38px;
cursor: inherit;
background-color: transparent;
text-color: inherit;
}
element-text {
vertical-align: 0.5;
horizontal-align: 0.5;
cursor: inherit;
background-color: transparent;
text-color: inherit;
}

View File

@@ -0,0 +1,10 @@
* {
main-bg: #262626e6;
main-fg: #d9d9d9ff;
main-br: #a6a6a6ff;
main-ex: #595959cc;
select-bg: #a6a6a6ff;
select-fg: #262626ff;
separatorcolor: transparent;
border-color: transparent;
}

564
archive/zsh/.history Normal file
View File

@@ -0,0 +1,564 @@
: 1641441313:0;ls
: 1641441314:0;ls -la
: 1641441325:0;cd .config
: 1641441325:0;ls
: 1641441326:0;cd zsh
: 1641441327:0;ls
: 1641441335:0;source zshrcv
: 1641441336:0;source zshrc
: 1641441345:0;source zprofile
: 1641441361:0;cd ~/dotfiles/.config/zsh
: 1641441361:0;ls
: 1641441547:0;sudo pacman -S ttf-iosevka
: 1641441568:0;sudo pacman -S ttc-iosevka
: 1641441988:0;ls
: 1641441990:0;cd
: 1641441991:0;ls -la
: 1641441994:0;cat .zshenv
: 1641441999:0;zshrcsource
: 1641442016:0;source ~/.config/zsh/zshrc
: 1641442022:0;ls
: 1641442312:0;sudo pacman -S grimshot
: 1641442319:0;yay -S grimshot
: 1641442335:0;ls
: 1641442344:0;which wl-clipboard
: 1641442372:0;sudo pacman -S wl-clipboard
: 1641442376:0;ls
: 1641442412:0;wofi
: 1641442505:0;man wofi
: 1641442542:0;cd ~/.config/wofi
: 1641442542:0;ls
: 1641442545:0;cat style.css
: 1641442548:0;cd co
: 1641442552:0;vim config
: 1641502693:0;ols
: 1641502695:0;ls -la
: 1641502704:0;source ~/.config/zsh/zshrc
: 1641502707:0;ls
: 1641502718:0;exit
: 1641503208:0;ls
: 1641503307:0;cd pictures
: 1641503308:0;ls
: 1641503310:0;cd ..
: 1641503312:0;sl
: 1641503313:0;cd ..
: 1641503314:0;ls
: 1641503315:0;cd opal
: 1641503316:0;ls
: 1641503318:0;rm -r guix
: 1641503319:0;ls
: 1641503324:0;man wofi
: 1641503338:0;man 7 wofi
: 1641583413:0;wdisplays
: 1641587830:0;dbus-update-activation-environment
: 1641587870:0;cat ~/dotfiles/.config/zsh/
: 1641587870:0;ls
: 1641587876:0;cd ~/dotfiles/.config/zsh
: 1641587877:0;ls
: 1641587880:0;cat zprofile
: 1641587883:0;echo $EDITOR
: 1641587904:0;man export
: 1641587920:0;ls
: 1641587923:0;cd zshe
: 1641587930:0;vim zshenv
: 1641587937:0;vim ~/.zshenv
: 1641587951:0;eval $(gnome-keyring-daemon --start)
: 1641587957:0;export SSH_AUTH_SOCK
: 1641587973:0;echo $DESKTOP_SESSION
: 1641587987:0;ssh-add ~/.ssh/ry_ecdsa
: 1641587999:0;ls
: 1641588000:0;cd
: 1641588003:0;kls
: 1641588004:0;ls
: 1641588704:0;ols
: 1641588712:0;vim .zshrc
: 1641588721:0;mv zshrc .zshrc
: 1641588722:0;ls
: 1641588725:0;cd dotfiles
: 1641588725:0;ls
: 1641588733:0;cd .config/zsh
: 1641588733:0;ls
: 1641588737:0;mv zshrc .zshrc
: 1641588743:0;ls -la ~
: 1641588745:0;mv zshrc .zshrc
: 1641588748:0;ls -la ~
: 1641588749:0;ls
: 1641588758:0;mv zprofile .zprofile
: 1641588758:0;ls
: 1641588766:0;mv zshenv .zshenv
: 1641588766:0;ls
: 1641588768:0;cd ..
: 1641588768:0;ls
: 1641588778:0;cd ..
: 1641588778:0;ls
: 1641588833:0;ls /run/user/1000/keyring/control
: 1641589299:0;echo $SSH_AUTH_SOCK
: 1641589308:0;ssh-add ~/.ssh/ry_ecdsa
: 1641589338:0;echo $SSH_AUTH_SOCK
: 1641589358:0;ls
: 1641589373:0;git clone https://github.com/opalvault/org.git ~/org
: 1641589383:0;git clone git@github.com:opalvault/org.git ~/org
: 1641589396:0;ssh-add ~/.ssh/ry_ecdsa
: 1641589428:0;echo $SSH_AUTH_SOCK
: 1641589456:0;sudo reboot
: 1641589731:0;git clone git@github.com:opalvault/org.git
: 1641589742:0;ssh-add
: 1641590214:0;mkdir -p ~/.config/systemd/user
: 1641590222:0;vim ~/.config/systemd/user/ssh-agent.service
: 1641590270:0;systemctl enable --now --user ssh-agent.service
: 1641590299:0;mkdir ~/.config/systemd/user/default.target.wants
: 1641590318:0;mv ~/.config/systemd/user/ssh-agent.service ~/.config/systemd/user/default.target.wants
: 1641590319:0;ls
: 1641590320:0;systemctl enable --now --user ssh-agent.service
: 1641590332:0;ls
: 1641590336:0;cd ~/.config/systemd/user
: 1641590337:0;ls
: 1641590345:0;cd default.target.wants
: 1641590345:0;ls
: 1641590363:0;systemctl start --ser ssh-agent.service
: 1641590365:0;systemctl start --user ssh-agent.service
: 1641590385:0;ls
: 1641590388:0;mv ssh-agent.service ..
: 1641590389:0;ls
: 1641590390:0;cd ..
: 1641590390:0;ls
: 1641590656:0;mv default.target.wants default.target
: 1641590663:0;ls
: 1641590670:0;systemctl start --user ssh-agent.service
: 1641590676:0;systemctl status --user ssh-agent.service
: 1641590683:0;systemctl enable --user ssh-agent.service
: 1641590695:0;mv default.target default.target.wants
: 1641590696:0;systemctl enable --user ssh-agent.service
: 1641590701:0;ls
: 1641590810:0;ssh-add -L
: 1641591100:0;ssh-add
: 1641591115:0;ssh-agent
: 1641591118:0;ssh-agent -s
: 1641591129:0;eval $(ssh-agent -s)
: 1641591136:0;ssh-add ~/.ssh/ry_ecdsa
: 1641591155:0;git clone git@github.com:opalvault/org.git ~/org
: 1641591761:0;ls
: 1641591763:0;cd ..
: 1641591764:0;ls
: 1641591771:0;cd ..
: 1641591771:0;ls
: 1641591788:0;systemctl disable --user ssh-agent.service
: 1641591792:0;systemctl stop --user ssh-agent.service
: 1641593672:0;which picolisp
: 1641593675:0;which pil
: 1641593680:0;sudo pacman -S picolisp
: 1641593687:0;yay -S picolisp
: 1641593719:0;pil
: 1641593758:0;man pil
: 1641594220:0;pil
: 1641594354:0;ls
: 1641594355:0;cd projects
: 1641594356:0;ls
: 1641594370:0;git clone https://github.com/opalvault/advent-of-code.git
: 1641594371:0;ls
: 1641594372:0;cd advent-of-code
: 1641594373:0;ls
: 1641594378:0;mkdir picolisp
: 1641594379:0;ls
: 1641594380:0;cd picolisp
: 1641594381:0;ls
: 1641594392:0;mkdir -p 2015/day1
: 1641594394:0;cd 2015/day1
: 1641594394:0;ls
: 1641596369:0;cd pictures
: 1641596369:0;ls
: 1641596371:0;cd ../do
: 1641596376:0;man grimshot
: 1641596431:0;ls
: 1641596433:0;cd pictures
: 1641596433:0;ls
: 1641596434:0;cd ..
: 1641596435:0;ls
: 1641596436:0;cd documents
: 1641596437:0;ls
: 1641596516:0;grimshot
: 1641596534:0;grimshot output
: 1641596556:0;grimshot save output
: 1641596560:0;ls
: 1641628637:0;cd ..
: 1641628637:0;ls
: 1641628640:0;cd ..
: 1641628640:0;ls
: 1641628641:0;cd ..
: 1641628642:0;ls
: 1641630121:0;ls -la
: 1641630126:0;mkdir .pil
: 1641630163:0;cd /usr/share/picolisp/src/lib
: 1641630163:0;ls
: 1641630165:0;cd ..
: 1641630165:0;ls
: 1641630180:0;cd lib
: 1641630180:0;ls
: 1641630181:0;cd ..
: 1641630182:0;ls
: 1641630183:0;cd ..
: 1641630183:0;ls
: 1641630227:0;sudo pacman -Rs picolisp
: 1641630320:0;yay -S picolisp
: 1641630493:0;ls
: 1641630495:0;cd /usr/lib
: 1641630495:0;ls
: 1641630497:0;cd picolisp
: 1641630498:0;ls
: 1641630503:0;cd lib
: 1641630504:0;ls
: 1641630512:0;cd ..
: 1641630513:0;ls
: 1641630514:0;cd bin
: 1641630515:0;ls
: 1641630516:0;cd ..
: 1641630516:0;ls
: 1641630520:0;cd loc
: 1641630520:0;ls
: 1641630522:0;cd ..
: 1641630522:0;ls
: 1641630524:0;cd ..
: 1641630524:0;ls
: 1641630526:0;cd picolisp
: 1641630526:0;ls
: 1641630528:0;pwd
: 1641630535:0;cd /usr/share/picolisp
: 1641630535:0;ls
: 1641630540:0;cat INSTALL
: 1641632718:0;which zathura
: 1641632724:0;cd downloads
: 1641632724:0;ls
: 1641632728:0;zathura editor.pdf
: 1641633064:0;sudo pacman -S mksh
: 1641633071:0;pacman -Ss mksh
: 1641633074:0;pacman -Ss korn
: 1641633699:0;ols
: 1641633700:0;ls
: 1641671383:0;cd pictures
: 1641671383:0;ls
: 1641671398:0;cd ..
: 1641671398:0;ls
: 1641671401:0;cd pictures
: 1641671402:0;ls
: 1641671405:0;cd ..
: 1641671405:0;ls
: 1641671409:0;man grimshot
: 1641671499:0;ls
: 1641671501:0;cd pictures
: 1641671501:0;ls
: 1641671520:0;mv 2022-01-08T11:51:35,832340889-08:00.png screenshot.png
: 1641671520:0;ls
: 1641671527:0;mv screenshot.png ~/dotfiles/screenshot.png
: 1641671528:0;ls
: 1641671587:0;cd dotfiles
: 1641671590:0;feh screenshot.png
: 1641671617:0;sudo pacman -S feh
: 1641671624:0;feh screenshot.png
: 1641671646:0;ls
: 1641671648:0;cd pictures
: 1641671648:0;ls
: 1641671654:0;rm *png
: 1641671655:0;ls
: 1641671675:0;cd pictures
: 1641671676:0;ls
: 1641671683:0;mv 2022-01-08T11:54:33,042905522-08:00.png screenshot.png
: 1641671688:0;mv screenshot.png ~/dotfiles/screenshot.png
: 1641671693:0;ls
: 1641671800:0;ssh-add ~/.ssh/ry_ecdsa
: 1641671818:0;eval `ssh-agent -s`
: 1641671820:0;ssh-add ~/.ssh/ry_ecdsa
: 1641671826:0;cd ~/dotfiles
: 1641671829:0;git push origin master
: 1641671833:0;git push github master
: 1641671865:0;ls
: 1641671868:0;mv guix.org archive
: 1641671868:0;ls
: 1641671913:0;git push github master
: 1641672509:0;ssh borg
: 1641672523:0;ssh-add
: 1641672527:0;eval `ssh-agent -s`
: 1641672532:0;ssh-add ~/.ssh/ry_ecdsa
: 1641672538:0;ssh borg
: 1641672552:0;vim ~/.ssh/known_hosts
: 1641672557:0;ssh borg
: 1641672572:0;ssh opal@borg.opal.sh -p 46668
: 1641672590:0;ssh opalvaults@borg.opal.sh -p 46668
: 1641676611:0;sudo shutdown now
: 1641701970:0;ls
: 1641701990:0;mv ~/.config/emacs ./emacs.bak
: 1641701999:0;ls
: 1641702034:0;git clone --depth 1 https://github.com/hlissner/doom-emacs ~/.config/emacs/
: 1641702038:0;cd ~/.config/emacs
: 1641702038:0;ls
: 1641702048:0;bin/doom install
: 1641703138:0;ls
: 1641703143:0;cd ~/dotfiles/archive
: 1641703145:0;cd ..
: 1641703145:0;ls
: 1641703146:0;cd .config
: 1641703147:0;ls
: 1641703150:0;cd emacs
: 1641703151:0;ls
: 1641703157:0;bin/doom sync
: 1641704558:0;~/dotfiles/.config/emacs/bin/doom sync
: 1641704587:0;~/dotfiles/.config/emacs/bin/doom doctor
: 1641704598:0;sudo pacman -S ripgrep fd-find
: 1641704607:0;sudo pacman -S ripgrep
: 1641704626:0;pacman -Ss fd
: 1641704638:0;sudo pacman -S fd
: 1641704673:0;ping google.com
: 1641704676:0;sudo pacman -S fd
: 1641704683:0;sudo pacman -S ripgrep
: 1641704690:0;sudo pacman -S fd
: 1641704763:0;sudo pacman -Syyu
: 1641704794:0;sudo pacman -S fd
: 1641704798:0;ls
: 1641704800:0;pfetch
: 1641704802:0;ls
: 1641704935:0;pkill emacs
: 1641704939:0;emacs --debug-init
: 1641704997:0;ls
: 1641705011:0;cd dotfiles/.config/doom/
: 1641705011:0;ls
: 1641705014:0;vim config.el
: 1641705097:0;emacs --debug-init
: 1641705138:0;vim ~/dotfiles/.config/doom/config.el
: 1641705241:0;ls
: 1641705252:0;cd dotfiles/.config/doom
: 1641705253:0;ls
: 1641705254:0;vim config.el
: 1641705289:0;emacs config.el
: 1641705403:0;~/dotfiles/.config/emacs/bin/doom doctor
: 1641705419:0;sudo pacman -S shellcheck cmake
: 1641705450:0;~/dotfiles/.config/emacs/bin/doom doctor
: 1641705459:0;pacman -Ss isort
: 1641705465:0;pacman -Ss pipenv
: 1641705470:0;pacman -Ss nose
: 1641705482:0;pacman -Ss nose-test
: 1641705484:0;pacman -Ss nosetest
: 1641705499:0;sudo pacman -S python-pipenv python-isort
: 1641705506:0;sudo pacman -S python-pipenv python-isort python-nose
: 1641705522:0;~/dotfiles/.config/emacs/bin/doom doctor
: 1641705531:0;sudo pacman -Ss pytest
: 1641705538:0;sudo pacman -S python-pytest
: 1641705589:0;ls
: 1641705595:0;cat package
: 1641705598:0;cat package.el
: 1641705611:0;mv package.el packages.el
: 1641705614:0;ls
: 1641705617:0;cat packages.el
: 1641705632:0;~/dotfiles/.config/emacs/bin/doom doctor
: 1641705636:0;~/dotfiles/.config/emacs/bin/doom sync
: 1641709275:0;sudo pacman -S flatpak
: 1641709337:0;flatpak install flathub com.spotify.Client
: 1641709421:0;sway exit
: 1641709453:0;ls
: 1641709458:0;cd /usr/share
: 1641709458:0;ls
: 1641709469:0;waybar
: 1641709484:0;sway exit
: 1641709510:0;ls
: 1641709519:0;cd /usr/share
: 1641709520:0;ls
: 1641709539:0;cd applications
: 1641709539:0;ls
: 1641709549:0;find spotify .
: 1641709555:0;ls
: 1641709564:0;ls | grep spotify
: 1641709566:0;cd ..
: 1641709566:0;ls
: 1641709568:0;cd flatpak
: 1641709568:0;ls
: 1641709574:0;which spotify
: 1641709580:0;flatpak
: 1641709584:0;flatpak --help
: 1641709598:0;flatpak run
: 1641709653:0;pkill emacs
: 1641709661:0;emacs --debug-init
: 1641709822:0;echo $XDG_DATA_DIRS
: 1641709849:0;sudo reboot
: 1641710014:0;waybar
: 1641710036:0;ls
: 1641710079:0;flatpak run
: 1641710135:0;sway exit
: 1641710152:0;echo $XDG_DATA_DIRS
: 1641710185:0;man sway
: 1641710376:0;cd /etc/profile.d
: 1641710376:0;ls
: 1641710380:0;./flatpak
: 1641710382:0;./flatpak.sh
: 1641710390:0;sudo ./flatpak.sh
: 1641710394:0;ls
: 1641710398:0;sudo sh flatpak.sh
: 1641710402:0;cat flatpak
: 1641710404:0;cat flatpak.sh
: 1641710484:0;flatpak run spotify
: 1641710493:0;ols
: 1641710496:0;ls
: 1641710498:0;cd
: 1641710498:0;ls
: 1641710503:0;flatpak run --help
: 1641710526:0;flatpak run com.spotify.Client
: 1641711033:0;sudo systemctl status pipewire.service
: 1641711440:0;sway --debug
: 1641711500:0;sway
: 1641711508:0;sway --debug
: 1641711580:0;wayvbar
: 1641711581:0;waybar
: 1641711611:0;sway --debug
: 1641712235:0;sudo pacman -S libappindicator-*
: 1641712239:0;sudo pacman -S libappindicator
: 1641712245:0;sudo pacman -Ss libappindicator
: 1641712266:0;sudo pacman -S libappindicator-gtk3 libappindicator-gtk2
: 1641712280:0;sway --debug
: 1641712390:0;sway exit
: 1641712431:0;sway --debug
: 1641712710:0;sudo pacman -S thunderbird
: 1641713906:0;ls
: 1641713910:0;python3 wordcount.py
: 1641714011:0;~/dotfiles/.config/emacs/bin/doom sync
: 1641714996:0;python3 wordcount.py
: 1641716088:0;pacman -Ss pyls
: 1641716092:0;pacman -Ss pylsp
: 1641716097:0;pacman -Ss python-lsp
: 1641716105:0;sudo pacman -S python-lsp-server
: 1641716218:0;python3 wordcount.py
: 1641716225:0;python3 cone.py
: 1641717338:0;python3 spooky.py
: 1641720007:0;python3 new-hope.py
: 1641720676:0;python3 nextinline.py
: 1641721801:0;swaylock
: 1641721832:0;sudo shutdown now
: 1641752966:0;flatpak install flathub im.riot.Riot
: 1641753657:0;ls
: 1641753932:0;python3 weather.py
: 1641754653:0;ls
: 1641754655:0;cd ~/dotfiles
: 1641754656:0;stow .
: 1641754657:0;ls
: 1641777189:0;nmtui
: 1641777597:0;sudo pacman -S libreoffice
: 1641778722:0;pkill libreoffice
: 1641787818:0;wdisplays
: 1641787898:0;pkill wdisplays
: 1641787899:0;wdisplays
: 1641790817:0;pacman -Ss jitsi
: 1641790821:0;yay -Ss jitsi
: 1641791834:0;wdisplays
: 1641797903:0;ls
: 1641797905:0;cd dotfiles
: 1641797976:0;eval `ssh-agent -s`
: 1641797985:0;ssh-add ~/.ssh/ry_ecdsa
: 1641797992:0;git push github master
: 1641798032:0;eval `ssh-agent -s`
: 1641798038:0;ssh-add ~/.ssh/ry_ecdsa
: 1641798046:0;cd org
: 1641798048:0;git add .
: 1641798055:0;git commit -m "added projects"
: 1641798058:0;git push origin master
: 1641802317:0;ls
: 1641802321:0;cd projects
: 1641802321:0;ls
: 1641870506:0;sudo pacman -Rs gnome
: 1641870517:0;sudo pacman -Rs gdm
: 1641870544:0;sudo pacman -Rs gnome
: 1641870565:0;sudo pacman -Rs gnome-tweaks gnome-keyring
: 1641870572:0;sudo pacman -Rs gnome-tweaks gnome-keyring xdg-desktop-portal-gnome
: 1641870587:0;pfetch
: 1641870588:0;ls
: 1641870594:0;sudo pacman -S xorg-wayland
: 1641870598:0;sudo pacman -S xorg-xwayland
: 1641870604:0;sudo pacman -Ss xorg-xwayland
: 1641870608:0;sudo pacman -S xorg-xwayland
: 1641881092:0;ls
: 1641881093:0;cd downloads
: 1641881093:0;ls
: 1641881100:0;unzip Smut\ sale-20220111T060409Z-001.zip
: 1641881109:0;sudo pacman -S sxiv
: 1641881117:0;sudo pacman -S feh unzip
: 1641881120:0;unzip Smut\ sale-20220111T060409Z-001.zip
: 1641881152:0;sudo pacman -S mpv
: 1641881162:0;ls
: 1641881171:0;mpv IMG_0558.MOV
: 1641881239:0;cd Smut\ sale
: 1641881247:0;ls
: 1641881264:0;feh IMG_0847.PNG
: 1641881645:0;sudo pacman -S thunar
: 1641881670:0;thunar
: 1641884275:0;ls
: 1641884277:0;cd downloads
: 1641884278:0;ls
: 1641884282:0;unzip IMG_0864.MOV-20220111T065545Z-001.zip
: 1641886463:0;vim ~/dotfiles/.gitignore
: 1641886531:0;ls
: 1641886533:0;cd dotfiles
: 1641886533:0;ls
: 1641886550:0;cd .config
: 1641886550:0;ls
: 1641886556:0;cd ..
: 1641886556:0;ls
: 1641886561:0;vim .gitignore
: 1641886575:0;git add .
: 1642561311:0;ls
: 1642561319:0;cd projects/cookbooks/go-cookbook
: 1642561319:0;ls
: 1642561322:0;git pull origin master
: 1642562903:0;go run sandbox.go
: 1642562917:0;i
: 1642562919:0;go run sandbox.go
: 1642569930:0;lsblk
: 1642569951:0;mkdir ~/mnt
: 1642569956:0;mount /dev/sdd ~/mnt
: 1642569959:0;sudo mount /dev/sdd ~/mnt
: 1642569965:0;cd mnt
: 1642569966:0;ls
: 1642569969:0;cd books
: 1642569970:0;ls
: 1642569976:0;cd fiction
: 1642569976:0;ls
: 1642569981:0;cd ..
: 1642569989:0;ls
: 1642570003:0;rm *
: 1642570008:0;ls
: 1642570009:0;pwd
: 1642570016:0;cd ..
: 1642570016:0;ls
: 1642570028:0;rm -rf books
: 1642570032:0;sudo rm -rf books
: 1642570035:0;ls -la
: 1642570042:0;cd .Trash-1000
: 1642570042:0;ls
: 1642570044:0;cd files
: 1642570045:0;ls
: 1642570053:0;rm ./*
: 1642570057:0;rm -r ./*
: 1642570064:0;sudo rm -r ./*
: 1642570065:0;ls
: 1642570066:0;cd ..
: 1642570066:0;ls
: 1642570067:0;cd info
: 1642570068:0;ls
: 1642570079:0;sudo rm -rf ./*
: 1642570080:0;ls
: 1642570081:0;cd ..
: 1642570081:0;ls
: 1642570082:0;cd ..
: 1642570083:0;ls
: 1642570086:0;cd Digital\ Editions
: 1642570086:0;ls
: 1642570088:0;cd ..
: 1642570089:0;ls
: 1642570094:0;mkdir books
: 1642570113:0;sudo chown -R opal:opal .
: 1642570116:0;sudo sudo chown -R opal:opal .
: 1642570121:0;ls
: 1642570123:0;ls -la
: 1642570130:0;cd ..
: 1642570130:0;ls
: 1642570133:0;ls -la
: 1642570150:0;sudo chown -R opal:opal ~/mnt
: 1642570152:0;ls
: 1642570171:0;sudo -i
: 1642576563:0;ls
: 1642576564:0;cd dotfiles
: 1642576569:0;git add .

21
archive/zsh/.zprofile Normal file
View File

@@ -0,0 +1,21 @@
# Each new shell auto-imports all environment variables.
# Hence exporting needs to be done only once.
# Also, all non-login shells are descendants of a login shell.
# Ergo, exports need to be done in the login shell only.
# Hence, we put exports in .zprofile
# Only vars needed by external commands should be exported.
# Note that you can export vars w/out assigning a value to them.
eval $(keychain --eval --quiet ry_ecdsa)
eval $(keychain --eval --quiet id_rsa)
export MOZ_ENABLE_WAYLAND=1
export XDG_CONFIG_HOME=~/.config
export XDG_CACHE_HOME=~/.cache
export XDG_DATA_HOME=~/.local/share
export PASSWORD_STORE_ENABLE_EXTENSIONS=true
export BROWSER=/usr/bin/firefox
export VISUAL=vim
export EDITOR=vim
export WGETRC="$XDG_CONFIG_HOME/wgetrc"
export HISTFILE="$XDG_CONFIG_HOME/zsh/zsh_history"

9
archive/zsh/.zshenv Normal file
View File

@@ -0,0 +1,9 @@
if [[ -z "$XDG_CONFIG_HOME" ]]
then
export XDG_CONFIG_HOME="$HOME/.config"
fi
if [[ -d "$XDG_CONFIG_HOME/zsh" ]]
then
export ZDOTDIR="$XDG_CONFIG_HOME/zsh"
fi

32
archive/zsh/.zshrc Normal file
View File

@@ -0,0 +1,32 @@
# Enable colors and change prompt:
autoload -U colors && colors # Load colors
PS1="%B%{$fg[red]%}[%{$fg[yellow]%}%n%{$fg[green]%}@%{$fg[blue]%}%M %{$fg[magenta]%}%~%{$fg[red]%}]%{$reset_color%}$%b "
setopt autocd # Automatically cd into typed directory.
stty stop undef # Disable ctrl-s to freeze terminal.
setopt interactive_comments
## Exports ##
export PATH=$HOME/.local/bin:$PATH
export PATH=$HOME/bin:$PATH
# Basic auto/tab complete:
autoload -U compinit
zstyle ':completion:*' menu select
zmodload zsh/complist
compinit
_comp_options+=(globdots) # Include hidden files.
## Paths ##
# Scripts Path
PATH=$PATH:~/code/scripts
# Local Bin
PATH=$PATH:~/.local/bin
# Doom Path
PATH=$PATH:~/.config/emacs/bin/
# Load aliases and shortcuts if existent.
[ -f "${XDG_CONFIG_HOME:-$HOME/.config}/zsh/zsh_aliases" ] && source "${XDG_CONFIG_HOME:-$HOME/.config}/zsh/zsh_aliases"
[ -f "${XDG_CONFIG_HOME:-$HOME/.config}/zsh/zsh_functions" ] && source "${XDG_CONFIG_HOME:-$HOME/.config}/zsh/zsh_functions"

130
archive/zsh/zsh_aliases Normal file
View File

@@ -0,0 +1,130 @@
#######################################################
# ALIAS
#######################################################
# To temporarily bypass an alias, we preceed the command with a \
# EG: the ls command is aliased, but to use the normal ls command you would type \ls
# Source zsh
alias zshrcsource="source ~/.config/zsh/.zshrc"
# Pacman aliases
alias install='sudo pacman -S'
alias update='sudo pacman -Syu'
alias search='pacman -Ss'
alias remove='sudo pacman -Rs'
alias uninstall='sudo pacman -Rs'
# ip
alias ip="ip -c"
# Rsync push music to jellyfin
alias music-push="rsync -r -e 'ssh -p 46668' --info=progress2 /home/opal/music/to-push/* cleric:/data/container_storage/jellyfin/media/music/to-sort/"
# Add an "alert" alias for long running commands. Use like so:
# sleep 10; alert
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'
# alias to show the date
alias da='date "+%Y-%m-%d %A %T %Z"'
# Alias's to modified commands
alias cp='cp -i'
alias mv='mv -i'
alias rm='rm -iv'
alias mkdir='mkdir -p'
alias ps='ps auxf'
alias ping='ping -c 10'
alias less='less -R'
alias vi='vim'
alias vis='vim "+set si"'
# Change directory aliases
alias home='cd ~'
alias cd..='cd ..'
alias ..='cd ..'
alias ...='cd ../..'
alias ....='cd ../../..'
alias .....='cd ../../../..'
# cd into the old directory
alias bd='cd "$OLDPWD"'
# Alias's for multiple directory listing commands
alias la='ls -Alh' # show hidden files
alias ls='ls -aFh --color=always' # add colors and file type extensions
alias lx='ls -lXBh' # sort by extension
alias lk='ls -lSrh' # sort by size
alias lc='ls -lcrh' # sort by change time
alias lu='ls -lurh' # sort by access time
alias lr='ls -lRh' # recursive ls
alias lt='ls -ltrh' # sort by date
alias lm='ls -alh |more' # pipe through 'more'
alias lw='ls -xAh' # wide listing format
alias ll='ls -Fls' # long listing format
alias labc='ls -lap' #alphabetical sort
alias ldir="ls -l | egrep '^d'" # directories only
# Search command line history
alias h="history | grep "
# Search files in the current folder
alias f="find . | grep "
# Count all files (recursively) in the current folder
alias countfiles="for t in files links directories; do echo \`find . -type \${t:0:1} | wc -l\` \$t; done 2> /dev/null"
# Show current network connections to the server
alias ipview="netstat -anpl | grep :80 | awk {'print \$5'} | cut -d\":\" -f1 | sort | uniq -c | sort -n | sed -e 's/^ *//' -e 's/ *\$//'"
# Show open ports
alias openports='netstat -nape --inet'
# Alias's to show disk space and space used in a folder
alias diskspace="du -S | sort -n -r |more"
alias folders='du -h --max-depth=1'
alias folderssort='find . -maxdepth 1 -type d -print0 | xargs -0 du -sk | sort -rn'
alias tree='tree -CAhF --dirsfirst'
alias treed='tree -CAFd'
alias mountedinfo='df -hT'
# Alias's for archives
alias mktar='tar -cvf'
alias mkbz2='tar -cvjf'
alias mkgz='tar -cvzf'
alias untar='tar -xvf'
alias unbz2='tar -xvjf'
alias ungz='tar -xvzf'
# Show all logs in /var/log
alias logs="sudo find /var/log -type f -exec file {} \; | grep 'text' | cut -d' ' -f1 | sed -e's/:$//g' | grep -v '[0-9]$' | xargs tail -f"
# SHA1
alias sha1='openssl sha1'
# Wireguard
alias wgup='sudo wg-quick up /etc/wireguard/wg0.conf'
alias wgdown='sudo wg-quick down /etc/wireguard/wg0.conf'
# Hugo
alias hss='hugo server --noHTTPCache'
# Work
alias stork='ssh stork'
alias mail='ssh mail'
alias eel='ssh eel'
# Wget (keeps hsts files out of $HOME)
alias wget='wget --hsts-file="$XDG_CACHE_HOME/wget-hsts"'
# vim -> neovim (cuz nvim > vim)
alias vim='nvim'
# Ansible
alias ans-run="ansible-playbook site.yml --ask-become-pass"
alias ans-run-tag="ansible-playbook site.yml --ask-become-pass --tags"
alias ans-run-start="ansible-playbook site.yml --ask-become-pass --start-at-task"
# Misc
alias music-push="rsync -e 'ssh -p 46668' --info=progress2 -r /home/opal/music/to-push/ cleric:/data/container_storage/jellyfin/media/music/to-sort/"

View File

@@ -0,0 +1,9 @@
# Make directory and `cd` into it.
mkcd() {
mkdir -p -- "$1" && cd -P -- "$1"
}
# cd & ls
cs() {
cd "$@" && ls
}