This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <pthread.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <unistd.h> | |
void *start_routine(void *arg) | |
{ | |
int *i = (int *)arg; | |
while(*i< 10) { | |
sleep(1); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class HashStub | |
# Значения атрибутов хранятся в хэше @data который | |
# инициализируется при создании объекта | |
def initialize | |
@data = {} | |
end | |
# Наша реализация method_missing | |
# name - имя метода который был не найден | |
# args - аргументы вызова метода собранные в массив |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env python | |
# -*- coding: utf-8 -*- | |
from opencv import cv | |
from opencv import highgui | |
DEV = 0 #номер устройства /dev/video0 | |
if __name__ == '__main__': | |
# Создаем окно для вывода изображения с камеры |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//////////////////////////////////////////////////////////////////////// | |
// project: SimpleOPCClient | |
// version: 2 | |
// | |
// subject: this is a simple OPC Client that read the value of an item | |
// from an OPC server. | |
// | |
// file: SimpleOPCClient.cpp | |
// | |
// writer: Philippe GRAS - CERN / EP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# http://xpca.org | |
# Timin Aleksey 2011 | |
template :analog_point do | |
min_raw 0 | |
max_raw 0xffff | |
min_scale 0 | |
max_scale 100 | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rmodbus' | |
ModBus::TCPClient.new('127.0.0.1', 8502) do |cl| | |
cl.with_slave(1) do |slave| | |
# Read a single holding register at address 16 | |
slave.holding_registers[16] | |
# Write a single holding register at address 16 | |
slave.holding_registers[16] = 123 | |
# Read holding registers 16 through 20 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'lipa' | |
un = root :universe do | |
kind :planet_system do | |
num_planet run{ | |
count = 0 | |
children.values.each do |planet| | |
count += 1 if planet.kind == :planet | |
end | |
count |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
=begin | |
It's very simple example of implementation | |
REST-PCA gateway | |
for communication with TCP ModBus devices | |
It receives REST requests | |
(e.g http://127.0.0.1:4567/mb/127.0.0.1/8502/1/coils/6/17 ) | |
and returns data in JSON format addr : data: | |
{"coils": { | |
"6":{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Lipa::Tree["tree://dir_1/dir_2/file_1"].size | |
#or | |
tree["dir_1/dir_2/file_1"].size | |
#or | |
tree.dir_1.dir_2.file_1.size |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
t = Lipa::Tree.new :tree do | |
kind :some_kind, :for => :node | |
with :attr_1 => 999 do | |
some_kind :obj_1 | |
end | |
end |
OlderNewer