Skip to content

Instantly share code, notes, and snippets.

@tsitsvero
tsitsvero / numpy_lru_cache.md
Created April 2, 2021 06:33 — forked from Susensio/numpy_lru_cache.md
Make function of numpy array cacheable

How to cache slow functions with numpy.array as function parameter on Python

TL;DR

from numpy_lru_cache_decorator import np_cache

@np_cache()
def function(array):
 ...
#include "Foo.hpp"
#include <iostream>
using namespace std;
Foo::Foo(int _a, int _b): a(_a), b(_b){
cout << "C++ side, constructor" << endl;
}
Foo::~Foo(){
# Terminal Cheat Sheet
pwd # print working directory
ls # list files in directory
cd # change directory
~ # home directory
.. # up one directory
- # previous working directory
help # get help
-h # get help
@tsitsvero
tsitsvero / torch_gpu_info.py
Created August 28, 2020 08:33
Information on available GPU by PyTorch
import torch
#Check availability of GPU:
print(f"Pytorch version: {torch.__version__}")
print(f"Current device: {torch.cuda.current_device()}")
print(f"Device count: {torch.cuda.device_count()}")
print(f"Device name: {torch.cuda.get_device_name(0)}")
print(f"Is CUDA available?: {torch.cuda.is_available()}")
# Set device on GPU if available, else CPU
@tsitsvero
tsitsvero / README.md
Last active August 11, 2020 16:21 — forked from Tynael/README.md
How to use npx to run gist based scripts
@tsitsvero
tsitsvero / remarkjs.css
Created August 1, 2020 16:52 — forked from floswald/remarkjs.css
CSS of the example slides on http://remarkjs.com
@import url(https://fonts.googleapis.com/css?family=Droid+Serif);
@import url(https://fonts.googleapis.com/css?family=Yanone+Kaffeesatz);
@import url(https://fonts.googleapis.com/css?family=Ubuntu+Mono:400,700,400italic);
body {
font-family: 'Droid Serif';
}
h1, h2, h3 {
font-family: 'Yanone Kaffeesatz';
font-weight: 400;
@tsitsvero
tsitsvero / Dockerfile
Created April 14, 2020 07:50 — forked from udkyo/Dockerfile
Basic container for X11 forwarding goodness
FROM ubuntu
RUN apt update \
&& apt install -y firefox \
openssh-server \
xauth \
&& mkdir /var/run/sshd \
&& mkdir /root/.ssh \
&& chmod 700 /root/.ssh \
&& ssh-keygen -A \
&& sed -i "s/^.*PasswordAuthentication.*$/PasswordAuthentication no/" /etc/ssh/sshd_config \
@tsitsvero
tsitsvero / C++.sublime-build
Created March 25, 2020 04:52 — forked from jdhao/C++.sublime-build
Sublime text 3 C++ build system to run C++ executable within sublime text or in a terminal emulator in cases that the program need input from standard input. This build system works on Linux, Windows and MacOS
{
"shell_cmd": "g++ -std=c++11 -Wall \"${file}\" -o \"${file_path}/${file_base_name}\" && \"${file_path}/${file_base_name}\"",
"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
"working_dir": "${file_path}",
"selector": "source.c++, source.cpp, source.cc, source.cxx",
"variants":
[
{
"name": "Run in Terminal",
@tsitsvero
tsitsvero / Install CUDA 10.1 on Ubuntu 18.04.md
Created March 11, 2020 05:15 — forked from eddex/Install CUDA 10.1 on Ubuntu 18.04.md
How to install CUDA 10.1 on Ubuntu 18.04

How to install CUDA 10.1 on Ubuntu 18.04

A clean installation of Ubuntu 18.04.02 LTS was used.

This gist is an extension to the official docs, adding missing parts and instructions.

2 pre-install actions

follow the pre-installation actions on:

@tsitsvero
tsitsvero / install virtualenv ubuntu 16.04.md
Created March 10, 2020 08:25 — forked from Geoyi/install virtualenv ubuntu 16.04.md
How to install virtual environment on ubuntu 16.04

How to install virtualenv:

Install pip first

sudo apt-get install python3-pip

Then install virtualenv using pip3

sudo pip3 install virtualenv