- Build: make -C /lib/modules/$(uname -r)/build M=$(pwd) modules
- Install:sudo insmod usb_filter.ko
- Test: dmesg
- Remove: sudo rmmod usb_filter
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 <linux/module.h> | |
#include <linux/kernel.h> | |
#include <linux/usb.h> | |
#define USB_FILTER_ADD_DEVICE _IO('u', 0) | |
#define USB_FILTER_REMOVE_DEVICE _IO('u', 1) | |
static int is_device_blacklisted(struct usb_device *dev) { | |
// Check if the device is blacklisted based on some criteria | |
return 0; // Return 1 if blacklisted, 0 otherwise |
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
package main | |
import ( | |
"fmt" | |
) | |
type MyMap map[string]interface{} | |
func (m MyMap) Set(key string, value interface{}) { | |
m[key] = value |
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
package main | |
import ( | |
"fmt" | |
"os" | |
"path/filepath" | |
) | |
func main() { | |
folderPath := "path/to/folder" |
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 <iostream> | |
#include <boost/asio.hpp> | |
#include <boost/thread.hpp> | |
using boost::asio::ip::tcp; | |
void session(tcp::socket socket) | |
{ | |
try | |
{ |
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 <iostream> | |
#include <cpprest/http_client.h> | |
#include <cpprest/json.h> | |
using namespace web; | |
using namespace web::http; | |
using namespace web::http::client; | |
int 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
#include <iostream> | |
#include <boost/asio.hpp> | |
#include <boost/beast.hpp> | |
namespace asio = boost::asio; | |
namespace beast = boost::beast; | |
using tcp = asio::ip::tcp; | |
int main() | |
{ |
Here's an example of how you can implement a multi-process plugin system for Linux on Golang
- core_module.go - Core module of plugin system.
- process_plugin.go - Plugin module.
- watchdog.go - Watchdog module.
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
import sys | |
import time | |
import numpy as np | |
from matplotlib.backends.qt_compat import QtWidgets | |
from matplotlib.backends.backend_qtagg import ( | |
FigureCanvas, NavigationToolbar2QT as NavigationToolbar) | |
from matplotlib.figure import Figure | |
import trsfile as trs | |
from trsfile import trs_open, Trace, SampleCoding, TracePadding, Header |
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 "CriticalSection.h" | |
CriticalSection::CriticalSection() { | |
Init(); | |
} | |
CriticalSection::CriticalSection(const char * Decription) { | |
Init(); | |
_Description = Decription; | |
} |