Skip to content

Instantly share code, notes, and snippets.

View dsavransky's full-sized avatar

Dmitry Savransky dsavransky

View GitHub Profile
@dsavransky
dsavransky / compiling_mice_mexmaca6.md
Created February 22, 2024 13:13
Compiling NAIF MICE (MATLAB Toolkit for SPICE) on Apple Silicon Mac

The pre-built mex binary that ships with MICE (https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/MATLAB/req/mice.html#Builds) is for Intel macs. In order to use mice on an Apple Silicon mac with a native install of MATLAB (R2023b+) you need to recompile the toolkit. Fortunately, this is fairly straightforward. Prerequisite for this is having MATLAB (R2023b+ Apple Silicon) and Xcode command line tools installed (see here for some install notes on the latter: https://forums.developer.apple.com/forums/thread/677124). To verify that you have the command line tools working, run which cc in a terminal. It should return /usr/bin/cc.

  1. Download and uncompress the code archive as usual from https://naif.jpl.nasa.gov/naif/toolkit_MATLAB_MacIntel_OSX_AppleC_MATLAB9.x_64bit.html You can either manually uncompress the archive (run tar xvzf mice.tar.Z in your Downloads directory, or use the provided importMice.csh script, which does literally the same thing).
  2. In a terminal, navigate to the top-level directo
@dsavransky
dsavransky / Compiling Python OpenBLAS and Numpy.md
Created October 18, 2023 19:18
Compiling Python OpenBLAS and Numpy

Compiling Python/OpenBLAS/Numpy

This is a brief set of notes on compiling Python, OpenBLAS and Numpy. The examples here were carried out on a clean install of Ubuntu (22.04.3) but the same basic thing can be done on any POSIX system as well as macOS (although the latter has some caveats to it).

1. Installing Dependencies

The following dependencies are required (note that all code blocks in these notes refer to commands executed from a standard terminal, unless otherwise noted):

sudo apt update
sudo apt install pkg-config  build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev wget git
sudo apt install libsqlite3-dev libbz2-dev uuid-dev lzma-dev libgdm-dev gfortran meson

A bit of NASA ADS (https://ui.adsabs.harvard.edu/) functionality that I absolutely love is the ability to dump citations in a custom format (in addition to standard formats including bibtex). This can be hugely useful when you need to quickly generate a reference and aren't working in something that supports automated reference management. The custom format is well documented (https://ui.adsabs.harvard.edu/help/actions/export) and the only drawback to using the web interface is that it does not remember your previously input formats (so there's a lot of copying/pasting each time you want to do this). However, we can take advantage of the ADS API to make a small utility to eliminate a lot of extra steps.

Preliminary Setup

To start, you need to grab your ADS API key and add it to your system kerying. See the first paragraph of: https://gist.github.com/dsavransky/56d7ab805047cfdf10ad962a50309238#nasaads

Utility

Here's a minimal worked example that queries a paper by title ma

Using CIT-Unsupported Email Clients to Send/Receive Cornell Emails

The enabling of mandatory two-factor authentication for the Cornell exchange server has broken the email workflow for anyone who uses a personal gmail box (or any unsupportd third-party email client) for sending/recieving their Cornell emails. There is a pretty straight-forward workaround, which maintains security, and should work until the next time CIT breaks something.

These instructions are focused on personal gmail accounts, but can be adapted for any third party client without builtin 2FA support for exchange servers.

Prep Work

Scraping Publication Data

For my CV, I like to include a table of citation metrics from multiple sources (currently Google Scholar, ADS and Web of Science). Updating these manually, however, is torturous, and feels like something that should be trivially automatable. So let's do it.

Google Scholar

Turns out, a complete solution for this already exists and is called scholarly: https://scholarly.readthedocs.io/

from scholarly import scholarly
@dsavransky
dsavransky / qualtrics_voting.md
Created March 24, 2021 14:50
Setting Up Voting in Qualtrics

Setting up Voting via Qualtircs

Create Contacts List

You only need to do this once, but will need to update the list as voting membership changes.

  • In Qualtrics, in the top menu, click on 'Contacts'
  • Click '+ Create Contact List'
  • Enter a list name and choose a folder (Uncategorized by default) and click 'Next'
  • You will see an 'Add Contacts' box with multiple tabs, including 'Import From a File' and 'Add Manually'. You can choose to add contacts manually, but for longer lists, importing is much easier. Click on 'Example Document'
@dsavransky
dsavransky / submodule_notes.md
Last active May 28, 2022 02:04
Git Submodules for Project Management

Project Management via Git Submodules

Here's the basic use case: I have a collection of qualitatively similar directories (actually multiple such collections - courses I teach, presentations I give, proposal I lead or contribute to, etc.). I also work across multiple different computers, with varying amounts of storage, some of which are always internet attached and some of which aren't. Finally, I employ multiple different git remotes (mostly github public and private repos, as well as my own servers).

For each individual project (proposal/presentation/class) I have components that I want to be strictly private for my own use only, components that I might want to share with a few others (collaborators/TAs/Reviewers) and components that I want to be publicly accessible by anyone. One concrete example: for most of my courses, I have a git repo hosted on one of my servers containing all of the lecture materials. I have another (private) github repo containing all of that course's homeworks and solutions