Skip to content

Instantly share code, notes, and snippets.

@myd7349
myd7349 / svn-to-git.md
Created October 10, 2024 12:27 — forked from barrysteyn/svn-to-git.md
Migrate From SVN To GIT
@myd7349
myd7349 / dotnetlayout.md
Created August 27, 2024 12:54 — forked from davidfowl/dotnetlayout.md
.NET project structure
$/
  artifacts/
  build/
  docs/
  lib/
  packages/
  samples/
  src/
 tests/
@myd7349
myd7349 / REAMDE.md
Created August 8, 2024 07:39 — forked from msymt/REAMDE.md
C# to C IPC with memory mapped file

MappedMemory: C# to C

  1. From console create file: dd if=/dev/zero of=/tmp/sharedfile bs=12288 count=1
  2. The C# program
  3. The C program

usage

mcs Sender.cs
# install tools
sudo apt-get install pkg-config cmake
# install dependencies
sudo apt-get install \
libssh2-1-dev \
libssl-dev \
zlib1g-dev \
libncurses5-dev \
libncursesw5-dev \
@myd7349
myd7349 / CastingHelper.cs
Created July 23, 2024 08:37 — forked from 13xforever/CastingHelper.cs
Casting array of bytes to struct and vice versa in C#
public static class CastingHelper
{
public static T CastToStruct<T>(this byte[] data) where T : struct
{
var pData = GCHandle.Alloc(data, GCHandleType.Pinned);
var result = (T)Marshal.PtrToStructure(pData.AddrOfPinnedObject(), typeof(T));
pData.Free();
return result;
}
@myd7349
myd7349 / SHCopy.cpp
Created July 11, 2024 06:59 — forked from mqudsi/SHCopy.cpp
SHFileOperation for recursive folder copy
bool SHCopy(LPCTSTR from, LPCTSTR to)
{
Log(_T("Recursive file copy from %s to %s"), from, to);
SHFILEOPSTRUCT fileOp = {0};
fileOp.wFunc = FO_COPY;
TCHAR newFrom[MAX_PATH];
_tcscpy_s(newFrom, from);
newFrom[_tcsclen(from) + 1] = NULL;
fileOp.pFrom = newFrom;
@myd7349
myd7349 / chat.lua
Created July 3, 2024 02:05 — forked from StephenCleary/chat.lua
Starting point for a custom TCP Wireshark dissector in Lua
-- authors: Hadriel Kaplan <hadriel@128technology.com>, Stephen Cleary
-- Copyright (c) 2015-2022, Hadriel Kaplan, Stephen Cleary
-- This code is in the Public Domain, or the BSD (3 clause) license if Public Domain does not apply in your country.
-- Thanks to Hadriel Kaplan, who wrote the original FPM Lua script.
-- This is a starting point for defining a dissector for a custom TCP protocol.
-- This approach assumes that each message has a header that indicates the message length.
-- The code in this example uses a 4-byte header which is just a 4-byte big-endian message length,
-- and this length does not include the length of the header.
-- Modify the sections marked TODO to adjust these assumptions.
@myd7349
myd7349 / c#part
Created June 27, 2024 07:36 — forked from joemaidman/c#part
WPF datagrid tooltip for hidden text
public class TrimmedTextBlockVisibilityConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
if (value == null) return Visibility.Collapsed;
FrameworkElement textBlock = (FrameworkElement)value;
textBlock.Measure(new System.Windows.Size(Double.PositiveInfinity, Double.PositiveInfinity));
@myd7349
myd7349 / unicorn2lsl.py
Created June 3, 2024 08:37 — forked from robertoostenveld/unicorn2lsl.py
This is a native python implementation to stream data from a Unicorn EEG system to LSL. It works on macOS, Linux and Windows.
#!/usr/bin/env python
# Unicorn2lsl streams data from a Unicorn Hybrid Black EEG system to LSL
#
# Copyright (C) 2022 Robert Oostenveld
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.