Skip to content

Instantly share code, notes, and snippets.

@valgur
valgur / get_exif_gps_info.py
Last active June 3, 2019 00:44 — forked from erans/get_lat_lon_exif_pil.py
Get GPS coordinates, direction, speed and timestamp from EXIF using PIL
import datetime as dt
from collections import OrderedDict
from glob import glob
from sys import argv
from PIL import Image
from PIL.ExifTags import TAGS, GPSTAGS
def get_exif_data(image):
@valgur
valgur / gdal_warp.py
Last active April 11, 2022 09:36
gdalwarp with GCPs via GDAL Python bindings
from pathlib import Path
from osgeo import gdal, osr
# Adapted from https://svn.osgeo.org/gdal/trunk/autotest/alg/warp.py
def warp_with_gcps(input_path, output_path, gcps, gcp_epsg=3301, output_epsg=3301):
# Open the source dataset and add GCPs to it
src_ds = gdal.OpenShared(str(input_path), gdal.GA_ReadOnly)
gcp_srs = osr.SpatialReference()
gcp_srs.ImportFromEPSG(gcp_epsg)
gcp_crs_wkt = gcp_srs.ExportToWkt()
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
#include <cmath>
#include <utility>
// Input: WGS84 longitude and latitude
// Output: x - easting, y - northing in L-EST97 (EPSG:3301)
// Source: http://www.maaamet.ee/rr/geo-lest/files/geo-lest_function_php.txt
std::pair<double, double> geo_lest(const double lon, const double lat) {
using namespace std;
constexpr double deg2rad = M_PI / 180.;
constexpr double a = 6378137.;
--- 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")
@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);
@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 / install_cuda.sh
Last active January 12, 2024 21:32
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 / 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.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@valgur
valgur / kitti_raw_data_downloader.sh
Last active January 14, 2024 19:30
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