Skip to content

Instantly share code, notes, and snippets.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@valgur
valgur / elb_grids.py
Last active March 16, 2021 14:21
Estonian Land Board map sheet (grid) index formulas / Maa-ameti kaardilehtede järjekorranumbrite teisendusvalemid
# x - easting, y - northing
def grid20k(x, y):
x = int(x) // 1000 - 200
y = int(y) // 1000 - 5900
idx = (y // 100) * 1000 + (y // 10 % 10) * 10
idx += (x // 100) * 100 + (x // 10 % 10)
return idx
def grid10k(x, y):
@valgur
valgur / torch_add_hash.sh
Created May 23, 2020 16:45
Add a checksum string to a state file name for Torch Hub
#!/bin/bash
mv "$1" "${1%.*}"-$(sha256sum "$1" | cut -c1-8).pt
import numpy as np
import taichi as ti
from skimage.io import imread, imsave
ti.init(arch=ti.cuda)
@ti.kernel
def normals_from_depth_kernel(f: ti.f32, cx: ti.f32, cy: ti.f32, window_size: ti.u16, max_rel_depth_diff: ti.f32):
height, width = ti_depth.shape()
@valgur
valgur / kitti_raw_data_downloader.sh
Last active April 29, 2025 19:29
More user-friendly KITTI raw dataset download script - extract in background and replace noisy stdout with clear progress info
#!/bin/bash
files=(
2011_09_26_calib.zip
2011_09_26_drive_0001
2011_09_26_drive_0002
2011_09_26_drive_0005
2011_09_26_drive_0009
2011_09_26_drive_0011
2011_09_26_drive_0013
@valgur
valgur / raw2odom-report.ipynb
Last active April 16, 2020 07:30
Reverse-engineering of KITTI raw to odom dataset conversion for https://github.com/tomas789/kitti2bag/issues/11 discussion. WIP.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@valgur
valgur / install_cuda.sh
Last active May 10, 2024 07:01
Automatically install CUDA, cuDNN and appropriate drivers
#!/bin/bash
set -e -u -o pipefail -o noglob
set -x
CUDA_VERSION=${CUDA_VERSION:-10.2}
CUDNN_VERSION=${CUDNN_VERSION:-7}
TENSORRT_VERSION=${TENSORRT_VERSION:-7}
UBUNTU_RELEASE=$(lsb_release -rs) # 18.04
DISTRO=ubuntu${UBUNTU_RELEASE//\./} # ubuntu1804
@valgur
valgur / update-alternatives-clang.sh
Last active July 6, 2019 12:25 — forked from gburca/update-alternatives-clang.sh
Automatically find and 'update-alternatives --install' installed clang versions
#!/bin/bash
BIN=/usr/bin
MAN=/usr/share/man/man1
function register_clang_version {
BINV=$1
PRIORITY=`echo $BINV | awk '{print int($1 * 10)}'`
update-alternatives --install $BIN/clang clang $BIN/clang-$BINV $PRIORITY \
--slave $BIN/clang++ clang++ $BIN/clang++-$BINV
@valgur
valgur / get_cuda_gencode.cpp
Last active April 24, 2019 15:29
Generate CUDA -gencode parameters for available GPU devices. Usage: chmod +x get_cuda_gencode.cpp && ./get_cuda_gencode.cpp
//usr/bin/env nvcc --run "$0" -o /tmp/get_cuda_gencode; rm /tmp/get_cuda_gencode; exit
#include <cuda_runtime_api.h>
#include <iostream>
#include <set>
int main(int argc, char *argv[]) {
cudaDeviceProp prop;
cudaError_t status;
int device_count;
status = cudaGetDeviceCount(&device_count);
--- src/leakyrelu.cc (revision 830d5ef7a5b1f33de2aa95405787c03e4de77306)
+++ src/leakyrelu.cc (date 1554811334000)
@@ -22,7 +22,7 @@
using namespace tensorflow;
-REGISTER_OP("LeakyRelu")
+REGISTER_OP("LeakyReluLmb")
.Attr("T: {float, double}")
.Attr("leak: float = 0.1")