Skip to content

Instantly share code, notes, and snippets.

View vmiheer's full-sized avatar

miheer vaidya vmiheer

View GitHub Profile
function LoadLib(urls) {
var url;
for (url of urls) {
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = url
document.head.appendChild(script)
}
}
# fix clang compilation database in the cases where one compiler uses another host compiler
# e.g. nvcc/icc using gcc headers
from subprocess import Popen, PIPE
from typing import List
import re, json
startRe = re.compile(r"#include [\"<][.]{3}[\">] search starts here:")
endRe = re.compile(r"^End of search list.$")
def getDefaultIncludes():
p1 = Popen(["echo", ""], stdout=PIPE)
@vmiheer
vmiheer / GetBeBOP.cmake
Created August 28, 2020 22:07
Cmake for BeBOP Sparse Matrix Converter
include(${CMAKE_ROOT}/Modules/ExternalProject.cmake)
ExternalProject_Add(bebop_make
URL http://bebop.cs.berkeley.edu/smc/tarballs/bebop_make.tar.gz
SOURCE_DIR bebop/bebop_make
CONFIGURE_COMMAND cmake -E cmake_echo_color --red --bold "Don't skip configuration step if on non-linux platform see ${CMAKE_CURRENT_BINARY_DIR}/bebop/bebop_make/README!"
BUILD_COMMAND cmake -E echo "Skipping build step."
INSTALL_COMMAND cmake -E echo "Skipping install step."
)
ExternalProject_Get_property(bebop_make SOURCE_DIR)
@vmiheer
vmiheer / hey_notmuch!
Created June 24, 2020 21:02 — forked from vedang/hey_notmuch!
Notmuch configuration for Hey.com Style workflows.
- Specific Notmuch filters (and saved-searches) for:
+ The Feed (newsletters, blogs)
+ The Paper trail (receipts, ledger)
+ Screened Inbox (mail from folks you actually want to read)
+ Previously Seen (important mail that you've already read)
+ Unscreened Inbox (potential spam / stuff you don't want)
- Elisp Functions to move / categorize emails from a particular sender.
+ Adds tags needed by filters defined above to all email sent by a particular sender
+ Creates an entry in a DB file, which is used by the Notmuch post-new script when indexing new email, to auto-add the relevant tags.
I've tested it on Fedora 23 and Ubuntu 16.04. I'm using gcc-5.3.1, python-3.4, VS Code-1.14.0
You can debug mixed Python/C++ in the same GUI. It also works for MPI applications. You can switch between the debuggers and corresponding call stacks.
1. Packages needed
1) Visual Studio Code
2) Extensions for VS Code:
"Python" from Don Jayamanne (I'm using 0.6.7)
This allows VS Code act as the front end to debug python.
This gives VS Code ability to attach to a python script that uses module "ptvsd".
@vmiheer
vmiheer / EmacsConfig.md
Created May 16, 2019 17:57
emacs configurations

install ycmd

installing rtags

CC=gcc CXX=g++ cmake --debug-trycompile -DCMAKE_EXPORT_COMPILE_COMMANDS=1 \
  -DLIBCLANG_CXXFLAGS="-I~/.emacs.d/ycmd/cpp/llvm/include \
  -Wl,-rpath,~/.emacs.d/ycmd/clang_archives/lib/libclang.so" \
  -DLIBCLANG_LIBDIR="~/.emacs.d/ycmd/clang_archives/lib" .
@vmiheer
vmiheer / pinOutputToCsv.py
Created March 25, 2019 21:55
Convert pin output to csv
"""
Pin output to csv
"""
import sys
import re
import argparse
startOfDynamicSection = False
outFile = open(sys.argv[2], 'w')
for line in open(sys.argv[1]):
@vmiheer
vmiheer / FindSpillOffsets.py
Last active March 15, 2019 21:25
Find set of spill locations from icc assembly output
# License: GPL
# Copyright: Miheer Vaidya (vaidya.56@osu.edu)
import sys
import re
def getSpillOffsets(f) -> set:
"""
Given file `f' returns set of offsets of spill locations
"""
pattern = re.compile(r".* (-?\d+\(%rsp\)).*")
@vmiheer
vmiheer / SpotifyFG.ps1
Created November 4, 2018 17:20
Get spotify to foreground
# https://blogs.technet.microsoft.com/heyscriptingguy/2007/02/03/hey-scripting-guy-how-can-i-use-windows-powershell-to-get-a-list-of-all-the-open-windows-on-a-computer/
# https://stackoverflow.com/questions/4993926/maximize-window-and-bring-it-in-front-with-powershell
# Needs Powershell community extentions
Set-ForegroundWindow (get-process Spotify | Where-Object {$_.MainWindowTitle -ne ""}).MainWindowHandle
@vmiheer
vmiheer / cuda_check.py
Created September 21, 2018 19:37 — forked from f0k/cuda_check.py
Simple python script to obtain CUDA device information
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Outputs some information on CUDA-enabled devices on your computer,
including current memory usage.
It's a port of https://gist.github.com/f0k/0d6431e3faa60bffc788f8b4daa029b1
from C to Python with ctypes, so it can run without compiling anything. Note
that this is a direct translation with no attempt to make the code Pythonic.