Skip to content

Instantly share code, notes, and snippets.

View iandol's full-sized avatar
👾
typing away...

Ian Max Andolina iandol

👾
typing away...
  • Institute of Neuroscience, Chinese Academy of Sciences
  • Shanghai
  • 23:36 (UTC +08:00)
View GitHub Profile
@ttscoff
ttscoff / bitlyize.rb
Created October 25, 2014 22:30
Bitlyize Service/CLI to shorten links and automatically add affiliate tags
#!/usr/bin/ruby
# encoding: utf-8
# Bitlyize by Brett Terpstra 2014
# Shortens all URLs in input and automatically adds Amazon and iTunes affiliate codes
# A single bitly link passed to this script will return the long url
# This script was designed for use in an OS X System Service, but runs
# as a CLI and can be included as a Ruby library in other scripts
#
# The bitly_username and bitly_key variables are required
# Optionally configure the custom domain, and itunes and amazon affiliate variables
@bpj
bpj / pandoc-class2style.pl
Last active June 9, 2017 12:55
pandoc-class2style.pl - filter to translate single pandoc classes into attribute lists or LaTeX commands (with POD documentation)
#!/usr/bin/env perl
# pandoc-class2style.pl - filter to translate single span/div classes into LaTeX commands and attribute lists
# POD documentation below the code!
use utf8;
use autodie 2.29;
use 5.010001;
use strict;
set myBibFile to "/Users/zhope/Dropbox/Sundry/Library.bib"
if myBibFile exists then
set currentBibs to do shell script "/usr/local/bin/pandoc-citeproc --bib2json " & quoted form of myBibFile & " | /usr/local/bin/jq -r ' .[] | \"\\(.id)\"'"
set currentBibs to paragraphs of currentBibs
end if
set bibFile to POSIX file myBibFile
my write_to_file("", bibFile, true)
@e11s
e11s / amphetamine-on
Created January 9, 2019 23:45
Amphetamine Control AppleScript
on alfred_script(q)
tell application "Amphetamine"
set sessionActiveTest to session is active
if sessionActiveTest is false then
if (q is not in {"", null}) then
@zverhope
zverhope / bookends-generate_bib.py
Last active December 30, 2020 13:35
Auto-generate and regularly update bib file from Bookends library
#!/usr/bin/env -S PATH="${PATH}:/usr/local/bin" PYTHONIOENCODING=UTF-8 LC_ALL=en_US.UTF-8 python
# -*- coding: utf-8 -*-
then = "20201229160152"
import re, shutil, sys
import os.path, time
from datetime import datetime as dt
import json
from subprocess import Popen, PIPE
@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
@naupaka
naupaka / bookends_to_bibtex.scpt
Last active November 15, 2021 22:15
Applescript to export selected groups in the Bookends bibliography management software to bibtex files
#!/usr/bin/osascript
(*
Script written by Naupaka Zimmerman
March 17, 2017
MIT License
Copyright (c) 2017 Naupaka Zimmerman
@zverhope
zverhope / be_orphaned_files.scpt
Last active December 16, 2022 08:24
Find orphaned files in Bookends, whether with hierarchical or flat folder structure, and then move to Orphans folder
set theFolder to (path to home folder as text) & "Library:Mobile Documents:iCloud~com~sonnysoftware~bot:Documents"
set BEList to {}
set orphanList to {}
set FinderList to {}
set pathList to {}
set od to AppleScript's text item delimiters
tell application "Finder"
-- create a list of the name of every file in the folder you've set
set FinderList to every file of folder theFolder as alias list
@deanishe
deanishe / rename_workflow.py
Last active December 20, 2022 14:05
Rename Alfred workflow folders after their Bundle IDs
#!/usr/bin/python
# encoding: utf-8
#
# rename_workflow
#
# Copyright (c) 2015 Dean Jackson <deanishe@deanishe.net>
#
# MIT Licence. See http://opensource.org/licenses/MIT
#
# Created on 2015-08-02
@JMichaelTX
JMichaelTX / Copy & Get Selection to Clipboard JXA.js
Last active January 2, 2023 19:32
Copy & Get Selection to Clipboard using JavaScript for Automation (JXA) [Ver 1.1.1]
'use strict';
var app = Application.currentApplication()
app.includeStandardAdditions = true
var mySelection = copySelection("Safari", 1)
mySelection
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
function copySelection(pAppName, pTimeLimitSec) {