Skip to content

Instantly share code, notes, and snippets.

View acsr's full-sized avatar

Armin Stross-Radschinski acsr

View GitHub Profile
@pixelite
pixelite / Vagrant-sphinx-pdflatex.md
Last active March 14, 2018 15:11
Creating a Vagrant vm with sphinx and pdflatex

First create a Vagrantfile:

vagrant init precise64

Then add the following to the new Vagrantfile:

config.vm.provision :shell, :inline => <<-EOT
@mgedmin
mgedmin / conf.py.rst
Created July 22, 2013 10:37
HOWTO add "Show on GitHub" and "Edit on GitHub" links to the Sphinx sidebar

Edit on GitHub links for Sphinx

Create _ext/ and _templates/ subdirectories.

Move edit_on_github.py into the _ext/ subdirectory.

Move sourcelink.html into the _templates/ subdirectory.

Add the following after the import sys, os line

@kdart
kdart / dirwatcher
Created March 10, 2015 07:34
Script to watch directory and launch hander.
#!/usr/bin/python2.7
# -*- coding: utf-8 -*-
# vim:ts=4:sw=4:softtabstop=4:smarttab:expandtab
"""
Watch for new downloads in ~/Downloads (or another directory) and take actions.
The actions are determined by the file extension (determining the mime type).
"""
from __future__ import absolute_import
from __future__ import print_function
@gforcada
gforcada / invalid_tickets_dev_plone_org.js
Created April 26, 2015 19:51
Easily close dev.plone.org tickets as invalid with greasemonkey
// ==UserScript==
// @name dev.plone.org close bug as invalid
// @namespace plone
// @include https://dev.plone.org/ticket/*
// @version 1
// @grant none
// @run-at document-end
// ==/UserScript==
$(document).ready(function () {
@SpotlightKid
SpotlightKid / clone-gists.py
Last active April 11, 2024 15:31
Clone all gists of GitHub username given on the command line.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Clone all gists of GitHub user with given username.
Clones all gist repos into the current directory, using the gist id as the
directory name. If the directory already exists as a git repo, try to perform a
'git pull' in it.
"""
@leoloobeek
leoloobeek / get_gists.py
Created April 26, 2017 21:34
Download all gists for a specific user
# first: mkdir user && cd user && cp /path/to/get_gists.py .
# python3 get_gists.py user
import requests
import sys
from subprocess import call
user = sys.argv[1]
r = requests.get('https://api.github.com/users/{0}/gists'.format(user))
@acsr
acsr / Zotero-BetterBibTeX-QuickCopy-eta-template.eta
Last active June 27, 2024 19:35
This code was moved to a regular repo. See last comment. – Enhanced eta-template to export multiple Zotero items for pasting into Logseq including title, url, creators, tags, select link, abstractNote, multiple notes, multiple relations and the rights. Code completely rewritten after support by Emiliano Heyns and his update of the code of his Zo…
<%- for (const item of it.items) {
const [ , kind, lib, key ] = item.uri.match(/^https?:\/\/zotero\.org\/(users|groups)\/((?:local\/)?[^/]+)\/items\/(.+)/)
const select = (kind === 'users') ? `zotero://select/library/items/${key}` : `zotero://select/groups/${lib}/items/${key}`
const relations = []
if (item.relations) {
for (const [kind, rels] of Object.entries(item.relations)) {
for (const rel of rels) {
relations.push(rel)
}