Skip to content

Instantly share code, notes, and snippets.

Avatar

Robert Grzelka robgrzel

  • Sweden, Gotheborg
View GitHub Profile
@robgrzel
robgrzel / condaenv.txt
Created Nov 13, 2018 — forked from pratos/condaenv.txt
To package a conda environment (Requirement.txt and virtual environment)
View condaenv.txt
# For Windows users# Note: <> denotes changes to be made
#Create a conda environment
conda create --name <environment-name> python=<version:2.7/3.5>
#To create a requirements.txt file:
conda list #Gives you list of packages used for the environment
conda list -e > requirements.txt #Save all the info about packages to your folder
@robgrzel
robgrzel / main.cpp
Created Aug 1, 2018 — forked from docwhite/main.cpp
Thrust + CUDA kernel
View main.cpp
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <thrust/device_vector.h>
/*
* --- Using Thrust vectors in kernel functions ---
* This example demonstrates how we can use device vectors (vectors that live
* in GPU) as arguments to a kernel launched by the CPU.
View onehiddenlayerperceptron.cu
//
// onehiddenlayerperceptron.cu
// onehiddenlayerperceptron
//
// Created by Sergei Bugrov on 8/21/17.
// Copyright © 2017 Sergei Bugrov. All rights reserved.
//
#include <stdio.h>
@robgrzel
robgrzel / cudnn_convolution_forward.cu
Created Jul 23, 2018 — forked from odashi/cudnn_convolution_forward.cu
Example usage of cuDNN convolution forward functions.
View cudnn_convolution_forward.cu
#include <iomanip>
#include <iostream>
#include <cstdlib>
#include <vector>
#include <cuda.h>
#include <cudnn.h>
#define CUDA_CALL(f) { \
cudaError_t err = (f); \
@robgrzel
robgrzel / gist:d1e79721a898f721bcd279d107663c8b
Created Jul 22, 2018 — forked from AndrewScheidecker/gist:930f4a6e0966b8421806
A stupid C++ trick for defining structs with metadata (serializers, printers, etc) without redundant declarations of members
View gist:d1e79721a898f721bcd279d107663c8b
#include <iostream>
#include <vector>
#include <string>
using std::string;
/*
These macros define a struct with an implicitly defined Show function that visits each member.
The trick is that a typedef is split between each STRUCT_MEMBER instance and the preceding macro,
which allows it to define an empty struct type that identifies the following struct member, while also
knowing the struct type that the preceding macro is using to identify the current member.
@robgrzel
robgrzel / conv.cu
Created Jul 19, 2018 — forked from goldsborough/conv.cu
Convolution with cuDNN
View conv.cu
#include <cudnn.h>
#include <cassert>
#include <cstdlib>
#include <iostream>
#include <opencv2/opencv.hpp>
#define checkCUDNN(expression) \
{ \
cudnnStatus_t status = (expression); \
if (status != CUDNN_STATUS_SUCCESS) { \
@robgrzel
robgrzel / debian-install-zram.sh
Created Jul 7, 2018
Install zRAM on Debian(8)
View debian-install-zram.sh
#!/bin/bash
#
not_root() {
echo "ERROR: You have to be root to execute this script"
exit 1
}
zram_exists() {
echo "ERROR: /etc/init.d/zram already exists"
@robgrzel
robgrzel / The Technical Interview Cheat Sheet.md
Created Dec 18, 2017 — forked from TSiege/The Technical Interview Cheat Sheet.md
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.
View The Technical Interview Cheat Sheet.md

Studying for a Tech Interview Sucks, so Here's a Cheat Sheet to Help

This list is meant to be a both a quick guide and reference for further research into these topics. It's basically a summary of that comp sci course you never took or forgot about, so there's no way it can cover everything in depth. It also will be available as a gist on Github for everyone to edit and add to.

Data Structure Basics

###Array ####Definition:

  • Stores data elements based on an sequential, most commonly 0 based, index.
  • Based on tuples from set theory.
@robgrzel
robgrzel / External_GTest.cmake
Created Aug 1, 2017 — forked from ClintLiddick/External_GTest.cmake
CMake ExternalProject_Add for Google Mock (gmock) and Google Test (gtest) Libraries
View External_GTest.cmake
find_package(Threads REQUIRED)
ExternalProject_Add(
googletest
GIT_REPOSITORY https://github.com/google/googletest.git
UPDATE_COMMAND ""
INSTALL_COMMAND ""
LOG_DOWNLOAD ON
LOG_CONFIGURE ON
LOG_BUILD ON)