Skip to content

Instantly share code, notes, and snippets.

View raytroop's full-sized avatar
🎯
Focusing

raytroop

🎯
Focusing
View GitHub Profile
@raytroop
raytroop / MatMulTiled.cu
Created October 23, 2019 09:43
Matrix Multiplication in CUDA using Shared memory
#include <stdio.h>
#include <stdlib.h>
#include <cuda_runtime.h>
//http://www.techdarting.com/2014/03/matrix-multiplication-in-cuda-using.html
// This code assumes that your device support block size of 1024
#define MAX_RANGE 9999
@raytroop
raytroop / pycurses.py
Created October 16, 2019 13:22 — forked from claymcleod/pycurses.py
Python curses example
import sys,os
import curses
def draw_menu(stdscr):
k = 0
cursor_x = 0
cursor_y = 0
# Clear and refresh the screen for a blank canvas
stdscr.clear()
@raytroop
raytroop / sbtmkdirs
Created October 6, 2019 15:00
Create an SBT project directory structure with a few simple options.
#!/bin/bash
#------------------------------------------------------------------------------
# Name: sbtmkdirs
# Version: 1.5
# Purpose: Create an SBT project directory structure with a few simple options.
# Author: Alvin Alexander, http://alvinalexander.com
# License: Creative Commons Attribution-ShareAlike 2.5 Generic
# http://creativecommons.org/licenses/by-sa/2.5/
#------------------------------------------------------------------------------
@raytroop
raytroop / 00_conditonal_compilation
Last active September 29, 2019 06:40
Conditional compilation
this page intentionally left blank
@raytroop
raytroop / wi_g++.md
Created September 29, 2019 06:00
Conditional compilation
#include <iostream>

#define na 4

int main() {
  int a[na];

  a[0] = 2;
 for (int n = 1; n &lt; na; n++) a[n] = a[n-1] + 1;
@raytroop
raytroop / 0_click
Last active September 28, 2019 01:38
This page intentionally left blank
import click
@click.command(help='Get evaluation result.')
@click.argument('exp_dir')
@click.option('--force', '-f', is_flag=True, default=False, help='Overwrite previous evaluation result.')
@click.option('--iteration', '-i', type=str, required=True, multiple=True,
help='specified multiple iterations in one run by E.g, -i 10 -i 400')
@click.option('--fa', type=float, default=None, help='Set threshold by fa.')
@click.option('--threshold', type=float, default=None, help='Set threshold.')
# https://github.com/tqdm/tqdm/issues/484#issuecomment-352463240
import time
import random
from multiprocessing import Pool
from tqdm import tqdm
def myfunc(a):
time.sleep(random.random())
return a ** 2