Skip to content

Instantly share code, notes, and snippets.

View darinkes's full-sized avatar
🎯
Focusing

Stefan Rinkes darinkes

🎯
Focusing
View GitHub Profile
@darinkes
darinkes / GuiStateTemplate.cs
Created April 10, 2019 07:56
Avalonia Enum UserControl Content Selection
class GuiStateTemplate : DataTemplate, IDataTemplate
{
[TypeConverter(typeof(EnumConverter))]
public GuiState State { get; set; }
bool IDataTemplate.Match(object data)
{
var enumVal = (GuiState)Enum.Parse(typeof(GuiState), data.ToString());
var result = State == enumVal;
Logging.Debug(string.Format("GuiStateTemplate Match: {0} == {1} ({2})", State, enumVal, result));
@darinkes
darinkes / MyImage.cs
Last active April 8, 2019 09:23
AvaloniaUI Image with Updateable Source
using Avalonia;
using Avalonia.Controls;
using Avalonia.Media;
using Avalonia.Media.Imaging;
using Avalonia.Platform;
using System;
namespace Test.Desktop
{
public class MyImage : Control
<!--Works-->
<Image Source="resm:CrossTestAppAvalonia.Images.info2_blue.png" Width="32" Height="32" Margin="5"/>
<!--Works-->
<Image Source="resm:CrossTestAppAvalonia.Images.warning2_yellow.png" Width="32" Height="32" Margin="5"/>
<!--Works-->
<TextBox Name="textbox" Margin="5">
<i:Interaction.Behaviors>
<ia:DataTriggerBehavior Binding="{Binding MyProperty.Boolean}" ComparisonCondition="Equal" Value="true">
<ia:ChangePropertyAction TargetObject="{Binding #textbox}" PropertyName="Text" Value="info2_blue.png" />
@darinkes
darinkes / Program.cs
Created December 7, 2018 09:45
SSH.NET EC Tests
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using Renci.SshNet;
using Renci.SshNet.Common;
using Renci.SshNet.Security;
@darinkes
darinkes / ftp_no_proxy.patch
Created April 26, 2017 13:40
OpenBSD ftp(1) no proxy patch
Index: fetch.c
===================================================================
RCS file: /mount/cvsdev/cvs/openbsd/src/usr.bin/ftp/fetch.c,v
retrieving revision 1.163
diff -u -r1.163 fetch.c
--- fetch.c 7 Mar 2017 08:00:23 -0000 1.163
+++ fetch.c 26 Apr 2017 13:10:48 -0000
@@ -57,6 +57,7 @@
#include <unistd.h>
#include <util.h>
DDR Version 1.07 20161103
In
Channel 0: DDR3, 666MHz
Bus Width=32 Col=10 Bank=8 Row=15 CS=1 Die Bus-Width=16 Size=1024MB
Channel 1: DDR3, 666MHz
Bus Width=32 Col=10 Bank=8 Row=15 CS=1 Die Bus-Width=16 Size=1024MB
256B stride
ch 0 ddrconfig = 0x101, ddrsize = 0x20
ch 1 ddrconfig = 0x101, ddrsize = 0x20
pmugrf_os_reg[2] = 0x32817281, stride = 0x9
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using System.Timers;
using Renci.SshNet;
namespace SshTests
{
using System;
using System.Diagnostics;
using System.Threading.Tasks;
using System.Timers;
using Renci.SshNet;
namespace SshNetWaitHandleIssue
{
class Program
{
@darinkes
darinkes / gist:9889304
Created March 31, 2014 10:15
add the ability to catch SSH-Debug Log in your app, don't crash if Channel-Open failed, stricter privatekey regex + validation-method, various null exception fixes
diff --git a/Renci.SshNet.NET35/Renci.SshNet.NET35.csproj b/Renci.SshNet.NET35/Renci.SshNet.NET35.csproj
index 4204d96..8e160f3 100644
--- a/Renci.SshNet.NET35/Renci.SshNet.NET35.csproj
+++ b/Renci.SshNet.NET35/Renci.SshNet.NET35.csproj
@@ -144,6 +144,9 @@
<Compile Include="..\Renci.SshNet\Common\HostKeyEventArgs.cs">
<Link>Common\HostKeyEventArgs.cs</Link>
</Compile>
+ <Compile Include="..\Renci.SshNet\Common\LogEventArgs.cs">
+ <Link>Common\HostKeyEventArgs.cs</Link>
@darinkes
darinkes / gist:9889276
Created March 31, 2014 10:13
make portforwarding more stable Found while testing portforwarding with http and some real quick reloads. Port-Forwardings crashes when unable to ship data. https://sshnet.codeplex.com/discussions/446914
diff --git a/Renci.SshNet/Channels/ChannelDirectTcpip.NET40.cs b/Renci.SshNet/Channels/ChannelDirectTcpip.NET40.cs
index c0518ce..dccca76 100644
--- a/Renci.SshNet/Channels/ChannelDirectTcpip.NET40.cs
+++ b/Renci.SshNet/Channels/ChannelDirectTcpip.NET40.cs
@@ -21,7 +21,14 @@ namespace Renci.SshNet.Channels
partial void InternalSocketSend(byte[] data)
{
- this._socket.Send(data, 0, data.Length, SocketFlags.None);
+ try