Skip to content

Instantly share code, notes, and snippets.

View snegovick's full-sized avatar

Konstantin Kirik snegovick

View GitHub Profile
#!/usr/bin/env python
"""
This module sets up a video stream from internal or connected webcam using Gstreamer.
You can then take snapshots.
"""
import pygtk, gtk
import pygst
pygst.require("0.10")
/*
* V4L2 video capture example
*
* This program can be used and distributed without restrictions.
*
* This program is provided with the V4L2 API
* see http://linuxtv.org/docs.php for more information
*/
#include <stdio.h>
/*
* V4L2 video capture example
*
* This program can be used and distributed without restrictions.
*
* This program is provided with the V4L2 API
* see http://linuxtv.org/docs.php for more information
*/
#include <stdio.h>
@snegovick
snegovick / gtkgst.py
Last active January 23, 2018 03:40
GTK widget to show gstreamer captured video
#!/usr/bin/env python
# Copyright (C) 2014 by Kirik Konstantin <snegovick>
try:
import gtk
import gobject
from gtk import gdk
except:
raise SystemExit
#include <linux/platform_device.h>
#include <linux/of_device.h>
#include <linux/of_gpio.h>
#include <linux/spi/spi.h>
#include <linux/module.h>
#include <linux/delay.h>
#include <linux/clk.h>
#include <linux/io.h>
#include <linux/of.h>
/*
* ChibiOS/RT - Copyright (C) 2013 Alan Barr
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@snegovick
snegovick / gist:4193874
Created December 3, 2012 09:35
simple script which reopens same tty
import serial
import struct
import sys
import time
def open_and_cat():
port = serial.Serial(sys.argv[1], sys.argv[2], bytesize=8, parity='N', stopbits=1, xonxoff=0, rtscts=0, timeout=2)
while True:
@snegovick
snegovick / sutil.lua
Created September 10, 2015 02:30
Serial utils for lua
local sutil = {}
function sutil.getchar(ttyfile)
return ttyfile:read(1)
end
function sutil.readall_timeout(ttyfile, n, time)
local data = ""
local ret = true
local ctr = 0
grep ^X $1 | sed -e "s/X//" | sed -e "s/Y/, /" | awk '{printf "%s, %s, 0.0, t\n",NR,$0}' > $1.ascii
@snegovick
snegovick / pmd.sh
Created October 2, 2014 15:54
Pandoc line to generate russian pdf from md source
pandoc --latex-engine=pdflatex -V lang=russian -f markdown $1 -o $2