Skip to content

Instantly share code, notes, and snippets.

@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 / .bashrc
Created January 15, 2009 19:07 — forked from henrik/.bashrc
# http://henrik.nyh.se/2008/12/git-dirty-prompt
# http://www.simplisticcomplexity.com/2008/03/13/show-your-git-branch-name-in-your-prompt/
# username@Machine ~/dev/dir[master]$ # clean working directory
# username@Machine ~/dev/dir[master*]$ # dirty working directory
# bsag: I combined the best of both worlds and used the parse_git_dirty function here:
# http://www.simplisticcomplexity.com/2008/03/13/show-your-git-branch-name-in-your-prompt/#comment-4166
# as well as various other mods from the forks of this gist.
function parse_git_dirty {
git diff --quiet HEAD &>/dev/null
@bsag
bsag / conkyrc
Created May 15, 2010 18:18
conkyrc for bottom status bar on Xmonad
#On background
background no
cpu_avg_samples 2
use_xft
out_to_x no
out_to_console yes
@bsag
bsag / xmonad.hs
Created May 29, 2010 11:06
My xmonad.hs file, put together from some great examples on the XMonad wiki. Wish I could remember which and give credit!
{- xmonad.hs -}
-- Imports --
-- main
import XMonad
import IO (Handle, hPutStrLn)
-- utils
import qualified Data.Map as M
import XMonad.Util.Run (spawnPipe)
-- hooks
@bsag
bsag / README
Created January 4, 2012 10:34
Create a WXR-format export file to export comments from ExpressionEngine and import into Disqus
I had some difficulty trying to get a format exported from ExpressionEngine which I could use to import comments into Disqus, and eventually settled on the code above after looking at Disqus' own import format (http://docs.disqus.com/developers/export/import_format/) and trawling the ExpressionEngine forums to adapt other solutions which exported to Movable Type format.
You need to start off by creating a new template group called 'export'. Inside that, you make a template called 'index' and paste in the contents of index.xml above, making sure that you replace the channel name and template group name to those appropriate for your setup. This needs to be the index for the template group. Next, create another template called 'comments' and paste the contents of comments.xml, again, replacing the channel name as appropriate.
Now visit http://yoururl.com/export and you should see the exported entries. Wait for the whole page to load which may take some time with a lot of entries. Then use your browsers 'View s
@bsag
bsag / panda.rb
Created December 3, 2012 18:49
Wrapper script for Pandoc. Sets some defaults and makes it easier to generate the small range of output formats I use. Requires the 'commander' gem.
#!/usr/bin/env ruby
require 'rubygems'
require 'commander/import'
program :version, '0.1'
program :description, 'Converts markdown documents into a variety of default formats using Pandoc'
CMD = "pandoc"
BIB = "$HOME/Dropbox/Documents/bibtex/all-refs.bib"
@bsag
bsag / _config.yml
Last active December 11, 2015 23:28
Javascript to parse App.net RSS (cached locally) and generate an HTML widget listing recent posts (with links to source post). A fuller description here: http://www.rousette.org.uk/blog/archives/app-dot-net-widget/
# Excerpt...
# You want to add a section including your App.net details
# Then adn.html will pull the info into the template.
# App.net
adn_user: bsag
adn_post_count: 5
adn_cache_path: "/blog/data/adn.xml"
@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

@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 / 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