Skip to content

Instantly share code, notes, and snippets.

@parsa
parsa / do.sh
Last active October 30, 2016 20:42
#!/usr/bin/env bash
# Parameters {{{ #
script_name="${0##*/}"
REPO_URL="https://github.com/STEllAR-GROUP/hpx.git"
BOOST_INST="/opt/boost/1.60.0-debug"
CONFIG="Debug" # Debug Release MinSizeRel RelWithDebInfo
#!/bin/bash
#SBATCH -p marvin
#SBATCH -N 8
#SBATCH -n 16
#SBATCH -J prsmg002
#SBATCH -o prsmg002.o
#--hpx:threads 32 \
#./build/bin/mini_ghost \
mpirun \
@parsa
parsa / pfx_data_parser.py
Last active August 29, 2015 14:11
HPX Output Performance Counter Analyzer
#!/usr/bin/python
import re
import numpy
from os import path
from itertools import groupby
def parse_hpx_output(inputfile):
matching_pattern = re.compile('/([a-z_]+){locality#(\d+)/total}/(?:(?:(count|time)/)([a-z/_-]+)|([a-z/_-]+)/(?:(count|time))),([0-9]+),([0-9.]+),\[[a-z]+\],([0-9.\+e]+)(?:,\[([a-z]+)?\])?')
@parsa
parsa / gist:944ad48c1f2ac0cd2191
Created April 12, 2015 02:59
SuperMIC Pod Configuration
$ showstate
cluster state summary for Sat Apr 11 21:58:02
JobID S User Group Procs Remaining StartTime
------------------ - --------- -------- ----- ----------- -------------------
(A) 19549 R dmarce1 hpcusers 20 5:31:38 Sat Apr 11 15:29:40
(B) 19674 R ftsai hpcusers 60 5:00:34 Sat Apr 11 20:58:36
(C) 19675 R ftsai hpcusers 60 5:00:34 Sat Apr 11 20:58:36
@parsa
parsa / README.md
Last active July 6, 2017 21:52
Running a command in Bash with a set timeout

Running a command in Bash with a set timeout

Option A: timeout3.sh

Synopsis

$scriptName [-t timeout] [-i interval] [-d delay] command

Execute a command with a time-out. Upon time-out expiration SIGTERM (15) is sent to the process. If SIGTERM signal is blocked, then the subsequent SIGKILL (9) terminates it. -t timeout Number of seconds to wait for command completion.

@parsa
parsa / README.md
Last active July 6, 2017 21:52
Building HPX on SuperMIC

Building HPX on SuperMIC

Why this script exists?

I couldn't build HPX on SuperMIC and was getting errors. @sithhell wasn't convinced so I wrote this script for him to be able to reproduce my problem.

Explanation:

SuperMIC's Boost module being loaded was the issue. It was adding itself to CPATH and that was forcing g++ to use the headers of the module in place of our Boost.

Solution:

Not using Boost modules or any solution that adds Boost to CPATH and confuses the compiler

@parsa
parsa / 0_reuse_code.js
Created November 4, 2016 17:28
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@parsa
parsa / README.rst
Created December 21, 2016 00:37 — forked from tonyseek/README.rst
Build Python binding of C++ library with cffi (PyPy/Py3K compatible)

Run with Python:

pip-2.7 install cffi
PYTHON=python2.7 sh go.sh

Run with PyPy:

pip-pypy install cffi
PYTHON=pypy sh go.sh
@parsa
parsa / web-servers.md
Created December 27, 2016 16:33 — forked from willurd/web-servers.md
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@parsa
parsa / 0_urllib2.py
Last active January 25, 2017 19:41 — forked from kennethreitz/0_urllib2.py
urllib2 vs requests
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import urllib2
from base64 import b64encode
request = urllib2.Request('https://api.github.com/user')
request.add_header('Authorization', 'Basic ' + b64encode('user' + ':' + 'pass'))
r = urllib2.urlopen(request)