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 / 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, markus@butenostfreesen.de
#
# 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>'
; See https://gist.github.com/elpatron68/cb1f9f69577e33998df7b4fbf2e1f8c7
#pragma compile(Out, ..\SaveConnectedDrivesList.exe)
#pragma compile(LegalCopyright, "© Markus Busche elpatron@mailbox.org")
#pragma compile(Icon, configure-2.ico)
#include <AutoItConstants.au3>
#include <MsgBoxConstants.au3>
#include <File.au3>
$mAnswer = MsgBox (4, "ReCoNe" ,"Are all network drives connected at this moment?")
@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, markus@butenostfreesen.de
;
; 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
# converts iso encoded text file to utf-8
import codecs
def convertfromiso(iso_filename, uft8_filename):
data = codecs.open(iso_filename, 'r', 'iso-8859-1').read()
codecs.open(uft8_filename, 'w', 'utf-8').write(data)
def main():
convertfromiso('isofile.txt', 'new-utf8-file.txt')