Skip to content

Instantly share code, notes, and snippets.

David Chin prehensilecode

Block or report user

Report or block prehensilecode

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@prehensilecode
prehensilecode / ge2openmpi.sh
Last active Oct 23, 2019
Convert Grid Engine PE_HOSTFILE to Open MPI hostfile
View ge2openmpi.sh
#!/bin/bash
awk '{print $1, "slots=" $2, "maxslots=" $2}' ${PE_HOSTFILE} > myhostfile.${JOB_ID}
@prehensilecode
prehensilecode / pdreadcsv.py
Created May 15, 2018
Test pandas.read_csv() with an argparse.FileType() object
View pdreadcsv.py
#!/usr/bin/env python3
import sys, os
import csv
import pandas as pd
import argparse
def read_csv(csvfile):
print('read_csv(): type(csvfile)) = {}'.format(csvfile))
print('')
@prehensilecode
prehensilecode / foo.csv
Created May 15, 2018
Sample CSV to test pandas.read_csv()
View foo.csv
A B C D E
1 2 3 4 5
6 7 8 9 10
11 12 13 14 15
16 17 18 19 20
@prehensilecode
prehensilecode / spark_sbin_slaves.diff
Created Oct 4, 2017
Diff to integrate Apache Spark standalone with Univa Grid Engine (other environment stuff needed)
View spark_sbin_slaves.diff
--- ./slaves.sh 2017-10-04 14:40:05.607320037 -0400
+++ /mnt/HA/opt/apache/spark/2.2.0/sbin/slaves.sh 2017-10-04 14:24:55.986020350 -0400
@@ -80,20 +80,29 @@
fi
fi
-
-
# By default disable strict host key checking
if [ "$SPARK_SSH_OPTS" = "" ]; then
@prehensilecode
prehensilecode / vboxmanage_cheat_sheet.txt
Last active Oct 18, 2019
VirtualBox commandline cheat sheet
View vboxmanage_cheat_sheet.txt
# start a guest in headless mode
vboxmanage startvm guestvmname --type headless
# add a nic (number 2) to guest, setting it to be on the host-only network, and make it a virtio device
vboxmanage modifyvm guestvmname --nic2 hostonly --nictype2 virtio --hostonlyadapter2 vboxnet0
# remove nic number 2
vboxmanage modifyvm guestvmname --nic2 none
# turn on host i/o cache - needed for the virtual disk on ext4 on older kernels
@prehensilecode
prehensilecode / get_module_version.py
Last active Sep 12, 2017
Query a module version programmatically using pip
View get_module_version.py
import pip
# get installed modules (aka "distributions")
for m in pip.get_installed_distributions():
print(m.version)
View keybase.md

Keybase proof

I hereby claim:

  • I am prehensilecode on github.
  • I am prehensilecode (https://keybase.io/prehensilecode) on keybase.
  • I have a public key ASA97l831aYgYr301QTZYegfhmwZcAQl0ce9eidljz2R7go

To claim this, I am signing this object:

@prehensilecode
prehensilecode / omp_glom.c
Created Mar 30, 2017
Dumb program to just allocate some memory in each thread using OpenMP
View omp_glom.c
#include <omp.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <math.h>
#define K 1024l
#define MEG 1048576l
#define GIG 1073741824l
View foocomplex.c
#include <stdio.h>
#include <complex.h>
int main(void)
{
float complex c = 3.0 + 4.0 * I;
long d;
d = c;
printf ("%f %+fi\n", creal(c), cimag(c));
View pytables_2.4.0_setup.diff
--- setup.py.orig 2012-07-20 16:03:50.000000000 -0400
+++ setup.py 2017-02-22 10:56:13.558487862 -0500
@@ -49,6 +49,14 @@
if not (sys.version_info[0] >= 2 and sys.version_info[1] >= 4):
exit_with_error("You need Python 2.4 or greater to install PyTables!")
+# Version comparison
+# cribbed from: https://zxq9.com/archives/797
+def ver_tuple(z):
+ return tuple([int(x) for x in z.split('.') if x.isdigit()])
You can’t perform that action at this time.