Skip to content

Instantly share code, notes, and snippets.

View teju85's full-sized avatar

Thejaswi. N. S teju85

View GitHub Profile
@teju85
teju85 / install_latest_ripgrep.sh
Created April 19, 2023 10:46
This script installs the latest release version of ripgrep
#!/bin/bash
DEB_URL=$(curl -s https://api.github.com/repos/BurntSushi/ripgrep/releases/latest | grep browser_download_url | grep deb | sed -e 's/.*": "//' -e 's/"//')
echo "Downloading latest ripgrep debian package: $DEB_URL"
curl -Lo ripgrep.deb $DEB_URL
sudo apt install -y ./ripgrep.deb
rm -f ripgrep.deb
#!/usr/bin/env python
import argparse
import subprocess
def runcmd(cmd):
out = "CMD:\n" + cmd
out += "OUTPUT:\n"
try:
@teju85
teju85 / github
Last active February 28, 2023 16:20
github GraphQL access
#!/usr/bin/env python
import requests
import json
import os
import sys
import argparse
ENTRYPOINT = "https://api.github.com/graphql"
@teju85
teju85 / covid-pooled-testing.cpp
Last active April 5, 2020 22:27
Simulate the number of tests needed if we decide to "pool" the samples
// Compilation and running:
// g++ -std=c++11 covid-pooled-testing.cpp && ./a.out
#include <cstdio>
#include <stdint.h>
#include <cmath>
#include <cstdlib>
#include <algorithm>
/**
@teju85
teju85 / compare_bench.py
Created February 25, 2020 08:26
Simple script to compare 2 json files from google C++ benchmark library
#!/usr/bin/env python
import sys
import json
def getTimeInSecs(run):
unit = run["time_unit"]
if unit == "us":
return run["real_time"] * 1000000
if unit == "ms":
return run["real_time"] * 1000
@teju85
teju85 / rapids-setup
Last active December 23, 2019 05:54
Wrapper script to setup RAPIDS development environment from scratch
#!/bin/bash
if [ -z $Root ]; then
Root=$HOME
fi
if [ -z $CudaVersion ]; then
CudaVersion=10.1
fi
CondaFile="Miniconda3-latest-Linux-x86_64.sh"
@teju85
teju85 / ipynb2cli.py
Last active January 11, 2022 08:47
A simple python script to convert .ipynb to cli output. Thereby enabling us to view the contents (text-only!) of a jupyter notebook from command-line.
#!/usr/bin/env python
import json
import sys
Width = 80
HeaderDemarc = "%s" % ("*" * Width)
CellDemarc = "%s" % ("-" * (Width // 2))
CellDemarc2 = CellDemarc * 2
OutputDemarc = "%s" % ("." * Width)
@teju85
teju85 / cuda-runtime-api-perf.cu
Last active November 20, 2019 06:22
Measure runtimes of commonly used cuda runtime APIs
// Compiling and running this program:
// nvcc -std=c++11 cuda-runtime-api-perf.cu && ./a.out
#include <chrono>
#include <stdio.h>
#include <stdlib.h>
using namespace std;
#define __CUDA(call) \
do { \
cudaError_t status = call; \
@teju85
teju85 / sudoku-3x3.cpp
Created August 23, 2019 16:28
Solve sudoku 3x3 boards using only elimination techniques
//
// Compilation: g++ -std=c++11 -o a.exe sudoku-3x3.cpp
// Run: ./a.exe "7 1 8 19 5 812 5 372 7 4 652 3 938 5 14 2 5 7"
// In order to solve the following board:
//
// 7 0 1 0 0 0 0 0 8
// 0 0 0 1 9 0 0 0 5
// 0 0 0 0 0 8 1 2 0
//
// 0 0 0 0 5 0 3 7 2
@teju85
teju85 / device-prop-test.cu
Last active September 16, 2020 18:34
Sample example to compare perf of cudaGetDeviceProperties and cudaDeviceGetAttribute
// Compiling and running this program:
// nvcc -std=c++11 device-prop-test.cu && ./a.out
#include <chrono>
#include <iostream>
using namespace std;
#define CUDA_CHECK(call) \
do { \
cudaError_t status = call; \
if(status != cudaSuccess) { \