Skip to content

Instantly share code, notes, and snippets.

View dov's full-sized avatar

Dov Grobgeld dov

  • Rehovot, Israel
View GitHub Profile
#!/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 <[email protected]>
# This example is released under the same BSD licence as vtk.
import vtk
@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
# [email protected]
import pandas as pd
@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 / 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 <[email protected]>
# 2017-02-17 Fri
######################################################################
@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 / 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 / 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 / WifiServerACD1mini.ino
Created July 22, 2020 18:28
A web server for sending raw IR codes
// This is as a web server library used for sending raw IR codes
// to an IR-Led.
//
// The raw string decoding code was borrowed from:
//
// https://github.com/crankyoldgit/IRremoteESP8266
//
//
// License: GLPL v2.1
//
@dov
dov / mbox_receiver.py
Created August 8, 2020 18:10
mqtt mbox example
# An example of a mailbox client that wakes up every
# few seconds and checks for messages and then goes
# back to sleep.
#
# License: This code has been donated to the public domain
#
# Dov Grobgeld <[email protected]>
# 2020-08-08 Sat
import paho.mqtt.client as mqtt #import the client1
@dov
dov / write-text-to-pixbuf.c
Created October 30, 2020 07:08
A function for writing marked up text to a GdkPixbuf through pangocairo
/* An example writing text to a GdkPixbuf through pangocairo.
Compile by:
gcc -o write-text-to-pixbuf `pkg-config --cflags --libs gdk-pixbuf-2.0 pangocairo` write-text-to-pixbuf.c
This example is released under the MIT license.
Copyright 2020 Dov Grobgeld <[email protected]>