Skip to content

Instantly share code, notes, and snippets.

View dov's full-sized avatar

Dov Grobgeld dov

  • Rehovot, Israel
View GitHub Profile
@dov
dov / npcat
Created January 28, 2020 20:50
#!/usr/bin/python
# Cat a np array from a .npy file
import numpy as np
from PIL import Image
import sys
def die(msg):
msg += "\n" if msg[-1]!="\n" else ""
sys.stderr.write(msg)
@dov
dov / pybind11.md
Last active October 8, 2019 09:36
pybind11 shadow classes for C++ objects

Intro

Have you ever wondered how to create XJet like python bindings to your own C++ classes, with a modern python binding package? Wonder no longer!

// Example to allocate a class in C++, wrap it as a python class and call a
// member of it from python.
//
// 2019-10-08 Tue

#include <stdio.h>
@dov
dov / my-py-jump-exception.el
Created May 15, 2018 08:09
Elisp function to jump to the python exception line pointed at
(defun py-jump-exception-line ()
"This function parses the python exception stack and jumps to the line pointed at"
(interactive)
(save-selected-window
(let ((file nil)
(line nil)
(buffer (current-buffer)))
(beginning-of-line)
(forward-word)
(forward-char)
@dov
dov / decrypt-en.py
Created May 16, 2017 20:51
Decrypting Epsilon Note encoded notes with python (given the password)
#!/usr/bin/python
######################################################################
# Decrypt an Epsilon Note encoded file given the password.
#
# This file is in the public domain.
#
# Dov Grobgeld <dov.grobgeld@gmail.com>
# 2017-02-17 Fri
######################################################################
@dov
dov / GestureParse.py
Created January 8, 2017 19:58
A parser of the Android Gesture file format that outputs giv files for each character
#!/usr/bin/python
######################################################################
# A python parser for the file format in the Android Gesture builder.
# Each character is output in a giv (http://giv.sourceforge.net/giv/)
# file format.
#
# MIT License
#
# Copyright (c) 2017 Dov Grobgeld
@dov
dov / pandassrt.py
Last active January 8, 2017 20:01
Realign srt files
# This file reads two subtitle srt files. The first one is assumed
# to be wrongly aligned, and the second one is correctly aligned.
# In additon the user needs to create a few alignment points. These
# will be used for rescaling the timescale of the first srt file
# so that it fits the second file.
#
# Dov Grobgeld
# dov.grobgeld@gmail.com
import pandas as pd
#!/usr/bin/python
# This example creates a board with a flat surface at z=0
# and a number of pieces that may interactively be moved
# around the board by the mouse.
#
# Dov Grobgeld <dov.grobgeld@gmail.com>
# This example is released under the same BSD licence as vtk.
import vtk