Skip to content

Instantly share code, notes, and snippets.

{
"breadcrumbs.enabled": false,
"editor.cursorBlinking": "solid",
"editor.folding": false,
"editor.fontSize": 15,
"editor.formatOnSave": true,
"editor.glyphMargin": false,
"editor.lightbulb.enabled": false,
"editor.lineNumbers": "off",
"editor.matchBrackets": "never",
@bradyt
bradyt / read.el
Last active August 19, 2019 10:34
(defun my-get-good-basename-from-url (url)
(let* ((url (car (split-string url "#")))
(fn (file-name-sans-extension
(file-name-nondirectory
(directory-file-name url)))))
fn))
;; (unless (equal (my-get-good-basename-from-url "http://blah.org/blah/abc.html") "abc") (error ""))
;; (unless (equal (my-get-good-basename-from-url "http://blah.org/blah/abc") "abc") (error ""))
;; (unless (equal (my-get-good-basename-from-url "http://blah.org/blah/abc/") "abc") (error ""))
void main() {
var thing = ['a:b', 'c:d:e'];
var subaccounts = Set<String>();
for (var t in thing) {
while (t.lastIndexOf(':') != -1) {
t = t.substring(0, t.lastIndexOf(':'));
subaccounts.add(t);
}
}
print(thing.toSet().union(subaccounts).toList()..sort());
(defun my-read-webpage-in-org-mode (url)
(interactive "sEnter a url: ")
(let* ((url (car (split-string url "#")))
(fn (expand-file-name
(concat (file-name-nondirectory url) ".org")
"~/Downloads")))
(shell-command (format "pandoc %s -o %s --columns=70" url fn))
(with-current-buffer (find-file fn)
(hl-line-mode)
(text-scale-set 3))))
@bradyt
bradyt / README
Last active May 28, 2019 11:20
karabiner-elements+hammerspoon
Recently, I have had difficulty using karabiner-elements to bind
caps_lock to cmd+ctrl+alt, i.e., without shift.
I got it working recently, but docs seem to take me there in a
haphazard way. I contend that the karabiner-elements
documentation is not completely clear on what to do.
If one gets stuck, you might look at
https://github.com/tekezo/Karabiner-Elements/issues/1225, or
request there to clarify further, or open similar issue.
@bradyt
bradyt / Dockerfile
Created April 11, 2019 10:48
A minimal working build of weechat-matrix
FROM ubuntu
RUN apt-get update && apt-get install -y \
cmake \
git \
python-pip \
&& rm -rf /var/lib/apt/lists/*
RUN python -m pip install --upgrade pip
FROM ubuntu
RUN apt-get update && apt-get install -y \
git \
libolm-dev \
python-pip \
&& rm -rf /var/lib/apt/lists/*
RUN python -m pip install --upgrade pip
import os.path
from plaid2qif.plaid2qif import open_client, read_access_token, download
CFG_DIR = "./cfg"
CREDENTIALS = os.path.join(CFG_DIR, "plaid-credentials.json")
def return_list_accounts(institution, plaid_credentials):
client = open_client(plaid_credentials)
; From https://www.ledger-cli.org/3.0/doc/ledger3.html#index-_002d_002dpivot-TAG-1
; $ ledger bal Fuel --pivot "Car" --period "this year"
; $ 3491.26 Car
; $ 1084.22 M3:Expenses:Auto:Fuel
; $ 149.65 MG V11:Expenses:Auto:Fuel
; $ 621.89 Prius:Expenses:Auto:Fuel
; $ 1635.50 Sienna:Expenses:Auto:Fuel
; $ 42.69 Expenses:Auto:Fuel
; --------------------
; $ 3533.95
@bradyt
bradyt / output
Last active February 28, 2019 03:33
> flutter doctor -v
[✓] Flutter (Channel beta, v1.2.1, on Mac OS X 10.13.3 17D102, locale en-US)
• Flutter version 1.2.1 at /Users/iam/opt/flutter
• Framework revision 8661d8aecd (13 days ago), 2019-02-14 19:19:53 -0800
• Engine revision 3757390fa4
• Dart version 2.1.2 (build 2.1.2-dev.0.0 0a7dcf17eb)
[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
• Android SDK at /Users/iam/Library/Android/sdk
• Android NDK location not configured (optional; useful for native profiling support)