Skip to content

Instantly share code, notes, and snippets.

View elpatron68's full-sized avatar

Markus Busche elpatron68

View GitHub Profile
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NLog;
using NLog.Common;
using NLog.Targets;
using NLog.Config;
namespace ConsoleApplication1
@elpatron68
elpatron68 / nlogtarget.vb
Last active August 29, 2015 14:24
NLog change target programmatically (VB.NET)
Imports NLog
Imports NLog.Common
Imports NLog.Targets
Imports NLog.Config
Module Module1
Private _logger As Logger
Sub Main()
Dim sToday As String = DateTime.Today.ToString("yyyy-MM-dd")
@elpatron68
elpatron68 / check_client_tcp_port.vb
Created July 10, 2015 12:25
VB.NET: Check if a TCP Port on a remote site answers requests
Imports System.Net.Sockets
Private Function _CheckTCPPort(ByVal sIPAdress As String, ByVal iPort As Integer, Optional ByVal iTimeout As Integer = 5000)
Dim socket As New Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)
' Connect using a timeout (default 5 seconds)
Dim result As IAsyncResult = socket.BeginConnect(sIPAdress, iPort, Nothing, Nothing)
Dim success As Boolean = result.AsyncWaitHandle.WaitOne(iTimeout, True)
If Not success Then
' NOTE, MUST CLOSE THE SOCKET

Keybase proof

I hereby claim:

  • I am elpatron68 on github.
  • I am elpatron (https://keybase.io/elpatron) on keybase.
  • I have a public key whose fingerprint is 3C14 012F C32F 179A 57F2 0CA9 3AB2 AA2D 932F 5B6F

To claim this, I am signing this object:

@elpatron68
elpatron68 / Module1.vb
Last active April 3, 2020 06:59
Posts Text to a defined Mattermost webhook (VB.NET)
Imports mattermost_webhook_connector.net
Module Module1
Sub Main()
Dim res As String = mattermost._post2Mattermost(New Uri("https://<your webhook URL goes here>"), _
"Hey dude", "god of dotnet", "")
Debug.WriteLine("Response: " + res)
End Sub
#!/usr/bin/env python
__author__ = "[email protected]"
# This program lets your blink1 device blink whenever Pi-hole has filtered ads
# Have fun.
# blink1 commandline tool: https://github.com/todbot/blink1/blob/master/docs/blink1-tool.md
# Pi-hole https://github.com/pi-hole/pi-hole
# To start this as a service I would recommend using supervisord
@elpatron68
elpatron68 / cpupdate.bat
Last active December 4, 2016 12:23
Batch script for automatic update of Courseplay (https://github.com/Courseplay/courseplay)
@echo off
rem This script updates the mod "Courseplay" for Farming Simulator 17
rem Copy this file to a folder of your choice and run in from time to time.
rem
rem Backups will be stored as ZIP files in a subfolder .\cpbackup
rem
rem =============================================================================
rem I M P O R T A N T N O T I C E
rem =============================================================================
rem Git for Windows and 7-Zip have to be installed and reside in your PATH!
@elpatron68
elpatron68 / WinRemoteShutdown.py
Last active March 4, 2017 13:27
Simple http server for remotely setting Windows into hybernate mode or shutting it down
#!/usr/bin/env python
# Simple http server for remotely set Windows into hybernate mode or shutting it down
# (c) 2017 Markus Busche, [email protected]
#
# Requirements
# I tested this script with Python 3.6. It should also run with Python 2.x with some slight modifications.
# No 3rd party packages are required.
#
# Usage:
# Start this script on your Windows machine and let in run in background.
@elpatron68
elpatron68 / __main__.py
Created July 15, 2017 17:20
Ssh-upload Racing Room dedicated server result files for use with simresults.net
import os
import paramiko
from paramiko import SSHClient
from scp import SCPClient
from datetime import datetime
import webbrowser
# Constants (Settings)
SERVERADDRESS = '<Web server ip or domain name>'
SSHUSER = '<Ssh user name>'
@elpatron68
elpatron68 / ReCoNe.au3
Last active October 19, 2018 13:14
Recover formerly connected network drives after the Windows start or logon
; Recover formerly connected network drives after the Windows start or logon
; (c) 2018 M. Busche, [email protected]
;
; License: CC-BY 4.0 (https://creativecommons.org/licenses/by/4.0/)
;
;
; Usage:
; (1) Make sure that all your network drives are connected
; (2) Start 'SaveConnectedDrivesList.exe' - all connected drive letters will be saved to a text file (%AppData%\networkdrives.txt)
; See https://gist.github.com/elpatron68/6085800017d39b8cf1090c9398fb8f47 for SaveConnectedDrivesList