Skip to content

Instantly share code, notes, and snippets.

@rleopold
rleopold / wifi-forget.ps1
Created November 30, 2016 21:14
a quick powershell script to make forgetting wifi networks easier
$networks = netsh wlan show profiles | select-string 'All User Profile'
if($networks.Count -gt 0) {
$(foreach ($item in $networks) {
$item.Line.Split(':')[1].Trim()
}) | Out-GridView -Title 'Select one or more neowrks to forget' -OutputMode Multiple |
foreach {
netsh wlan delete profile name = "$_"
}
}
# --------------------------------------------------------------------
# Checking Execution Policy
# --------------------------------------------------------------------
$Policy = "Unrestricted"
If ((get-ExecutionPolicy) -ne $Policy) {
Write-Host "Script Execution is disabled. Enabling it now"
Update-ExecutionPolicy $Policy
}
Import-Module WebAdministration
# with hyper-v: http://boxstarter.org/package/nr/url?https://gist.githubusercontent.com/rleopold/2c002816d5b1b9a48bbd/raw/974b6525126618d244d8a0ec08f3e89e88e9af69/chocodevbox
# http://boxstarter.org/package/nr/url?https://gist.githubusercontent.com/rleopold/2c002816d5b1b9a48bbd/raw/d9b0383eb01c2d32bb1d7a619f96b47a9b7fef57/chocodevbox
Set-WindowsExplorerOptions -EnableShowHiddenFilesFoldersDrives -EnableShowProtectedOSFiles -EnableShowFileExtensions
cinst git
cinst poshgit
cinst 7zip
cinst nodejs
@rleopold
rleopold / refExample.cs
Last active August 29, 2015 14:05
example of ref keyword in C#
// LinqPad example of ref keyword in C#
// "in c# objects are always passed by reference" -- NOT TRUE!!!
// what actually happens is that references are always passed by value!
// using the ref keyword passes the reference explicitly
void Main()
{
var s = new StringBuilder("hello");
Console.WriteLine(s.ToString());
//conway's Game of Life in F# (w/ WPF) for Linq Pad
// add refs to PresentationCore, PresentationFramework, and System.Windows
let count (a: _ [,]) x y =
let m, n = a.GetLength 0, a.GetLength 1
let mutable c = 0
for x in x-1..x+1 do
for y in y-1..y+1 do
if x>=0 && x<m && y>=0 && y<n && a.[x, y] then
c <- c + 1
if a.[x, y] then c-1 else c