Skip to content

Instantly share code, notes, and snippets.

View jirihnidek's full-sized avatar

Jiri Hnidek jirihnidek

View GitHub Profile
@jirihnidek
jirihnidek / bpy_obj.py
Last active August 29, 2015 13:56
This code snippet make active object in Blender not active object, unselected and unselectable
import bpy
obj = bpy.context.active_object
obj.select = False
bpy.context.scene.objects.active = None
obj.hide_select = True
@jirihnidek
jirihnidek / VerseCommands.txt
Last active August 29, 2015 13:55
Structure of some commands sent during Verse handshake.
USER_AUTH_FAILURE
0 1 1
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
+---------------+---------------+
| OpCode=8 | Length=2 |
+---------------+---------------+
USER_AUTH_SUCCESS
@jirihnidek
jirihnidek / experiment_array.cc
Last active January 3, 2016 23:59
List of base classes.
#include <iostream>
#include <vector>
#include <stdlib.h>
// Not templated abstract class
class DataBase {
public:
DataBase() {};
@jirihnidek
jirihnidek / vrsent_subclasses.py
Last active December 23, 2015 12:19
Subclassing of VerseNode and VerseTag
import vrsent as v
class CustomNode(v.VerseNode):
"""
Custom subclass of VeseNode
"""
custom_type = 10
def __str__(self):
@jirihnidek
jirihnidek / vrsent_cli.py
Last active December 23, 2015 12:19
Example of using vrsent module as python cli to verse
import vrsent as v
s = v.VerseSession(hostname='localhost', service='12344', \
callback_thread=True, username='your_name', password='your_pass')
for n in s.nodes.values():
print(n)
n = v.VerseNode(s, custom_type=10)
print(n)
tg = v.VerseTagGroup(n, custom_type=100)
print(tg)
tg = v.VerseTag(tg=tg, value=(1.0,), custom_type=1000)
@jirihnidek
jirihnidek / wslay_openssl_server.c
Last active December 19, 2015 18:08
Example of WebSocket server implemented with WSLay and OpenSSL
/**
* \brief Wslay WebSocket infinite loop
*/
void *websocket_loop(void *arg)
{
struct Context *C = (struct vContext*)arg;
/*
* This structure is passed as *user_data* in callback functions.
*/
struct Session *session = CTX_current_session(C);
@jirihnidek
jirihnidek / FindLibWebSockets.cmake
Created June 26, 2013 08:15
This is simple CMake find module for libwebsockets library
# This module tries to find libWebsockets library and include files
#
# LIBWEBSOCKETS_INCLUDE_DIR, path where to find libwebsockets.h
# LIBWEBSOCKETS_LIBRARY_DIR, path where to find libwebsockets.so
# LIBWEBSOCKETS_LIBRARIES, the library to link against
# LIBWEBSOCKETS_FOUND, If false, do not try to use libWebSockets
#
# This currently works probably only for Linux
FIND_PATH ( LIBWEBSOCKETS_INCLUDE_DIR libwebsockets.h