Skip to content

Instantly share code, notes, and snippets.

View meg-codes's full-sized avatar

meg-codes

View GitHub Profile
@meg-codes
meg-codes / cdh-scrape.py
Last active January 26, 2019 09:22
A basic web-scrape script designed to look for bad links on a particular site
#!/usr/bin/env python
# Script to scrape all links from a site, compile counts of each link, status
# codes of access and output the results as a CSV
#
# There's absolutely no reason this shouldn't be pulled into an OOP paradigm
# per se, but I left it functionalized because that can be easier for multitasking.
#
# Requirements:
# requests, bs4

On the Adroit headnode

This requests an allocation on a compute node of Adroit for 15 minutes. Once granted you can see I'm moved to the compute node adroit-14. I also ask for two tasks (you can adjust based on whether you actually use the cores or not.)

[bhicks@adroit4 ~]$ salloc -N 1 --ntasks-per-node=2 -t 15:00
salloc: Granted job allocation 497989
[bhicks@adroit-14 ~]$ export XDG_RUNTIME_DIR=""
@meg-codes
meg-codes / RQuantLib-Brew.md
Last active March 12, 2018 15:13
Instructions for RQuantLib and Brew with OpenMP

Installing QuantLib

Follow the instructions here to install Quantlib.

Make especially sure that you use the --with-intraday flag for QuantLib.

Install an up-to-date clang with OpenMP support

The default MacOS clang++ for High Sierra does not include support for OpenMP, so you'll need to install a version that does and then set R to use it for compiling libraries.

#!/usr/bin/env python
"""
Python script to list all MySQL databases and allow them to be recreated.
This assumes you have server information and credentials stored in a ~/.my.cnf
file (ideally chmoded to 0600)
[client]
host=localhost
user=root
password=secretpasswordgoeshere
@meg-codes
meg-codes / fix_latlon.py
Created April 17, 2017 15:59
Code to take a spreadsheet with a varitey of lat/long formulas and make them decimal values, then write fixed CSV
# -*- coding: utf-8 -*-
import pandas as pd
import LatLon as latlon
import re
from LatLon import string2latlon
# Requires: pandas, LatLon, py2.7
def makefloatlat(data):