Posts

Showing posts from 2018

Elementary school math with Kids... using PowerShell

Image
I attended a parent-teacher conference this week in my kids' school. Interesting enough the school now evaluates students' math level with an online services, which claimed to provide real-time feedback to teacher. Needless to say, kids have areas to improve. I came home that night and decided to play some math games with my kids. I started my saying random numbers and challenged kids to add or subtract those numbers. Like... "Let me challenge you with this question.... 17 + 12?" Soon, I started to repeat numbers and also forgot about the number I just said! 🤦‍♂️ So... I whispered to myself, there is nothing can't be done with a little bit determination and PowerShell. I started off by using the Get-Random to get random numbers between 1 and 30. Then decided to have PowerShell just generate the questions for me. PS C:\Users\l> Get-Random -Minimum 1 -Maximum 30 7 PS C:\Users\l> Write-Host "$(Get-Random -Minimum 1 -Maximum 30) + $(Get-Random -Min

When TLS 1.2 breaks Invoke-Webrequest

Image
Update[7/16/18]: Marc R Kellerman kindly shared his approach on twitter with me today: [Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType].GetEnumValues() It works as we can pass an array of values to the Net.ServicePointManager.  I think this is nicely done! Thank you so much Marc!  Head over to  Marc's twitter and blog  for more good information! With more websites moving to TLS 1.2 only, I find using Invoke-WebRequest from Windows PowerShell becomes less reliable because Windows PowerShell's defaults to using Ssl3 and TLS1.0. In this post I am going to share how I worked around the challenge in Windows PowerShell. Very importantly, if you can use PowerShell Core 6 for Invoke-WebRequest, do it. The cmdlet is much improved in PowerShell Core 6 thanks to Mark Karus . So over the past weekend, I was learning about English and was experimenting to parse the Princeton university's WordNet site  with PowerShell. However, I got this bleedin

Mini steps to learning data structure and algorithm with PowerShell

I have been reading and learning on the data structure and a little bit of algorithm since PowerShell Summit 2018. I chatted with phenomenal folks at the Summit and that experience really deepen my attention to PowerShell's language implementation. Now I am so curious on why hash table is preferable, why list is more recommended than array and why performance varies....so many why. I decided to build my Computer Science fundamentals to help answering some of these questions. The first few chapters of the data structure book I am reading talks about the sequential list, linked list, double linked list, circular list, stack, and queue. Amazing to see how the great minds in Computer Science solved hard challenges like finding the correct value in the memory. Today, the stack section talked about the Fibonacci number . I wondered how I would calculate the series using PowerShell.... Below are my initial attempts. One using recursion and the other with iteration. Interesting that it