Skip to content

Instantly share code, notes, and snippets.

View naupaka's full-sized avatar

Naupaka Zimmerman naupaka

View GitHub Profile
@giannisp
giannisp / gist:ebaca117ac9e44231421f04e7796d5ca
Last active July 14, 2024 18:27
Upgrade PostgreSQL 9.6.5 to 10.0 using Homebrew (macOS)
After automatically updating Postgres to 10.0 via Homebrew, the pg_ctl start command didn't work.
The error was "The data directory was initialized by PostgreSQL version 9.6, which is not compatible with this version 10.0."
Database files have to be updated before starting the server, here are the steps that had to be followed:
# need to have both 9.6.x and latest 10.0 installed, and keep 10.0 as default
brew unlink postgresql
brew install [email protected]
brew unlink [email protected]
brew link postgresql
@maxandersen
maxandersen / trigger-list.org
Last active December 3, 2024 17:17
I like the idea of trigger list to empty my head for TODO's so I went and created a .org version of David Allens GTD trigger list. Note: it looks much better when used from within .org mode.
@iandol
iandol / BEtoOPML.scpt
Last active May 13, 2019 14:42
Bookends to OPML Exporter — Applescript by Dave83 with some further tweaks; see https://www.sonnysoftware.com/phpBB3/viewtopic.php?f=6&t=3882
#!/usr/bin/osascript
--Script to Export Bookends Notes to OPML file v1.18
--Written by Dave Glogowski (modified by iandol)
--07 August 2017
--
--This script converts Bookends references and associated notes into an OPML structured file which can then be imported into Scrivener's research folder.
--Each reference is a top level card which contains the Title, Author, Date, Type, Publisher, Abstract, and Bookends citation key
--If there are notes associated with a reference, each note creates its own subordinate note card with the Page number (if any), note header, quotes,
--comments, and keywords (tags). This allows you to individually review each comment and change its status (label) within Scrivener.
--
@benmarwick
benmarwick / load_pkgs.R
Last active December 7, 2018 16:05
Providing CRAN packages in low- or no-bandwidth environments using miniCRAN as described in https://software-carpentry.org/blog/2015/03/teaching-in-yangon.html
## For the user with a new installation of R.
# They get a USB stick with a directory containing an .RProj file,
# the workshop files, and the local_CRAN directory. They open
# the .RProj, which sets the working directory for RStudio, and then
# they open this file and run it, which installs pkgs from
# the local_CRAN directory on the USB stick.
# Specify list of packages to install
pkgs <- c('ggplot2', 'rmarkdown', 'knitr')
@johnmackintosh
johnmackintosh / HeatmapHrByDay.R
Last active October 23, 2024 17:32
How I made the hourly~daily~monthly~yearly heatmap : https://www.r-graph-gallery.com/283-the-hourly-heatmap.html
# https://www.r-graph-gallery.com/283-the-hourly-heatmap.html
library(ggplot2)
library(dplyr) # easier data wrangling
library(viridis) # colour blind friendly palette, works in B&W also
library(Interpol.T) # will generate a large dataset on initial load
library(lubridate) # for easy date manipulation
library(ggExtra) # because remembering ggplot theme options is beyond me
library(tidyr)
@bearloga
bearloga / upgrade_packages.R
Last active October 8, 2020 12:46
The script can be used to re-install packages after upgrading R (on Linux or Mac), since libraries cannot be reused between different minor versions (e.g. when upgrading 3.2.3 to 3.3.2). It detects when a package was installed from CRAN vs GitHub/Git and re-installs it using the appropriate func. Usage: `Rscript upgrade_packages.R`
# WMF only:
if (file.exists("/etc/wikimedia-cluster")) {
message('Detected that this script is being run on a WMF machine ("', Sys.info()["nodename"], '"). Setting proxies...')
Sys.setenv("http_proxy" = "http://webproxy.eqiad.wmnet:8080")
Sys.setenv("https_proxy" = "http://webproxy.eqiad.wmnet:8080")
}
# General use:
message("Checking for a personal library...")
if (!dir.exists(Sys.getenv("R_LIBS_USER"))) {
@benmarwick
benmarwick / GCMSAgilentDfileImport
Last active October 4, 2024 00:54
Function to import Agilent GCMS Chemstation D files in R
##' Function readDFile
##'
##' Function readDFile
##' @param pathname the pathname of the directory containing the data to import
##' @return outData Output is a matrix of ion counts with rows as scantime and
##' columns as mass, and the respective values as labels
##' @export
readDFile<-function(pathname){
filename<-file.path(pathname,'DATA.MS')
@sujaikumar
sujaikumar / 2015-11-30-blastp-bug.md
Last active November 2, 2023 04:46
NCBI blastp bug - changing max_target_seqs returns incorrect top hits

NCBI blastp seems to have a bug where it reports different top hits when -max_target_seqs is changed. This is a serious problem because the first 20 hits (for example) should be the same whether -max_target_seqs 100 or -max_target_seqs 500 is used.

The bug is reproducible on the command line when searching NCBI's nr blast database (dated 25-Nov-2015) using NCBI 2.2.28+, 2.2.30+ and 2.2.31+.

At first I thought it was something to do with my local exe/blastdb, but the same problem is also apparent on the NCBI blastp web interface (as of 30-Nov-2015)

@gregcaporaso
gregcaporaso / notes.md
Last active June 23, 2022 15:57
vsearch-based sequence dereplication through generation of a biom table

This depends on biom version >= 2.1.5, < 2.2.0 and vsearch >= 1.7.0.

Please note that all of this is highly experimental. I'm keeping these notes as I work with this approach. For published work, I still recommend using standard pipelines, such as those in QIIME 1.9.1.

$ biom --version
biom, version 2.1.5

$ vsearch --version
vsearch v1.7.0_osx_x86_64, 16.0GB RAM, 8 cores
@jrblevin
jrblevin / omnifocus-capture.el
Last active October 15, 2021 23:31
Sending Tasks to OmniFocus from Emacs <http://jblevins.org/log/emacs-omnifocus>
;; Based on omnifocus-capture.el by Ken Case with the following original comment:
;;
;; To capture tasks from Emacs to OmniFocus using Control-C Control-O,
;; drop this script in your emacs load path and add lines like these to
;; your .emacs:
;;
;; (autoload 'send-region-to-omnifocus "omnifocus-capture" "Send region to OmniFocus" t)
;; (global-set-key (kbd "C-c C-o") 'send-region-to-omnifocus)
;;
;; The send-region-to-emacs function has been rewritten as follows: