Skip to content

Instantly share code, notes, and snippets.

View paulelms's full-sized avatar

Paul Elms paulelms

View GitHub Profile
@kronn
kronn / workrave-info
Created August 29, 2018 08:43
A small tool to query workrave via DBus and implement a text-based widget for status-bars
#!/usr/bin/env /home/mviehweger/.rvm/wrappers/ruby-2.4.2/ruby
# frozen_string_literal: true
# http://trac.luon.net/data/ruby-dbus/tutorial/basic_client.html
# for ubuntu, there is d-feet
begin
require 'dbus'
rescue LoadError => e
require 'rbconfig'
@aquarius
aquarius / OPML2PDF.scpt
Last active February 5, 2023 19:07
Export OPML as PDF in MindNode
set folderPath to choose folder
set fileExtension to "opml"
tell application "Finder"
try
set the fileList to files of folderPath whose name extension is fileExtension
end try
end tell
tell application "/Applications/MindNode.app"
repeat with mindNodeFile in fileList
open (mindNodeFile as alias)
@kristopherjohnson
kristopherjohnson / pasteboard.swift
Created January 11, 2015 00:58
Utility functions to copy/paste text
import Foundation
#if os(iOS)
import UIKit
#else
import AppKit
#endif
/// Return string value currently on clipboard
func getPasteboardContents() -> String? {
#!/bin/bash
# Bash completion for `up` <http://brettterpstra.com/2014/05/14/up-fuzzy-navigation-up-a-directory-tree/>
_up_complete()
{
local rx
local token=${COMP_WORDS[$COMP_CWORD]}
local IFS=$'\t'
local words=$(dirname `pwd` | tr / " ")
local nocasematchWasOff=0
@ttscoff
ttscoff / up.sh
Last active June 20, 2016 10:07
up: Quickly cd up a directory tree
# inspired by `bd`: https://github.com/vigneshwaranr/bd
function _up() {
local rx updir
rx=$(ruby -e "print '$1'.gsub(/\s+/,'').split('').join('.*?')")
updir=`echo $PWD | ruby -e "print STDIN.read.sub(/(.*\/${rx}[^\/]*\/).*/i,'\1')"`
echo -n "$updir"
}
function up() {
if [ $# -eq 0 ]; then
@ttscoff
ttscoff / folderize.rb
Created May 4, 2014 13:37
A script to create nested folders from a flat folder containing files with configured prefixes
#!/usr/bin/env ruby
require 'yaml'
require 'fileutils'
class Folderize
def initialize(config_file=false)
config_file = File.expand_path("~/.folderize") unless config_file
# Set up config
unless File.exists?(config_file)
@pepelsbey
pepelsbey / hocus.scss
Last active March 1, 2024 11:03
Simple “Hocus” Sass @mixin for :hover and :focus pseudos. Makes them easier to write and you’ll never forget to specify both.
@mixin hocus {
&:hover,
&:focus {
@content;
}
}
// Before
E {
&:hover,
@ttscoff
ttscoff / tagfiler.rb
Last active March 22, 2024 18:41
Moves files to folders based on special tags in OS X Mavericks
#!/usr/bin/env ruby
# encoding: utf-8
# tag primary folders =Tagname
# target them with #Tagname
# tag subfolders with @nickname
# target them with :nickname
# if no tagged folder exists but there's a matching folder name, that's used
# otherwise it will create folders based on :tags
# :tags can be strung together :bt:Drafts:testing for nesting
# Only one #Tag and one :path should exist in a file's tags
@Zettt
Zettt / OpenMeta2OSXTags.sh
Last active May 5, 2021 15:58
Script that reads OpenMeta tags and writes them to OS X Mavericks tags. http://mosx.tumblr.com/post/54049528297/convert-openmeta-to-os-x-mavericks-tags-with-this This requires a OpenMeta binary to be installed. Change its path, if you prefer it to be somewhere else. For the files to be processed properly don't include a trailing slash in `$files…
# =============================================================
# = OpenMeta to OS X Tags =
# =============================================================
# Script to convert OpenMeta tags to OS X Mavericks tags.
#
# Created by Zettt (Andreas Zeitler) on 2013-06-28
# Source www.macosxscreencasts.com, mosx.tumblr.com
#
# OpenMeta to OS X Tags by Andreas Zeitler is licensed under a
# Creative Commons Attribution-NonCommercial-ShareAlike
@ttscoff
ttscoff / searchlink.rb
Last active February 26, 2024 07:05
SearchLink creates Markdown links from automatic searches based on special syntax.