Skip to content

Instantly share code, notes, and snippets.

View hifi's full-sized avatar

Toni Spets hifi

View GitHub Profile
@hifi
hifi / custom-room-upgrade.sh
Created October 11, 2021 06:50
Upgrade Matrix rooms with custom power level override for yourself (aka hijack a room with upgrade)
#!/bin/bash
set -e
mx_get() {
curl -s -H "Authorization: Bearer $TOKEN" $HS/$1
}
mx_post() {
curl -s -X POST -H "Authorization: Bearer $TOKEN" -H "Content-type: application/json" -d "$1" $HS/$2
@hifi
hifi / KeeAgent.settings
Created October 21, 2017 11:26
Sample KeeAgent settings file for automatic entries (id_rsa)
<?xml version="1.0" encoding="utf-8"?>
<EntrySettings xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<AllowUseOfSshKey>true</AllowUseOfSshKey>
<AddAtDatabaseOpen>true</AddAtDatabaseOpen>
<RemoveAtDatabaseClose>true</RemoveAtDatabaseClose>
<UseConfirmConstraintWhenAdding>false</UseConfirmConstraintWhenAdding>
<UseLifetimeConstraintWhenAdding>false</UseLifetimeConstraintWhenAdding>
<LifetimeConstraintDuration>600</LifetimeConstraintDuration>
<Location>
<SelectedType>attachment</SelectedType>
@hifi
hifi / Pipe.cs
Last active January 4, 2017 18:09
An idea for stream splitting
using System;
using System.IO;
using System.Threading;
namespace Renci.SshNet.Common
{
internal class Pipe
{
class PipeEntry
{
namespace Renci.SshNet.Common
{
using System;
using System.Collections.Concurrent;
using System.IO;
using System.Threading;
/// <summary>
/// PipeStream is a thread-safe read/write data stream for use between two threads in a
/// single-producer/single-consumer type problem.
@hifi
hifi / mgfx-loader.patch
Created October 18, 2016 13:01
MGFX loader for UltimaMono
diff --git a/dev/Core/Graphics/SpriteBatch3D.cs b/dev/Core/Graphics/SpriteBatch3D.cs
index 3860238..1a90f69 100644
--- a/dev/Core/Graphics/SpriteBatch3D.cs
+++ b/dev/Core/Graphics/SpriteBatch3D.cs
@@ -15,6 +15,7 @@
using System;
using System.Collections.Generic;
using UltimaXNA.Core.Diagnostics.Tracing;
+using System.IO;
#endregion
@hifi
hifi / gist:d7c4e3689e28df13893fc0c4fd813706
Created September 12, 2016 03:14
SSH.NET SshCommand data writing
diff --git a/src/Renci.SshNet/SshCommand.cs b/src/Renci.SshNet/SshCommand.cs
index 292f67c..23c2d46 100644
--- a/src/Renci.SshNet/SshCommand.cs
+++ b/src/Renci.SshNet/SshCommand.cs
@@ -307,6 +307,9 @@ namespace Renci.SshNet
throw new ArgumentException("EndExecute can only be called once for each asynchronous operation.");
}
+ // always send EOF when closing exec channel
+ _channel.SendEof();
@hifi
hifi / pipesocket.patch
Last active October 13, 2016 20:55
TigerVNC SSH pipe
diff --git a/common/network/Socket.h b/common/network/Socket.h
index 378a900..11a4318 100644
--- a/common/network/Socket.h
+++ b/common/network/Socket.h
@@ -43,7 +43,7 @@ namespace network {
}
rdr::FdInStream &inStream() {return *instream;}
rdr::FdOutStream &outStream() {return *outstream;}
- int getFd() {return outstream->getFd();}
+ int getFd() {return instream->getFd();}