Skip to content

Instantly share code, notes, and snippets.

@milannankov
milannankov / MyProjectFile.csproj
Last active October 5, 2018 12:39
copy-output-files-msbuild
<!-- Rest of .csproj -->
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildProjectDirectory)\Build\copy-output.targets" />
</Project>
@raingo
raingo / ops.py
Last active March 30, 2021 16:50
multi dimensional softmax with tensorflow
import tensorflow as tf
"""
Multi dimensional softmax,
refer to https://github.com/tensorflow/tensorflow/issues/210
compute softmax along the dimension of target
the native softmax only supports batch_size x dimension
"""
def softmax(target, axis, name=None):
@adeekshith
adeekshith / .git-commit-template.txt
Last active February 21, 2024 12:06 — forked from Linell/.git-commit-template.txt
This commit message template helps you write great commit messages and enforce it across teams.
# <type>: (If applied, this commit will...) <subject> (Max 50 char)
# |<---- Using a Maximum Of 50 Characters ---->|
# Explain why this change is being made
# |<---- Try To Limit Each Line to a Maximum Of 72 Characters ---->|
# Provide links or keys to any relevant tickets, articles or other resources
# Example: Github issue #23
@RaymondKroon
RaymondKroon / llvm-update-alternatives
Last active July 6, 2020 16:48 — forked from jc00ke/llvm-update-alternatives
LLVM & clang alternatives
#!/usr/bin/env sh
sudo update-alternatives --install \
/usr/bin/llvm-config llvm-config /usr/bin/llvm-config-3.6 200 \
--slave /usr/bin/llvm-ar llvm-ar /usr/bin/llvm-ar-3.6 \
--slave /usr/bin/llvm-as llvm-as /usr/bin/llvm-as-3.6 \
--slave /usr/bin/llvm-bcanalyzer llvm-bcanalyzer /usr/bin/llvm-bcanalyzer-3.6 \
--slave /usr/bin/llvm-cov llvm-cov /usr/bin/llvm-cov-3.6 \
--slave /usr/bin/llvm-diff llvm-diff /usr/bin/llvm-diff-3.6 \
--slave /usr/bin/llvm-dis llvm-dis /usr/bin/llvm-dis-3.6 \
@wolph
wolph / warning_decorator.py
Created October 5, 2015 09:08
Decorator to ignore a specific number of Python warnings
import warnings
import functools
def ignore_warning(warning, count=None):
def _ignore_warning(function):
@functools.wraps(function)
def __ignore_warning(*args, **kwargs):
with warnings.catch_warnings(record=True) as ws:
# Catch all warnings of this type
@BartG95
BartG95 / build_opencv.md
Last active January 30, 2023 21:30
How to: build OpenCV x64 with Qt on Visual Studio 2015 Community Preview and Windows 10 Preview (build 10162)

Note: since I switched to GNU+Linux (a libre operating system, which I recommend), I don't maintain this tutorial anymore. Also, be aware that this tutorial is about preview software that is superseded by multiple stable releases. Consider all information below as outdated and possibly wrong.

How to: build OpenCV x64 with Qt on Visual Studio 2015 Community Preview and Windows 10 Preview (build 10162)

Introduction

As I'm an update addict, I like to try preview software. Or I'm an update addict because I like preview software. I don't know. Anyway, before my holiday started, I used OpenCV for a project in college. I like the library, because it's possible to achieve funny things with it and it makes computer vision easy. So when my holiday began, I started using OpenCV for some fun projects. And then I upgraded Windows 10. It wasn't stable back then, but I didn't need my pc for a while, so I could try it. Also I installed Visual Studio 2015 and I started to make an OpenCV project.

Unfortunately, th

@miohtama
miohtama / sanitycheck.py
Created June 4, 2015 21:22
Perform database sync sanity check to SQLAlchemy models on application startup
import logging
from sqlalchemy import inspect
from sqlalchemy.ext.declarative.clsregistry import _ModuleMarker
from sqlalchemy.orm import RelationshipProperty
logger = logging.getLogger(__name__)
def is_sane_database(Base, session):
@satra
satra / distcorr.py
Created October 16, 2014 15:40
Distance Correlation in Python
from scipy.spatial.distance import pdist, squareform
import numpy as np
from numbapro import jit, float32
def distcorr(X, Y):
""" Compute the distance correlation function
>>> a = [1,2,3,4,5]
>>> b = np.array([1,2,9,4,4])
@devdattaT
devdattaT / getTiles.py
Created July 14, 2014 08:31
Downloading of Slippy Tiles using Shapely.
import math
import os
import urllib
from shapely.geometry import Polygon
def deg2num(lat_deg, lon_deg, zoom):
lat_rad = math.radians(lat_deg)
n = 2.0 ** zoom
xtile = int((lon_deg + 180.0) / 360.0 * n)
ytile = int((1.0 - math.log(math.tan(lat_rad) + (1 / math.cos(lat_rad))) / math.pi) / 2.0 * n)