Skip to content

Instantly share code, notes, and snippets.

@pmrv
pmrv / excli.py
Created March 17, 2016 13:59
excel-like calculations on csv and related formats with numpy
#!/usr/bin/env python
from argparse import ArgumentParser, FileType
import numpy as np
parser = ArgumentParser()
parser.add_argument("formula",
help = "expression to evaluate for each row; "
"use '%%i' to refer to the ith input "
"column; numpy functions are available; "
#!/usr/bin/env node
const fs = require('fs');
// takes a node from the original data structure and copies only the needed
// attributes into new node
function make_node(node) {
return {
id: node.id,
name: node.title,
children: []
@pmrv
pmrv / mk_rofi-history-patch.sh
Last active July 30, 2017 17:15
Generates patch for https://github.com/DaveDavenport/rofi that changes the history size. Patch with `mk_rofi-history-patch.sh $YOUR_SIZE | patch -p1`.
#!/usr/bin/sh
cat << EOF
diff --git a/source/history.c b/source/history~.c
index 25cfcb0..dfefc12 100644
--- a/source/history.c
+++ b/source/history.c
@@ -37,7 +37,7 @@
#include "history.h"
#include "settings.h"
@pmrv
pmrv / proplist.ipynb
Last active May 15, 2020 09:18
Property lists for versatile input handling in pyiron.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@pmrv
pmrv / prun_localmarkets.py
Created May 24, 2022 19:32
Fetches all planets with a local market, indexed by system id.
import requests
import pandas as pd
from cachetools.func import ttl_cache
@ttl_cache(1000, 600)
def get_system_info(sysid):
return requests.get(
f'https://rest.fnar.net/systemstars/star/{sysid}'
).json()