Skip to content

Instantly share code, notes, and snippets.

@bsag
bsag / README.md
Last active July 12, 2023 19:38
Selected files from my standalone Nix/Home Manager set up on macOS to illustrate the general approach

These files illustrate the way that I have set up Nix and Home Manager for standalone use on macOS on both an Intel and Apple Silicon machine, in case the examples are useful to anyone. Some of the configuration is separated out into separate files in configs/ which get imported in home.nix. Some of my existing dotfiles are placed in dotfiles/ and then symlinked in by Nix to the location that that the system expects to find them.

It is a work in progress so currently I am handling installation of R separately.

@bsag
bsag / main.go
Created June 20, 2021 11:03
A system for exporting references from Zotero and importing them to Tiddlywiki.
package main
import (
"bufio"
"bytes"
"encoding/json"
"fmt"
"io/fs"
"log"
"net/http"
@bsag
bsag / goodreads_huginn.json
Created August 19, 2017 17:23
Code to parse Goodreads feed in Huginn
{
"instructions": {
"title": "{{title}} by {{author.name}}, {{published.year}}",
"body": "<p>{% regex_replace \"^(?<pt1>.+/)(?<idcode>\\d+)s(?<pt2>/.+)$\" in %}{{cover.source}}{% with %}{{ pt1 }}{{ idcode }}l{{ pt2 }}{% endregex_replace %}<\/p><p>My rating: {{rating.num}} of 5 stars<\/p><p>{{review.text}}<\/p><p>Read all my reviews on <a href=\"https://www.goodreads.com/user/show/33331686-bsag\">Goodreads<\/a><\/p>"
},
"matchers": [
{
"path": "{{description}}",
"regexp": "author:\\s*(?<name>.+?)<br>",
"to": "author"
@bsag
bsag / README.md
Created April 8, 2015 10:03
Marked.app private layer for Spacemacs

This is a silly little private layer I put together for Spacemacs to allow me to open the current (Markdown) buffer in Marked 2.app when I hit the key combo SPC om. Since I am very new to both Emacs and Spacemacs, I am not at all confident that the functions are in the appropriate places, and I am sure it could be done more simply. Having said all that, it works!

To activate it put the two .el files above within a folder called 'marked' within your 'private' folder (or whatever folder you have pointed dotspacemacs-configuration-layer-path at). Then you just need to add marked to your dotspacemacs-configuration-layers list in your .spacemacs.

@bsag
bsag / .vimrc
Last active October 20, 2018 21:13
My vim and tmux configs, using airline (as discussed [here](http://www.rousette.org.uk/blog/archives/tinkering-with-vim/). The Powerline theme is pretty much the default (may be a bit old now) and I just commented out a few plugins I didn't need. I use the patched Sauce Code Pro for my powerline/airline font.
" Set up Vundle to manage plugins
set nocompatible
filetype off
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
" let Vundle manage Vundle, required
Plugin 'gmarik/vundle'
@bsag
bsag / complex-article.xelatex
Created December 7, 2013 11:04
A PDF/XeLaTeX export template for Texts (http://www.texts.io) for a more complex article. Numbered sections, a separate title page and page headers/footers. Put this file in ~/Library/Application Support/Texts. Restart Texts and when you choose `File > Export > Export PDF/Export XeLaTeX` the `Templates` drop down at the bottom of the file choose…
%% Complex report template
% Suitable for longer reports:
% Titlepage, numbered sections, more complex page headers/footers
\documentclass[11pt,a4paper,twoside,openany,final,article]{memoir}
\usepackage{polyglossia}
% change the language and variant for your own needs
\setdefaultlanguage[variant=british]{english}
% use standard math symbols
@bsag
bsag / simple-article.xelatex
Created December 7, 2013 11:02
A PDF/XeLaTeX export template for Texts (http://www.texts.io) for a simple article. No section numbering, no title page and plain layout. Put this file in ~/Library/Application Support/Texts. Restart Texts and when you choose `File > Export > Export PDF/Export XeLaTeX` the `Templates` drop down at the bottom of the file chooser should include th…
%% Simple article template
% No section numbering, no title page, plain layout
%
\documentclass[11pt,a4paper,oneside,final,article]{memoir}
\usepackage{polyglossia}
% change the language and variant for your own needs
\setdefaultlanguage[variant=british]{english}
% use standard math symbols
\usepackage{amssymb}
@bsag
bsag / README.md
Last active March 6, 2017 21:49
Dashing (http://shopify.github.io/dashing/) widget that gets your recent posts on App.net. Uses the publicly available RSS feed.

Description

Dashing (http://shopify.github.io/dashing/) widget that gets your recent posts on App.net. Uses the publicly available RSS feed. You can find this feed on your profile page (RSS link).

Screenshot

appnet widget screenshot

Dependencies

@bsag
bsag / add-slug-from-filename.py
Created June 8, 2013 11:29
Quick and dirty script to parse slug from filename and add to file for Pelican
#!/usr/bin/env python
import os
import os.path
import re
path = "."
for file in os.listdir(path):
current_file = os.path.join(path, file)
@bsag
bsag / README.md
Last active December 16, 2015 11:18
Octoping: Octopress Rake task to ping URI.LV to notify it about new content when you deploy your site.

Instructions for setting up Octopress to ping URI.LV

URI.LV checks at regular intervals (about once an hour) to check whether your Octopress Atom or RSS feed has been updated. However, if you'd like to notify URI.LV as soon as you publish, and you have a Premium URI.LV account, you can set up Octopress to ping URI.LV when you deploy.

Requirements

  1. You use Octopress
  2. You use URI.LV to manage your Octopress Atom or RSS feed and have a Premium URI.LV account

Setting up