Skip to content

Instantly share code, notes, and snippets.

View shmuelie's full-sized avatar

Shmueli Englard shmuelie

View GitHub Profile
@shmuelie
shmuelie / Computers.md
Last active September 3, 2024 00:08
Computers
@shmuelie
shmuelie / Get-OneDriveFolder.psm1
Created May 30, 2017 13:00
PowerShell Scripts
function Get-OneDriveFolder
{
<#
.Synopsis
Gets the current user's OneDrive folder.
.Description
Gets the current user's OneDrive folder.
.Example
@shmuelie
shmuelie / keybase.md
Last active June 20, 2021 14:38
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 December 12, 2022 03:24
Setup Windows
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
@shmuelie
shmuelie / FixForbes.cs
Created September 8, 2016 19:57
Unblock Forbes
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 20:18
PowerShell Packaging
#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 April 20, 2016 14:33
System.Xml.Serialization.XmlSerializer Limitations in .NET Core

(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