Skip to content

Instantly share code, notes, and snippets.

View jirihnidek's full-sized avatar

Jiri Hnidek jirihnidek

View GitHub Profile
@jirihnidek
jirihnidek / layers_example.py
Last active August 29, 2015 14:10
Blender Python API: Example of BMesh layers
import bpy
import bmesh
def element_id_layer(bm, elems, id_name):
"""
This function will create/print verts/edges/faces layer
"""
# Try to get layer of elem IDs
elems_iter = getattr(bm, elems)
@jirihnidek
jirihnidek / example_mesh_changes.py
Created November 24, 2014 21:04
Blender Python API example: detection of changes in mesh object (edit mode)
import bpy
def cb_scene_update(context):
"""
"""
edit_obj = bpy.context.edit_object
if edit_obj is not None and edit_obj.is_updated_data is True:
print(edit_obj)
@jirihnidek
jirihnidek / shared_pointers.cc
Created November 7, 2014 12:43
Example of C++ shared pointers
#include <iostream>
#include <memory>
#include <assert.h>
using namespace std;
template <class Value>
class Output
{
@jirihnidek
jirihnidek / base.html
Last active August 29, 2015 14:08
WebPy Templetor Example
$def with (content)
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title>$content.title</title>
</head>
<body>
$:content
@jirihnidek
jirihnidek / webpy_json.py
Last active August 29, 2015 14:08
WebPy JSON Example
"""
This module tries to print JSON from HTTP GET/POST method.
"""
#
# To test the application run application with:
#
# python ./webpy_json.py
#
# and type following URI in browser addres bar:
@jirihnidek
jirihnidek / README.md
Last active August 29, 2015 14:03
Examples of Python scripts for adding and changing values in Verse layers

Examples of VerseLayer

This gist contains several Python scripts using class VerseLayer from module Verse Entities: https://github.com/verse/verse-entities

Create Verse Layer

The script that is used for creating new layer is called verse_layer_create.py. This script creates new Node, then this node is moved to the parent of scene nodes. Thus this node will not be destroyed after client logout. New layer is created in

@jirihnidek
jirihnidek / map_example.cc
Created April 2, 2014 11:59
Pointer as key for C++ map
#include <iostream>
#include <map>
// Compile: g++ map_example.cc
// Run: ./a.out
int main(void)
{
std::map<unsigned char*, int> paleta;
unsigned char rgb1[3], rgb2[3];
@jirihnidek
jirihnidek / .gitignore
Last active November 17, 2022 20:04
UDP client-server application using random port number with respect to statefull firewalls aka hole punching.
.cproject
.project
@jirihnidek
jirihnidek / Results.md
Last active August 29, 2015 13:56
Simple CTypes example and benchmark.

Results of Benchmark

Python2.6         0.14
Python2.6 CTypes  0.71
Python2.7         0.15
Python2.7 CTypes  0.77
Python3.3         0.14
Python3.3 CTypes 0.71
@jirihnidek
jirihnidek / multi_proc.py
Last active August 29, 2015 13:56
Testing of multithreading and multiprocesing in Python interpreters.
#!/usr/bin/env python
"""
Simple module for testing parallel variant of
code using Python multiprocessing
"""
from multiprocessing import Process
import time