Skip to content

Instantly share code, notes, and snippets.

View colin-daniels's full-sized avatar

Colin Daniels colin-daniels

View GitHub Profile
@colin-daniels
colin-daniels / clang_ast_remove_functions.cpp
Created June 29, 2020 19:04
Remove free/member functions from C++ source code via clang AST manipulation, leaving only types/structs/etc behind, then print the modified source
#define _SILENCE_CXX17_ITERATOR_BASE_CLASS_DEPRECATION_WARNING
#include <clang/AST/AST.h>
#include <clang/AST/ASTConsumer.h>
#include <clang/AST/RecursiveASTVisitor.h>
#include <clang/Frontend/CompilerInstance.h>
#include <clang/Frontend/FrontendAction.h>
#include <clang/Tooling/Tooling.h>
#undef _SILENCE_CXX17_ITERATOR_BASE_CLASS_DEPRECATION_WARNING
#include <fstream>
@colin-daniels
colin-daniels / orcid_to_publications_markdown.sh
Created November 13, 2019 18:16
Fetch publications given an ORCID and turn them into a markdown-formatted publication list
#!/bin/bash
# dependencies: jq, grep, sed, tr, curl, and perl URI::Escape (or replace url_encode function)
set -e
orcid="0000-0002-3512-7146"
# name to match when bolding in author list, should be abbreviated as in
# "Given Names Last" -> "G. N. Last"
match_name="C. Daniels"
# whether to output as a numbered list instead of unordered (i.e. bullet points)
@colin-daniels
colin-daniels / PKGBUILD
Last active May 9, 2019 19:00
PKGBUILD for the DFTB+ library for use with dftbplus-sys (https://github.com/ExpHP/dftbplus-sys)
# Maintainer: Colin Daniels <colin.r.daniels@gmail.com>
pkgname=libdftb+-git
pkgver=18.2.r602.4d795c89
_pkgname=dftbplus
pkgver() {
cd "$srcdir/$_pkgname"
printf "%s" "$(git describe --long | sed 's/\([^-]*-\)g/r\1/;s/-/./g')"
}

Needs band.yaml and POSCAR in the current directory and takes no arguments (just run python plotsvg.py).
To change render settings, edit the python script itself (see main() and RenderSettings).

Requires the following python packages (use pip or similar to install):

  • lxml
  • numpy
  • scipy
  • pymatgen
  • spglib
@colin-daniels
colin-daniels / readme.md
Last active August 29, 2015 14:18
Instructions for installing bgclang on RPI's BG/Q system.
@colin-daniels
colin-daniels / config
Created April 3, 2015 08:17
Example config for install-bgq for CCI BG/Q at RPI
# Example config for CCI BG/Q, modify username and project name appropriately
CCI_USER=CMNDcldn
CCI_PROJ=CMND
# Local directory where the rpm files will be downloaded
RPMDIR=./rpms/$VERSION
# RPM database path on remote machine
RPMDBPATH=/gpfs/u/barn/$CCI_PROJ/shared/bgclang/rpm/$VERSION