0 Comments

I am using https://github.com/Lone-Coder/letsencrypt-win-simple for a while now and moved to 1.9.5.1 today. It has a great new feature. Updating my webapplications was done by changing the path in IIS

For instance: C:/www/website1/20170918 had a newer version in C:/www/website1/20170919 So I just changed the path in IIS and could revert back to the older version in seconds. The Let’s Encrypt application got confused by this, because it stored the path in the registry. The latest version checks the IIS meta database for the current path, which is really nice for me.

But back on topic: The Asp.Net forms auth can be an issue. When the Let’s Encrypt tries to reach the .well-know dir, it get’s a redirect to the configured login page.

I tried to fix this by excluding the well-known dir in my web.config but that broke my web applciation (error 500)

I have also tried to escape the . (dot)

<location path=".well-known">
     <system.web>
       <authorization>
         <allow users="*" />
       </authorization>
     </system.web>
   </location>

Like this:

<location path="\.well-known">
     <system.web>
       <authorization>
         <allow users="*" />
       </authorization>
     </system.web>
   </location>

But that also gave me the 500 error. So The only workaround I could think of was to temporarily comment out some lines:

<authentication mode="Forms">
       <forms name=".ASPXAUTH" loginUrl="Login.aspx" protection="All" path="/" timeout="120" defaultUrl="Index.aspx" slidingExpiration="true" />
     </authentication>
     <authorization>
       <deny users="?" />
       <allow users="*" />
     </authorization>

And ran the letsencrypt.exe follow the wizard, and uncomment the part again and save the web.config. Please contact me if you have a better or more permanent solution by mail or tweet.

Good luck!

Pin on pinterest Plus on Googleplus Post on LinkedIn
0 Comments

My Surface Pro 3 died last October which had my bitcoin wallet on it. I forgot that I had any. I had bought them a (long) time ago for about 10 euro if I remember it correctly. But since the hardware crash of my sp3, the rate went up. Way up….

snip_20170809160659

I decided to look into my backup and try to restore my wallet to see how much I had and how much it’s worth today. I had multibit classic in the beginning and upgraded to multibit HD 0.5.x back then. During the move from classic to HD I forgot my wallet words and only had my password and the backup AES wallet files.

I started my first recovery attempt on may 30th, but failed because I had no wallet words.

My second try was last week as I found this GitHub repo with a python script which can extract words from a backup file if you have the password. Sort of brute force “attack”. https://github.com/gurnec/decrypt_bitcoinj_seed

So I installed python 2.7.x alongside with 3.6 which I already had. and ran the PowerShell script.

I had a Windows 7 style backup by the way of my Win10 device and had to navigate to “C:\Users\myUsername\AppData\Roaming\MultiBitHD” and restored the full content of that folder to a new folder on my desktop. Please do not forget to check the box to have the original folders restored. Otherwise it will replace files with the same name and path references will be broken.

But somewhere in the mutlibithd is the rolling backup which you can restore once you have your password and wallet words…. so I thought.

But the amount stayed unconfirmed. So it’s useless. I have seen a lot of people with this exact same issue. Some moved away from multibitHD just because of this. The solution was not that obvious. It also did not work for everyone.

I had to downgrade to MultiBit HD 0.1.1 https://multibit.org/releases/multibit-hd/multibit-hd-0.1.1/

and renamed “C:\Users\myUsername\AppData\Roaming\MultiBitHD” to “C:\Users\myUsername\AppData\Roaming\MultiBitHD-old” and re-restored the wallet with the password, wallet words and backup file.

snip_20170809162115

It is weird to have the old 0.1 version, but I am glad that it is confirmed again and in my wallet. Now I can step away to alternative wallets.


Good luck!

Pin on pinterest Plus on Googleplus Post on LinkedIn
0 Comments

Back in 2012, I found some code online which should have been a Nuget package. I tried to reach out to the original author (even searched for him/her today) but could not find any contact info.

That person created a library to generate QR codes. I packaged it for nuget which was just 1,5 years old back then.

The package is still out there. I don’t have any code on my system for years from that lib. But you can still grab the package here: https://www.nuget.org/packages/MessagingToolkit.QRCode/ 

Or from the package manager in Visual Studio with:

Install-Package MessagingToolkit.QRCode

It has been downloaded over 61.000 times now! So Twitt88 did a great job coding it!


I am porting an other 4 to 6 year old library to .Net Standard 1.4. The current status is up on GitHub https://github.com/jphellemons/PhotoBucketNetStandard

And the Nuget package has been submitted. This one is originally build by Mark Schall so most of the credits are for him. I only rewrote the stuff that is not available in .Net Standard or requires other namespaces.


Let’s all port libs to .Net Standard!

Good luck!

Pin on pinterest Plus on Googleplus Post on LinkedIn
0 Comments


For one of my hobby projects, I wanted to have my source code under source control. Professionally I use VSTS (Visual Studio Team Services) https://www.visualstudio.com/team-services/pricing/ which is great. But this is a hobby project which I code alone. So I did a git init and committed it locally.

I moved the complete Visual Studio solution + project (folder) and hidden .git folder to OneDrive and the cpu started to heat up. OneDrive keeps syncing and uses a lot of cpu. I tried to exclude the .git folder, but that did not help.

So what is the solution?

  1. Move the full folder inc .git hidden dir outside OneDrive
  2. git init –bare c:\Users\youruser\OneDrive\reponame.git
  3. in the dir outside OneDrive: git remote add onedrive c:\Users\youruser\OneDrive\reponame.git
  4. git push –u onedrive master

Do not forget to push sometimes to the remote. Or use in Visual Studio the “commit & push” button.

Thanks to Qiuwen Chen for pointing me in the right direction.


Good luck!

Pin on pinterest Plus on Googleplus Post on LinkedIn

It all starts with installing Windows 10 IoT on a suitable device. I used a Raspberry Pi 2 (Model B) and installed the creators update of Windows 10 IoT. You should really get the dashboard from Microsoft: https://developer.microsoft.com/en-us/windows/iot/downloads

snip_20170504105939

It is really easy to get Windows 10 IoT on your device. Here is a small manual https://developer.microsoft.com/en-us/windows/iot/docs/iotdashboard

snip_20170504111010

If you have your Visual Studio 2017 configured, you can easy deploy to it.

The hardware

I bought stuff from aliexpress. I had no rush, so saved a lot of money Smile

I was inspired by this article https://www.modmypi.com/blog/raspberry-pi-plant-pot-moisture-sensor-with-email-notification-tutorial but that referenced to a moisture sensor for 4 gbp and shipping was also 4 gbp. So just the sensor could cost me 9,40 eur. Which makes it less fun, because the whole idea of a raspberry pi is that you can make an internet of things device with little costs.

 

I spend only 42 cent on the sensor and bought some male/female, male/male, female/female jumper cables too and even an hdmi to dvi connector so I could connect an external monitor, but never used it.

Ali Url snip_20170504112536

€ 0,42

Ali Url snip_20170504112647

€ 2,19

Ali Url snip_20170504113017

€ 1,14

(optional)

So I had to spend € 2,61 euro including shipping to get the parts for my Pi 2.

Hardware wiring

Connect the probe to the sensor with two wires. Doesn’t matter which goes where.

Connect the sensor to the GPIO

VCC 3v3 Pin 1
GND GND Pin 9
D0 GPIO 17 Pin 11

 

WP_20170406_17_01_50_Pro

WP_20170406_17_01_40_Pro

WP_20170406_17_01_26_Pro

WP_20170406_17_01_13_Pro

this is a good page for gpio pins: http://www.raspberrypi-spy.co.uk/2012/06/simple-guide-to-the-rpi-gpio-header-and-pins/

snip_20170504134958

Software

I hit a strange bug with the UWP but fixed it, thanks to stack overflow, by manual creating a project.json file. As said, I was inspired by this article but that is coded in Python. My preference language is still C# and I wanted to try win 10 iot. So I rewrote this python code to C# and got this: 

 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net.Http;
using Windows.ApplicationModel.Background;
using Windows.Devices.Gpio;
using Windows.UI.Core;
using System.ServiceModel;
using LightBuzz.SMTP;
using Windows.ApplicationModel.Email;

namespace BackgroundApplication1
{
    public sealed class StartupTask : IBackgroundTask
    {
        private const int SENSOR_PIN = 17;
        private GpioPin pinSensor;
        private BackgroundTaskDeferral deferral;

        private const string SMTP_SERVER    = "smtp-mail.outlook.com";
        private const string STMP_USER      = "YOURPLANTSADDRESSHERE@hotmail.com";
        private const string SMTP_PASSWORD  = "YOURPASSWORDHERE";
        private const int    SMTP_PORT      = 587;
        private const bool   SMTP_SSL       = false;

        private const string MAIL_RECIPIENT = "iwillwatertheplants@hotmail.com";

        public void Run(IBackgroundTaskInstance taskInstance)
        {
            deferral = taskInstance.GetDeferral();

            taskInstance.Canceled += TaskInstance_Canceled;

            var gpio = GpioController.GetDefault();

            if (gpio != null)
            {
                pinSensor = gpio.OpenPin(SENSOR_PIN);

                var r = pinSensor.Read();

                pinSensor.SetDriveMode(GpioPinDriveMode.Input);

                var dm = pinSensor.GetDriveMode();

                pinSensor.DebounceTimeout = TimeSpan.FromMilliseconds(50);

                pinSensor.ValueChanged += PinIn_ValueChanged;
            }
        }

        private void PinIn_ValueChanged(GpioPin sender, GpioPinValueChangedEventArgs args)
        {
            if (pinSensor.Read() == GpioPinValue.High)
                SendMail("Thirsty", "Plant needs water");
            else
                SendMail("I am good", "Plant is fine again");
        }

        private async void SendMail(string subject, string body)
        {
            using (SmtpClient client = new SmtpClient(SMTP_SERVER, SMTP_PORT, SMTP_SSL, STMP_USER, SMTP_PASSWORD))
            {
                EmailMessage emailMessage = new EmailMessage();

                emailMessage.To.Add(new EmailRecipient(MAIL_RECIPIENT));
                emailMessage.Subject = subject;
                emailMessage.Body = body;

                await client.SendMailAsync(emailMessage);
            }
        }

        private void TaskInstance_Canceled(IBackgroundTaskInstance sender, BackgroundTaskCancellationReason reason)
        {
            pinSensor.Dispose();
        }
    }
}

I used the nuget "lightbuzz-smtp" to send mail https://github.com/LightBuzz/SMTP-WinRT

Have fun with Windows 10 IoT raspberries etc.

Pin on pinterest Plus on Googleplus Post on LinkedIn