Skip to content

Instantly share code, notes, and snippets.

Avatar

Shmueli Englard shmuelie

View GitHub Profile
@shmuelie
shmuelie / chocolatey.log
Created Sep 3, 2021
Failing to upgrade Chocolatey from 0.11.0 to 0.11.1 with pro license
View chocolatey.log
2021-09-03 11:28:46,031 27804 [DEBUG] - XmlConfiguration is now operational
2021-09-03 11:28:46,062 27804 [DEBUG] - Evaluating license file found at 'C:\ProgramData\chocolatey\license\chocolatey.license.xml'
2021-09-03 11:28:46,109 27804 [DEBUG] - [Licensing] License expiration date is 04/27/2022 00:00:00
2021-09-03 11:28:47,319 27804 [DEBUG] - [Licensing] License expiration date is 04/27/2022 00:00:00
2021-09-03 11:28:47,413 27804 [DEBUG] - Loading Licensed Extensions and Commands
2021-09-03 11:28:47,506 27804 [INFO ] - ============================================================
2021-09-03 11:28:47,694 27804 [DEBUG] - [Licensing] License expiration date is 04/27/2022 00:00:00
2021-09-03 11:28:47,819 27804 [INFO ] - Chocolatey v0.11.0 Professional
2021-09-03 11:28:47,819 27804 [DEBUG] - Chocolatey is running on Windows v 10.0.19043.0
2021-09-03 11:28:47,819 27804 [DEBUG] - Attempting to delete file "C:/ProgramData/chocolatey/choco.exe.old".
View Desktops.md
View Get-OneDriveFolder.psm1
function Get-OneDriveFolder
{
<#
.Synopsis
Gets the current user's OneDrive folder.
.Description
Gets the current user's OneDrive folder.
.Example
View keybase.md

Keybase proof

I hereby claim:

  • I am shmuelie on github.
  • I am shmuelie (https://keybase.io/shmuelie) on keybase.
  • I have a public key whose fingerprint is 5E6F 469D 9CFA 4573 CDAB 7422 4805 122F E963 542E

To claim this, I am signing this object:

@shmuelie
shmuelie / choco.bat
Last active Jun 20, 2021
Setup Windows
View choco.bat
chocolatey install -y 7zip adb chocolatey-core.extension chocolatey-windowsupdate.extension discord docfx elevate.native exiftool ffmpeg fiddler Firefox gimp git.portable gradle jq mkvtoolnix msbuild-structured-log-viewer obs-virtualcam pdfsam python3 scrcpy sysinternals visualstudiocode-disableautoupdate vlc vscode vswhere adoptopenjdk audacity cpu-z hwmonitor nodejs obs-studio rufus twitch powertoys intellijidea-community
View FixForbes.cs
var b,c,d=new Date(+new Date+2592e11),e=Cookies.getJSON("global_ad_params")||{};e.ab={value:"off",expiration:d.getTime()},b=_.isUndefined(urlParams.force_ab)?Cookies.get("forbes_ab"):urlParams.force_ab.toUpperCase(),c=b&&b[0].match("A")?b[0]:"A",Cookies.set("forbes_ab",c,_.merge({expires:d})),Cookies.set("global_ad_params",e,_.merge({expires:d})),a?(Cookies.set("welcomeAd",!0,_.merge({expires:d})),Cookies.set("dailyWelcomeCookie",!0,_.merge({expires:d}))):(Cookies.remove("welcomeAd"),Cookies.remove("dailyWelcomeCookie"));
@shmuelie
shmuelie / package.ps1
Created May 16, 2016
PowerShell Packaging
View package.ps1
#Package Current Folder
Get-ChildItem .\ -File -Recurse -Force | select @{"Label"="Name";Expression={$_ | Resolve-Path -Relative}},@{"Label"="Data";Expression={[convert]::ToBase64String(($_ | Get-Content -Encoding byte -ReadCount 0))}} | ConvertTo-Json | Set-Content .\Package.json
#Unpackage
Get-Content .\Package.json | ConvertFrom-Json | ForEach-Object { Set-Content -Encoding Byte -Value ([convert]::FromBase64String($_.Data)) -Path $_.Name }
@shmuelie
shmuelie / Issue.md
Created Apr 20, 2016
System.Xml.Serialization.XmlSerializer Limitations in .NET Core
View Issue.md

(Note: Code is using .NET Core and ASP.NET Core that is in VS 2015 Update 2)

When you want to return XML in ASP.NET Core the Microsoft.AspNet.Mvc.Formatters.XmlSerializerOutputFormatter is used. Internally XmlSerializerOutputFormatter uses System.Xml.Serialization.XmlSerializer to actually serialize the .NET Objects into XML. Unfortunaly XmlSerializer has some limitations, particularly around serializing collections. To solve this a concept of "wrappers" was introduced. Wrappers replace an object of type A with type AWrap and AWrap provides all the same data but is XmlSerializer safe. ASP.NET Core comes with a wrapper for collections built in. However, to use it you must write you own wrappers for your classes that consume it when they have collections.

Instead of creating wrappers for a complex and growing object model, I created a system that uses type generation at runtime to create wrappers for types as needed. Unfortunately some limitations in .NET Core made this more complex then somet