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 / .slate
Created February 10, 2013 19:32
My Slate config
# My slate file
# 10-02-2013
# Basic mappings and bindings for moving screens around
# I have set up my right command key to trigger ctrl+alt+shift+cmd
# see http://stevelosh.com/blog/2012/10/a-modern-space-cadet/#hyper for details
config defaultToCurrentScreen true
config windowHintsShowIcons true
config windowHintsIgnoreHiddenWindows false
config windowHintsSpread true
@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 / .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 / 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
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 / 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 / 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 / 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