Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / 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 / 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

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 / popen.md
Created January 29, 2019 23:27 — forked from achillesrasquinha/popen.md
A Python Popen that does not suck.

A Python Popen that does not suck.

Function

import os
import subprocess

def popen(*args, **kwargs):
    output      = kwargs.get('output', False)
    directory   = kwargs.get('dir')
@pmav99
pmav99 / python27.py
Last active November 19, 2018 13:41
Get the first unique character of a string. Python - single traversal solution
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from collections import OrderedDict
def find_index_of_first_unique_char(string):
seen_once = OrderedDict() # LinkedHashMap
seen_many = set() # HashSet
for index, char in enumerate(string): # O(N)
@pmav99
pmav99 / split_keyboards.md
Created November 3, 2018 11:38 — forked from itod/split_keyboards.md
Every "split" mechanical keyboard currently being sold that I know of
@pmav99
pmav99 / Scala.For.The.Impatient.md
Created October 19, 2018 10:03 — forked from hhimanshu/ Scala.For.The.Impatient.md
Scala for the Impatient Exercises

This gist will contain all the exercises from the book

@pmav99
pmav99 / skylake-tuning-linux.md
Created September 28, 2018 13:25 — forked from Brainiarc7/skylake-tuning-linux.md
This gist will show you how to tune your Intel-based Skylake, Kabylake and beyond Integrated Graphics Core for performance and reliability through GuC and HuC firmware usage on Linux.

Tuning Intel Skylake and beyond for optimal performance and feature level support on Linux:

Note that on Skylake, Kabylake (and the now cancelled "Broxton") SKUs, functionality such as power saving, GPU scheduling and HDMI audio have been moved onto binary-only firmware, and as such, the GuC and the HuC blobs must be loaded at run-time to access this functionality.

Enabling GuC and HuC on Skylake and above requires a few extra parameters be passed to the kernel before boot.

Instructions provided for both Fedora and Ubuntu (including Debian):

Note that the firmware for these GPUs is often packaged by your distributor, and as such, you can confirm the firmware blob's availability by running: