Skip to content

Instantly share code, notes, and snippets.

View richbs's full-sized avatar

Richard Barrett-Small richbs

View GitHub Profile
@richbs
richbs / musicbrainz.py
Last active September 11, 2023 18:32
Pull release and track info from Musicbrainz
import sys
import os
import requests
import json
import pprint
print(sys.argv)
if len(sys.argv) > 1:
release_id = sys.argv[1]
else:
@richbs
richbs / obsidian-web-clipper.js
Last active March 20, 2023 10:50 — forked from kepano/obsidian-web-clipper.js
Obsidian Web Clipper Bookmarklet to save articles and pages from the web (for Safari, Chrome, Firefox, and mobile browsers)
javascript: Promise.all([import('https://unpkg.com/turndown@6.0.0?module'), import('https://unpkg.com/@tehshrike/readability@0.2.0'), ]).then(async ([{
default: Turndown
}, {
default: Readability
}]) => {
/* Optional vault name */
const vault = "";
/* Optional folder name such as "Clippings/" */
from datetime import datetime, date
import json
import os
import sys
import glob
import re
import csv
def make_page(outfile, props, mdoutlines, body_text, created_time, source):
print('giugjg' +outfile)
@richbs
richbs / transcribe.py
Last active February 7, 2023 16:31
transcribe.py
# https://www.microsoft.com/store/productId/9PJPW5LDXLZ5
# choco install ffpmeg ptime
# pip3 install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu116 whisper-ai
import whisper
model = whisper.load_model("base") # medium
result = model.transcribe("C:\\Users\\Rich Barrett-Small\\Music\\Sunday_Feature_-_Silent_Witness_-_John_Cage_Zen_and_Japan_m000kwm0_original.m4a")
print(result["text"])
print(result)
@richbs
richbs / .vimrc
Last active February 26, 2020 22:41
if empty(glob('~/.vim/autoload/plug.vim'))
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif
" Plugins will be downloaded under the specified directory.
call plug#begin('~/.vim/plugged')
" Declare the list of plugins.
@richbs
richbs / files.sh
Created August 30, 2019 14:31
Bash to copy and rename files from first line
#!/bin/bash
mkdir -p out
for filename in *.txt; do
[ -e "$filename" ] || continue
outfile=out/$(head -n 1 "$filename" | tr -d '\r?\n' | tr '/' ' ').txt
[ -e "$outfile" ] && outfile=out/$(head -n 1 "$filename" | tr -d '\r?\n' | tr '/' ' ')$(gdate +%s%N).txt
tail -n +2 "$filename" > "$outfile"
touch -r "$filename" "$outfile"
done;
@richbs
richbs / command_ctrl
Created March 22, 2018 14:51
vim /usr/share/X11/xkb/symbols/command_ctrl
// Ctrl is mapped to the Command keys (and the usual Ctrl keys).
partial modifier_keys
xkb_symbols "command_ctrl_mac" {
key <LWIN> { [ Control_L ] };
key <RWIN> { [ Control_R ] };
key <LALT> { [ Super_L ] };
modifier_map Control { <LWIN>, <RWIN> };
// modifier_map Mod1 { Alt_L, Alt_R };
modifier_map Mod4 { <LALT> };
};
@richbs
richbs / config
Created March 22, 2018 09:34
~/.ssh/config
host 10.0.2.*
ForwardAgent yes
host *
UseKeychain yes
AddKeysToAgent yes
//: Playground - noun: a place where people can play
import Cocoa
var str = "Hello, playground"
print(str);
@richbs
richbs / json_tidy.py
Created February 1, 2017 20:59
json_tidy.py
import os
import json
import sys
print sys.argv[1]
for root, dirs, files in os.walk(sys.argv[1]):
print "In", root
for f in files:
if f.endswith('.json'):