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 / gamepad-goocanvas-example.py
Created November 30, 2020 21:50
Example of how to move two circles on a goocanvas with a gamepad
#!/usr/bin/python
######################################################################
#
# An example of how to use the gamepad as an input device for
# python.
#
# The example shows two dots that can be controlled by the
# left and the right joystick on a gamepad.
#
# This may be used as the basis for any analog output. E.g. to
@dov
dov / pango-cairo-example.py
Last active January 12, 2021 17:23
A python example of how to create png images with text through pangocairo
#!/usr/bin/python
######################################################################
# An example of how to draw text with pangocairo.
#
# This script is in the public domain
#
# Dov Grobgeld <dov.grobgeld@gmail.com>
# 2021-01-12 Tue
######################################################################
@dov
dov / svg-to-pdf-via-png
Created January 15, 2021 08:54
A script for converting a list of svg files to a pdf files via inkscape and png
#!/usr/bin/python
######################################################################
# A script for translating a list of svg (pages) to a pdf file
# via inkscape and cairo.
#
# The reason I used png steps as an intermediate is two fold:
#
# 1. It makes the pdf files less editable (which might be good
# when sending documents)
@dov
dov / svg_path_writer.py
Created February 6, 2021 20:42
A simple svg writer in python for paths
# A simple svg writer for paths
#
# This example is in the public domain
#
# 2021-02-06 Sat
# Dov Grobgeld <dov.grobgeld@gmail.com>
def moveto(x,y): return f'M {x},{y}'
def lineto(x,y): return f'L {x},{y}'
def closepath(): return 'Z'
@dov
dov / create_triangle_gltf.cpp
Created February 25, 2021 21:03
Example of how to build a gltf file from scratch with tiny_gltf.h
// An example of how to generate a gltf file from scratch. This example
// was translated from the pygltlib documentation in the pypi project page,
// which in turn is based on the Khronos Sample Models at:
//
// https://github.com/KhronosGroup/glTF-Sample-Models
//
// This example is released under the MIT license.
//
// 2021-02-25 Thu
// Dov Grobgeld <dov.grobgeld@gmail.com>
@dov
dov / Makefile
Created May 2, 2021 17:46
A Vulkan renderheadless example with two render passes (not working)
# Minimal makefile for multipass-minimal
%.o : %.cpp
g++ -o $@ -c -Wall -g -std=c++17 $?
multipass-minimal: multipass-minimal.o VulkanTools.o
g++ -o $@ $? -lglfw -lvulkan
clean:
$(RM) multipass-minimal.o multipass-minimal
@dov
dov / label_to_color.py
Created May 5, 2021 04:37
How to color a label image in python
#!/usr/bin/python
######################################################################
#
# An example of how to color code a gray level label image in
# python.
#
# 2021-05-05 Wed
# Dov Grobgeld <dov.grobgeld@gmail.com>
######################################################################
@dov
dov / ReadMe.md
Created July 4, 2021 19:11
paps vs emacs example

Intro

This gist contains images showing off paps on the emacs HELLO file.

@dov
dov / cite-convert.py
Created December 20, 2021 06:45
Freeformat to bibtex conversion
#!/usr/bin/python
######################################################################
# A script to convert from "free format" citations in my
# daughter's to bib-tex convention.
#
# Dov Grobgeld <dov.grobgeld@gmail.com>
# 2021-12-18 Sat
######################################################################
@dov
dov / dummy
Created September 8, 2022 21:23
An image gist
dummy