Skip to content

Instantly share code, notes, and snippets.

import argparse
def my_func(arg1, arg2, arg3=None):
print(arg1, type(arg1))
print(arg2, type(arg2))
print(arg3, type(arg3))
if arg3:
print("The boolean value of arg3 is <True>")
@pmav99
pmav99 / geo_interface.rst
Last active March 8, 2019 00:32 — forked from sgillies/geo_interface.rst
A Python Protocol for Geospatial Data

Author: Sean Gillies Version: 1.0

Abstract

This document describes a GeoJSON-like protocol for geo-spatial (GIS) vector data.

Introduction

@pmav99
pmav99 / pytest_collect_only.txt
Created March 12, 2019 16:53
pytest grass collect only
pytest --collect-only
=============================================================================================== test session starts ===============================================================================================
platform linux -- Python 3.7.2, pytest-4.3.0, py-1.8.0, pluggy-0.9.0
rootdir: /home/feanor/Prog/svn/grass, inifile:
collected 1429 items
<Module db/db.columns/testsuite/test_dbcolumns.py>
<UnitTestCase TestDbColumns>
<TestCaseFunction test_dbcols>
<Function test>
<Module db/db.copy/testsuite/test_dbcopy.py>
@pmav99
pmav99 / shell_script_tests.sh
Created March 29, 2019 11:55
GRASS GIS tests written as shell scripts
# https://github.com/sjl/friendly-find
$ ffind 'test.*sh\b'
./raster/r.timestamp/test_suite/test.r.timestamp.sh
./raster/r.series/test_suite/test.r.series.sh
./raster/r.to.rast3elev/test.r.to.rast3elev.sh
./raster/r.in.lidar/testsuite/test_base_resolution.sh
./raster/r.in.lidar/test/sample_test.sh
./raster/r.to.rast3/test_suite/test.r.to.rast3.sh
./raster/r.drain/tests/test.r.drain.sh
@pmav99
pmav99 / timer.py
Created April 3, 2019 11:01
Python timer
#! /usr/bin/env python
# -*- coding: utf-8 -*-
"""
Just some classes that help benchmark execution speed.
Timer : A context manager
AutoTimer: A self-adjusting timer. It replicates the behavior of the timeit module.
"""
@pmav99
pmav99 / qgis_processing_api_example.py
Last active June 19, 2019 10:49
QGIS 3 + Processing + Python API example
import os
import pathlib
import sys
import typing
# The exact values of these paths depend on your QGIS installation
QGIS_ROOT = pathlib.Path("/opt/qgis-git")
QGIS_PATH = QGIS_ROOT / "share/qgis/python"
QGIS_PLUGIN_PATH = QGIS_PATH / "plugins"
@pmav99
pmav99 / test_single_gpu.py
Created August 8, 2019 13:28 — forked from j-min/test_single_gpu.py
TensorFlow single GPU example
from __future__ import print_function
'''
Basic Multi GPU computation example using TensorFlow library.
Author: Aymeric Damien
Project: https://github.com/aymericdamien/TensorFlow-Examples/
'''
'''
This tutorial requires your machine to have 1 GPU
"/cpu:0": The CPU of your machine.
@pmav99
pmav99 / verify_password.py
Created October 21, 2019 09:36
Verify jupyter / ipython password hashlib
import hashlib
import sys
if len(sys.argv) != 3:
sys.exit("Usage: python3 verify.py hash passphrase")
provided_hash = sys.argv[1]
passphrase = sys.argv[2]
salt = provided_hash.split(":")[1]
@pmav99
pmav99 / test_tf.py
Last active October 22, 2019 13:33
Simple tensorflow test
#!/usr/bin/env python3
import datetime
import numpy as np
import tensorflow as tf
# Processing Units logs
log_device_placement = True