Skip to content

Instantly share code, notes, and snippets.

View vpetrigo's full-sized avatar

Vladimir Petrigo vpetrigo

  • Poland, Kraków
View GitHub Profile
#include <iostream>
struct Base {
};
struct D1 : Base {
};
struct D2 : Base {
int a{10};
@vpetrigo
vpetrigo / multiple_inh.cpp
Created October 23, 2017 09:31
Multiple inheritance example
#include <iostream>
struct A {
virtual ~A() = default;
};
struct C {
virtual ~C() = default;
void foo() {
@vpetrigo
vpetrigo / db2017_w5hw1.sql
Created October 4, 2017 08:32
SQL 2017 CSC Course on Stepik (Week 5, task 1)
DROP TABLE IF EXISTS Conference;
DROP TABLE IF EXISTS ConferenceEvent;
DROP TABLE IF EXISTS Paper;
-- Серия ежегодных конференций
CREATE TABLE Conference (
id INT PRIMARY KEY,
name TEXT
);
@vpetrigo
vpetrigo / verification.c
Created August 2, 2017 20:19
Verify file with OpenSSL
#include <openssl/evp.h>
#include <openssl/err.h>
#include <openssl/x509.h>
#include <openssl/pem.h>
#include <stdio.h>
#include <stddef.h>
#include <inttypes.h>
#include <string.h>
@vpetrigo
vpetrigo / tester.py
Created July 20, 2017 23:47
Stepik Linux Week 3 Task 2 test script
#!/usr/bin/env python3
# coding=utf-8
import os
fd = os.open("/dev/solution", os.O_RDWR | os.O_NOCTTY)
test = open(fd, "wb+", buffering=0)
test.write(b"Hello")
@vpetrigo
vpetrigo / README.md
Last active May 3, 2020 02:48
Linux module load/unload scripts

Скопировать скрипты solution.load и solution.unload в директорию с модулем. Сделать их исполняемыми с помощью команды:

chmod +x solution.load
chmod +x solution.unload

После этого для того, чтобы загрузить модуль solution и создать node для него с major-номером 240 нужно выполнить команду:

@vpetrigo
vpetrigo / linux.s
Created December 10, 2016 18:43
Minimal ASM files
# Build command: gcc linux.s -o linux.out
.intel_syntax noprefix
.extern puts
.text
.globl main
main:
lea rdi, message
@vpetrigo
vpetrigo / CMakeLists.txt
Created December 5, 2016 21:48
CMake template for using Clang + ARM toolchain
cmake_minimum_required(VERSION 3.2)
set(CMAKE_CROSSCOMPILING TRUE)
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR arm)
set(gcc_toolchain "$ENV{USERPROFILE}\\Documents\\Projects\\toolchains\\gcc-mingw32-arm-linux-gnueabihf")
set(triple arm-linux-gnueabihf)
set(cpu_type cortex-a7)
set(fpu_type neon-vfpv4)
@vpetrigo
vpetrigo / dict_create.py
Created November 14, 2016 14:07
Python dictionary creation time. Different techniques
#!/usr/bin/env python3
# coding=utf-8
import timer
import itertools
def naive_dict_create(keys, values):
return {k: v for k, v in
@vpetrigo
vpetrigo / helper.makefile
Last active May 1, 2019 19:53
Сборка проекта NCP Ember ZNet PRO для Raspberry Pi 2 на Windows
COMPILER = arm-linux-gnueabihf-gcc
LINKER = arm-linux-gnueabihf-gcc
ARCHIVE = arm-linux-gnueabihf-ar
LINKER_FLAGS = --library-path="C:/SysGCC/Raspberry/arm-linux-gnueabihf/sysroot/lib/arm-linux-gnueabihf" \
--library-path="C:/SysGCC/Raspberry/arm-linux-gnueabihf/sysroot/lib"