Skip to content

Instantly share code, notes, and snippets.

@matwey
matwey / v4l2-test.c
Last active January 21, 2019 17:59
v4l2-test
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/mman.h>
@matwey
matwey / calc.py
Last active June 20, 2018 07:25
Test GLTR Affine Cube
#!/usr/bin/env python3
import numpy as np
import matplotlib
matplotlib.use("Gtk3Cairo")
import matplotlib.pyplot as plt
import matplotlib.patches as patches
from matplotlib.path import Path
from scipy.interpolate import interp2d
@matwey
matwey / pygstplay.py
Last active June 15, 2018 10:06
Python GStreamer player
#!/usr/bin/env python3
import sys, os
import argparse
import gi
gi.require_version('Gst', '1.0')
gi.require_version('Gtk', '3.0')
gi.require_version('GstVideo', '1.0')
from gi.repository import Gst, GObject, Gtk
from gi.repository import GdkX11, GstVideo
@matwey
matwey / main.cpp
Created July 4, 2018 18:47
Boost Asio Buffer Sequence
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <string>
#include <vector>
#include <boost/asio.hpp>
using boost::asio::ip::tcp;
int main(int argc, char** argv) {
@matwey
matwey / CMakeLists.txt
Last active December 13, 2018 11:54
Qt OpenGL version
cmake_minimum_required(VERSION 3.0.0)
cmake_policy(SET CMP0048 NEW)
project(qtopengl LANGUAGES C CXX VERSION 3.2.2)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_CXX_STANDARD 11)
find_package(Qt5Core REQUIRED)
find_package(Qt5Widgets REQUIRED)
@matwey
matwey / TimeAndCoordinate.cpp
Last active August 30, 2018 07:36
TimeAndCoordinate disassembled code
#include <math.h>
#include <string.h>
#include "TimeAndCoordinate.h"
// FIXME: data!!!
char c19[160];
char c18[160];
void Rot123(int a1, double a2, double *a3, double *a4)
{
@matwey
matwey / ADefine.h
Last active April 23, 2023 07:11
LMST test
/**
Name : ADefine.h 常量及宏定义声明文件
Author : Xiaomeng Lu
Version : 0.1
Date : Oct 13, 2012
Last Date : Oct 13, 2012
Description : 天文数字图像处理中常用的常量及宏定义
**/
#ifndef _ADEFINE_H_
#define _ADEFINE_H_
@matwey
matwey / p.py
Created September 10, 2018 18:06
Erlang/OTP notes.xml parser
import xml.etree.ElementTree as ET
import textwrap
w = textwrap.TextWrapper(initial_indent=' * ', subsequent_indent=' ', width=62)
root = ET.parse('notes.xml')
for x in root.findall('./section[title]'):
print(x.find("title").text)
z = x.findall("./section[title='Fixed Bugs and Malfunctions']/list/item/p[1]")
for y in z:
@matwey
matwey / main.c
Last active January 3, 2019 18:00
qemu pwrite test case
#define _GNU_SOURCE
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <string.h>
/*
@matwey
matwey / main.cpp
Last active February 12, 2019 14:01
c++ partial_shuffle
#include <iostream>
#include <cstring>
#include <random>
#include <chrono>
#include <iterator>
template<class RandomIt, class URBG>
void partial_shuffle(RandomIt first, RandomIt middle, RandomIt last, URBG&& g)
{
using difference_type = typename std::iterator_traits<RandomIt>::difference_type;