Skip to content

Instantly share code, notes, and snippets.

View hepcat72's full-sized avatar

Robert Leach hepcat72

View GitHub Profile
@hepcat72
hepcat72 / New reminder from Launchbar
Last active September 23, 2016 16:41 — forked from mlgill/New reminder from Launchbar
A script for quickly adding reminders to the Reminders app in Mountain Lion from Launchbar and Alfred. Save this as a .scpt and drop it in ~/Library/Application\ Support/LaunchBar/Actions
--Script for setting Reminders for LaunchBar and Alfred
--For Alfred, Applescript must NOT be set to run in Background otherwise date parsing does not work
--For LaunchBar, place the script in ~/Library/Scripts/LaunchBar
--by Michelle L. Gill, 10/07/2012
--Inspired by https://gist.github.com/3187630
--A related Alfred version 2 workflow can be found here: https://github.com/mlgill/alfred-workflow-create-reminder
--Changes
--02/01/2013 * Fixed an issue with setting the time when the hour is 12 and AM/PM (12-hour clock) is used
-- * Removed the ability to set seconds for the time since Reminders doesn't recognize them
@hepcat72
hepcat72 / create_reminder_from_file.scpt
Last active November 5, 2016 18:57
Applescript Folder Action to create reminders from files added (for user with IFTTT's Google Calendar and Dropbox channels)
--Download this file and put it in your ~/Library/Scripts/Folder Action Scripts folder, then attach it to a dropbox folder to run when items are added to it. Create those files using IFTTT recipes.
--This script creates a reminder from a file (e.g. when my wife adds a new event to her work calendar (containing the word "work" in the title) IFTTT creates a file inside dropbox which this script parses to create a static reminder(s) for a certain time that day, e.g. feed the cat and change the litter)
--Each line of the input file must be (Comments with # characters allowed):
-- Reminder List name to which to add the reminder
-- Due date (e.g. "August 31, 2016" optionally followed by " at 5:00am")
-- Due time (e.g. 9:00 AM)
-- Title (Name of the reminder)
-- Keyword (if found in the original title, reminder is created)
-- Original title (Title of the google calendar event)
--The file name have multiple events (every 6 lines)
@hepcat72
hepcat72 / Count Nucleotides.scpt
Last active May 19, 2021 20:24
Automator services for frequent bioinformatics tasks
--What is this: This is an applescript to use in an automator service that allows you to get the nucleotide and alignment length of a sequence, along with stats on the numbers of individual characters.
--Purpose: Determine the length of a selected nucleotide and alignment string in any application.
--Installation: Create an Automator service, paste this code into a "Run AppleScript" action, and save.
--How to use it: 1. Select a nucleotide string (newlines, numbers, spaces, and any other character are allowed). 2. Right-click the selection and select this service.
--Author: Robert Leach, Genomics Group, Princeton, [email protected]
--Note, this counts "DNA characters"
on run {input, parameters}
tell application "System Events"
--Purpose: Calculate the result of a highlighted equation and append the result.
--How to use it:
-- 1. Highlight an equation in an editable text area.
-- 2. Right click the selection and select Services->Calculate & Append Result
--Author: Robert Leach, Genomics Group, Princeton, [email protected]
on run {input, parameters}
tell application "System Events"
--Bring up spotlight
keystroke " " using {command down}
@hepcat72
hepcat72 / Galaxy-Workflow-ChIP-Seq_Single_End_-_Step_2__Peaks_and_Motifs.ga
Created October 24, 2018 15:14
This workflow crashes the galaxy workflow editor, so I'l sharing it for debug purposes
{
"uuid": "b658f22b-96c9-46fb-9337-9beba3798044",
"tags": [],
"format-version": "0.1",
"name": "ChIP-Seq Single End - Step 2: Peaks and Motifs",
"steps": {
"0": {
"tool_id": null,
"tool_version": null,
"outputs": [],
{"tests": [{"data": {"status": "failure", "tool_id": "barcode_splitter", "time_seconds": 38.440266132354736, "inputs": {"runinterface|seqfiles_0|nameinterface|readtype": "single", "runinterface|seqfiles_1|nameinterface|readtype": "singleindex", "runinterface|seqfiles_1|nameinterface|readname": "read2", "barcodes_at_end": false, "runinterface|seqfiles_0|input": {"src": "hda", "id": "5729865256bc2525"}, "runinterface|seqfiles_0|nameinterface|readname": "read1", "bcfile": {"src": "hda", "id": "2891970512fa2d5a"}, "runinterface|seqfiles_1|input": {"src": "hda", "id": "54f2a3a23292eb07"}, "runinterface|seqfiles_2|input": {"src": "hda", "id": "8155e4b4bf1581ff"}, "mismatches": "2", "runinterface|run_type": "flexible", "split_all": true, "runinterface|seqfiles_2|nameinterface|readname": "index2", "runinterface|seqfiles_2|nameinterface|readtype": "index"}, "tool_version": "0.18.4.0", "output_problems": [""], "job": {"inputs": {"runinterface|seqfiles_2|input": {"src": "hda", "id": "8155e4b4bf1581ff", "uuid": "0e1a53f5
@hepcat72
hepcat72 / splitseq_run.sh
Created January 8, 2020 22:17
Sample SPLiT-Seq command shell scripts for running split-seq at Princeton
#!/bin/bash
#USAGE: ./splitseq_run.sh run1 mrna.fq bcumi.fq v1 reference_directory "sample_name A1:B6" "sample2_name B7:C12" ...
all_args=("$@")
run_id=$1
mrna_fq=$2
bcumi_fq=$3
chemistry=$4 #v1 or v2
#!/bin/bash
#Run once for each sample to gather sequences from multiple sequencing runs that belong to that sample. Sample name must be exactly the same as in each sequencing run.
#USAGE: ./splitseq_combine.sh run1 v1 reference_directory "splitseq_all_out_directories" "sample_name A1:B6"
all_args=("$@")
run_id=$1
chemistry=$2 #v1 or v2
@hepcat72
hepcat72 / completion_notifier.scpt
Last active April 2, 2020 22:46
Applescript to post webhooks triggered by newly completed iOS reminders in specific list(s)
--Look for newly completed reminders (since the last check) and if there is a new one, make a webhook post with date, title, and list JSON values
--by Robert W. Leach, based on scripts by Craig Eley, Samantha Hilton, and Nick Morris
--This is not foolproof. If you have more than 1 device you use to "complete" reminders and a reminder is completed while offline, after which, a reminder is completed from a second online device, the completion of the reminders in the offline device (once it comes online) will be missed. However, it's done this way so that the script doesn't take forever looking at all reminders each time.
--Schedule it to run as frequently as you would like using osascript in a cron job and forget about it. Run once manually in order to "allow" this script to run in the security settings by responding to the resulting dialog.
--Cron job every 30 minutes looking for newly completed reminders in list "MyReminders" example (execute `crontab -e` in terminal and enter): */30 * * * * osascript /Us
--What is this?: This is a pair of scripts to provide a "Service" in any application in macOS that can wrap selected text to a specified line length (with an optional leader string (e.g. a comment character or indent)). Note, it does not remove existing hard-returns in the selected text.
--Installation: 1. Save the companion perl script (wrap.pl) on your computer. 2. Create an Automator service and paste this code into a "Run AppleScript" action. 3. Select (at the top of the workflow) "Workflow receives current text in any application". 4. Edit the `wrap_script` variable below to the location of the wrap.pl script. 5. Save. 6. Use the service (described below) and address any permissions issues that pop up. You may need to do this once for every app in which you run the service.
--How to use it: 1. Select entire lines of text you want to limit the line length of. 2. Right-click the selection and select this service. 3. Edit the line length, add a leader string if desired (e.g. a comment character such as