Skip to content

Instantly share code, notes, and snippets.

View avasyukov's full-sized avatar

Alexey Vasyukov avasyukov

View GitHub Profile
@avasyukov
avasyukov / dispatch_table.cpp
Created March 31, 2020 09:37
C++ dispatch table sample
#include <iostream>
#include <functional>
#include <unordered_map>
#include <algorithm>
using namespace std;
// Какие-то функции, которые мы хотим вызывать.
// Состав параметров и тип возвращаемых значений совпадает.
@avasyukov
avasyukov / units_starter.cpp
Created March 9, 2020 16:23
Starter file for MIPT contest problem
#include <iostream>
using namespace std;
// Шаблонный класс для размерной величины
template<int L, int M, int T>
class DimQ
{
public:
double value;
@avasyukov
avasyukov / python_vtk_dump_unstructured_grid.py
Created March 5, 2020 08:33
Python: dump VTK unstructured grid, creating it ad-hoc from physics calculation data
import vtk
def dump_model(model, name, path="."):
# Data from physics calculation
# All nodes
nodes = model["nodes"]
# Triangles of the first body
bar_elements = model["bar_elements"]
# Triangles of the second body
surf_elements = model["surf_elements"]
@avasyukov
avasyukov / mqlimits.cpp
Created December 12, 2019 13:15
mq limits test
#include <stdio.h>
#include <mqueue.h>
#include <errno.h>
#include <string.h>
#include <stdlib.h>
#include <stddef.h>
#include <sys/stat.h>
int main(int argc, char** argv)
{
@avasyukov
avasyukov / custom_stream.cpp
Created November 18, 2019 17:43
Sample of custom C++ stream processing with custom destination if necessary
#include<iostream>
#include<sstream>
class CustomBuf : public std::stringbuf
{
public:
virtual int sync() {
// do whatever you want with this->str() here
std::cout << "Syncing stream: " << this->str() << std::endl;
}

Keybase proof

I hereby claim:

  • I am avasyukov on github.
  • I am avasyukov (https://keybase.io/avasyukov) on keybase.
  • I have a public key whose fingerprint is 54B4 BF60 943A ADDF C04A 923B 54AC CFA6 2EA5 8CEC

To claim this, I am signing this object:

{
"metadata": {
"parent": {
"permissions": {
"user": {},
"roles": []
}
}
},
"items": [{
<config>
<forms>
<dependencies>
<js src="/components/custom/custom-datagrid-actions.js" />
<css src="/components/custom/custom-datagrid-actions.css" />
</dependencies>
</forms>
</config>
.datagrid .onActionPermissions a
{
background-image: url(/share/res/components/documentlibrary/actions/document-manage-permissions-16.png);
}
.datagrid .onActionComplete a
{
background-image: url(/share/res/components/images/complete-16.png);
}
// Custom action implementation
MyCustomAction = function(item)
{
// The property we are going to set
var targetProp = "prop_alvexdt_signingDate";
// Current date converted into ISO8601 format
var now = Alfresco.util.toISO8601(new Date());
// Form processor URL for current item
var formprocessorURL = Alfresco.constants.PROXY_URI + "api/node/" + Alfresco.util.NodeRef(item.nodeRef).uri + "/formprocessor";