Skip to content

Instantly share code, notes, and snippets.

View glennklockwood's full-sized avatar

Glenn K. Lockwood glennklockwood

View GitHub Profile
@glennklockwood
glennklockwood / analyzecoord.pl
Last active August 29, 2015 13:56
analyzecoord, Original Perl Implementation
#!/usr/bin/perl
@show = qw/ Siloxane SiO4 Si3O SiO3 SiO2 SiO1 NBO FreeOH H2O H3O SiOH SiOH2 Si2OH/;
printf("\n%-8.8s ", "ird");
foreach $specie ( @show )
{
printf("%8.8s ", $specie);
}
print "\n";
@glennklockwood
glennklockwood / analyzcoord.py
Last active August 29, 2015 13:56
analyzecoord, Original Python Implementation
#!/usr/bin/env python2
import fileinput
import re
show = [ "Siloxane", "SiO4", "Si3O", "SiO3", \
"SiO2", "SiO1", "NBO", "FreeOH", \
"H2O", "H3O", "SiOH", "SiOH2", "Si2OH" ]
def printargs( counts, isave ):
@glennklockwood
glennklockwood / analyzecoord-new.pl
Created February 3, 2014 21:20
analyzecoord, New Version by gnustavo
#!/usr/bin/env perl
use utf8;
use strict;
use warnings;
my @show = qw/Siloxane SiO4 Si3O SiO3 SiO2 SiO1 NBO FreeOH H2O H3O SiOH SiOH2 Si2OH/;
my %type;
@type{@show} = (0) x @show;
@glennklockwood
glennklockwood / analyzecoord-new.py
Created February 3, 2014 21:22
analyzecoord, New Version by Paul Davis
#!/usr/bin/env python2
import re
import sys
SHOW = """
Siloxane SiO4 Si3O SiO3
SiO2 SiO1 NBO FreeOH
H2O H3O SiOH SiOH2 Si2OH
@glennklockwood
glennklockwood / openmp-parallel-inner-loop.c
Created April 9, 2015 00:46
Parallelizing only the innermost loop with OpenMP
#include <stdio.h>
#include <time.h>
#include <omp.h>
int main ( void ) {
int i, j;
int me, n;
#pragma omp parallel private(i,j,me,n)
{
@glennklockwood
glennklockwood / defaultpath-solaris10.sh
Created July 23, 2015 01:56
Script for setting up PATH on Solaris 10
# Built user paths in two parts
# Most important paths get prefixed in order of (least important) -> (most)
for dir in ~/bin
do
check=`expr "$PATH" : ".*:${dir}:.*" + \
"$PATH" : "${dir}:.*" + \
"$PATH" : ".*${dir}$"`
if [ $check = 0 ]
then
@glennklockwood
glennklockwood / .bashrc
Created July 23, 2015 01:59
Sensible .bashrc on Solaris 10
### bashrc/bash_profile for SunOS 5.10
# Solaris 10 lacks support for xterm-color (although it is provided in OpenCSW)
if [ "$TERM" == "xterm-color" ]; then
export TERM=xterm
fi
alias ssh='ssh -X'
alias ls='ls -p'
alias md5='digest -a md5 -v'
@glennklockwood
glennklockwood / ior.in
Created February 17, 2016 23:43
IOR Input to test DataWarp DVS client-side counters
################################################################################
#
# Run the IOR benchmark with the POSIX I/O API and one file per task
#
################################################################################
IOR START
### You MUST change the following parameters (see README.APEX)
numTasks=32 # number of MPI processes to use. You may choose to use one or more MPI processes per node.
segmentCount=81920 # must be > fileSize / ( blockSize * numTasks ) where fileSize must be greater than 1.5 times the aggregate DRAM available for use by
@glennklockwood
glennklockwood / diff.sql
Last active April 18, 2021 00:46
Subtracting each row from the one before it in MySQL
SELECT
b.ts,
b.ost_name,
b.bytes_written - a.bytes_written,
b.bytes_read - a.bytes_read
FROM
(
SELECT
OST_DATA.TS_ID AS tsid,
TIMESTAMP_INFO.`TIMESTAMP` AS ts,
@glennklockwood
glennklockwood / drop_file_from_page_cache.c
Created July 22, 2016 03:28
Drop a file from page cache
#define _XOPEN_SOURCE 600
#include <unistd.h>
#include <fcntl.h>
int main(int argc, char *argv[]) {
int fd;
fd = open(argv[1], O_RDONLY);
fdatasync(fd);
posix_fadvise(fd, 0,0,POSIX_FADV_DONTNEED);
close(fd);
return 0;