Skip to content

Instantly share code, notes, and snippets.

Ashwin Nanjappa ashwin

Block or report user

Report or block ashwin

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
ashwin /
Created Feb 25, 2014
File Open dialog in Python to read in a file path
import Tkinter
import tkFileDialog
def main():
Tkinter.Tk().withdraw() # Close the root window
in_path = tkFileDialog.askopenfilename()
print in_path
if __name__ == "__main__":
ashwin / build-cuda.cmake
Last active Jun 17, 2019
Sample CMakeLists.txt file to build a CUDA program
View build-cuda.cmake
### CMakeLists.txt for CUDA
cmake_minimum_required(VERSION 2.8)
# Pass options to NVCC
-O3 -gencode arch=compute_22,code=sm_22
ashwin /
Created Feb 27, 2017
How to convert Python dict to class object with fields
>>> from collections import namedtuple
>>> d = {"name": "joe", "age": 20}
>>> d
{'age': 20, 'name': 'joe'}
>>> d_named = namedtuple("Employee", d.keys())(*d.values())
>>> d_named
Employee(name='joe', age=20)
ashwin / latex-letter.tex
Created Jan 2, 2013
Simple letter template for LaTeX
View latex-letter.tex
% Letter class
\documentclass[a4paper, 10pt]{letter}
% Name of sender
\name{Joe Fox}
% Signature of sender
\signature{Joe Fox}
ashwin / OpenTKExample.cs
Created Jun 7, 2013
An example C# program that uses OpenTK. Displays a colored triangle.
View OpenTKExample.cs
// C# example program to demonstrate OpenTK
// Steps:
// 1. Create an empty C# console application project in Visual Studio
// 2. Place OpenTK.dll in the directory of the C# source file
// 3. Add System.Drawing and OpenTK as References to the project
// 4. Paste this source code into the C# source file
// 5. Run. You should see a colored triangle. Press ESC to quit.
// Copyright (c) 2013 Ashwin Nanjappa
ashwin / DisableArrowKeys.vim
Created Feb 7, 2013
Disable arrow keys in Vim
View DisableArrowKeys.vim
nnoremap <up> <nop>
nnoremap <down> <nop>
nnoremap <left> <nop>
nnoremap <right> <nop>
inoremap <up> <nop>
inoremap <down> <nop>
inoremap <left> <nop>
inoremap <right> <nop>
ashwin / date_time.cpp
Created Jan 13, 2015
Get and print current date and time in C++
View date_time.cpp
// Example output from this code:
// Tue Jan 13 12:09:53 2015 (from ctime)
// 20150113_12_09_53 (from strftime)
// 20150113_12_09_53 (from put_time)
#include <ctime>
#include <chrono>
#include <iomanip>
// Get current time
ashwin / getopt_long_example.cpp
Last active Apr 3, 2019
How to parse options in C++ using getopt_long
View getopt_long_example.cpp
#include <getopt.h>
#include <iostream>
int num = -1;
bool is_beep = false;
float sigma = 2.034;
std::string write_file = "default_file.txt";
void PrintHelp()
ashwin / pocket_bookmarklet.js
Created Sep 17, 2017
Pocket bookmarklet code
View pocket_bookmarklet.js
ashwin / tao.cs
Created Jun 18, 2013
C# program that uses Tao framework to call OpenGL, GLU and FreeGLUT functions.
View tao.cs
// C# program that uses Tao framework to call
// OpenGL, GLU and FreeGLUT functions.
// Steps:
// 1. Install Tao framework. Its .Net assemblies will be added to GAC.
// 2. Create an empty C# console application project in Visual Studio
// 3. Add references to Tao.OpenGL.dll and Tao.FreeGLUT.dll to the project.
// These files are in C:\Program Files (x86)\TaoFramework\bin
// 4. Paste this source code into the C# source file
// 5. Copy FreeGLUT.dll from C:\Program Files (x86)\TaoFramework\lib to
You can’t perform that action at this time.