Skip to content

Instantly share code, notes, and snippets.

find . -type f -name '*.hpp' -o -name '*.cpp' | xargs awk 'FNR==1 && NR>1 {print ""} {print}' >> out.txt
@khoben
khoben / opencv-4.3.0-building-windows-param
Created June 13, 2020 03:11
OpenCV 4.3.0 correct building params for windows platform
BUILD_opencv_rgbd OFF
BUILD_opencv_python3 OFF
BUILD_opencv_python_bindings_generator OFF
BUILD_opencv_python_tests OFF
OPENCV_ALLOCATOR_STATS_COUNTER_TYPE int64_t
@khoben
khoben / FWRuleIO.cpp
Created December 19, 2019 12:52
firewall client
#include "FWRuleIO.hpp"
FWRuleIO::FWRuleIO(const string& filename) {
fWrite.open((const char *) filename.c_str(), ios::out | ios::app);
fRead.open((const char *) filename.c_str(), ios::in);
}
FWRuleIO::~FWRuleIO() {
fWrite.close();
fRead.close();
@khoben
khoben / main.c
Created December 19, 2019 12:49
linux netfilter firewall
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/vmalloc.h>
#include <linux/netfilter.h>
#include <linux/proc_fs.h> /* Необходимо для работы с файловой системой /proc */
#include <asm/uaccess.h> /* определения функций get_user и put_user */
#include "neth.h"
MODULE_LICENSE("GPL");
@khoben
khoben / main.c
Created December 19, 2019 12:44
phonebook linux device
/*
* main.c
*
* Created on: Sep 15, 2019
* Author: khoben
*/
#include <linux/module.h>
#include <linux/string.h>
#include <linux/fs.h>
@khoben
khoben / icmp_counter.c
Created December 19, 2019 12:32
icmp packet counter
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/netfilter.h>
#include <linux/netfilter_ipv4.h>
#include <linux/ip.h>
#include <linux/fs.h>
#include <asm/uaccess.h>
#include <linux/uaccess.h>
MODULE_LICENSE("GPL");
@khoben
khoben / 4.pml
Created December 10, 2019 13:19
Promela model verification
mtype = {new_task, task_comp, done};
byte taskOpen = 0;
byte taskClose = 0;
chan c_client = [0] of {mtype};
chan c_chair = [0] of {mtype};
chan c_hr = [0] of {mtype};
chan c_worker = [0] of {mtype};
@khoben
khoben / get_rssi_wifi.py
Created October 29, 2018 10:21
Getting strength of Wi-Fi signal on Windows platform
import subprocess
import re
def percentTodBm(quality):
return (quality / 2) - 100
def getSSID():
results = subprocess.check_output(
{
"editor.fontFamily": "Hack, 'Hack', monospace",
"workbench.colorTheme": "One Dark Pro",
"editor.renderWhitespace": "boundary",
"editor.cursorBlinking": "phase",
"python.linting.enabled": false,
"python.linting.enabledWithoutWorkspace": false,
"python.formatting.formatOnSave": true,
"python.linting.pylintEnabled": false,
"editor.fontWeight": "bold"
elif c["data"]=="Посмотреть текущие скидки":
appendUserPath(c["message"]["chat"]["id"], c["data"])
text="<b>Текущие скидки</b>\n"
sales_list=getSalesList()
sales_list="<pre>"+sales_list+"</pre>"
bot.edit_message_text(
chat_id=c["message"]["chat"]["id"],