Skip to content

Instantly share code, notes, and snippets.

View turibbio's full-sized avatar
💭
I'm exploring the world

turibbio turibbio

💭
I'm exploring the world
View GitHub Profile
@turibbio
turibbio / Update-VMVersion.ps1
Created January 15, 2018 22:27
Update-VMVersion
Update-VMVersion -VMName <VMName>
@turibbio
turibbio / hyperv-configuration.ps1
Created January 7, 2018 21:32
Configure Hyper-V settings
# Set VM Folder
New-Item -Path "E:\Hyper-V" -ItemType Directory
Set-VMHost -VirtualHardDiskPath 'E:\Hyper-V'
Set-VMHost -VirtualMachinePath 'E:\Hyper-V'
# Create an Internal Network
New-VMSwitch -name InternalSwitch -SwitchType Internal
@turibbio
turibbio / hyperv-installation.ps1
Created January 7, 2018 21:20
Install Hyper-V using PowerShell
Get-WindowsFeature *Hyper-V*
Install-WindowsFeature -Name Hyper-V -IncludeManagementTools -Restart
@turibbio
turibbio / WriteFormattedOutput.ps1
Created August 18, 2015 23:08
Write colored output with Powershell cmdlet Write-Output
function Write-FormattedOutput
{
[CmdletBinding()]
Param(
[Parameter(Mandatory=$True,Position=1,ValueFromPipeline=$True,ValueFromPipelinebyPropertyName=$True)][Object] $Object,
[Parameter(Mandatory=$False)][ConsoleColor] $BackgroundColor,
[Parameter(Mandatory=$False)][ConsoleColor] $ForegroundColor
)
# save the current color
@turibbio
turibbio / WriteMessages.ps1
Created August 18, 2015 16:28
Write-Host vs Write-Output
function Write-Messages
{
[CmdletBinding()]
param()
Write-Host "Host message"
Write-Output "Output message"
}
# Run with:
@turibbio
turibbio / WriteMessagesToFiles.ps1
Last active August 4, 2017 18:00
Write Log in multiple files with Powershell
function Write-Messages
{
[CmdletBinding()]
param(
[string]$warningFilePath = "C:\Temp\warning.txt",
[string]$errorFilePath = "C:\Temp\error.txt"
)
Write-Host "Host message"
@turibbio
turibbio / PostBuildEvent.ps1
Created July 21, 2015 19:53
Post Build Event
param($ProjectDir)
$TargertDir = $env:LOCALAPPDATA + "\Totem"
$OrigineRisorse = $ProjectDir + "\Resources"
$OrigineTemi = $ProjectDir + "\Themes"
$DestRisorse = $TargertDir + "\Resources"
$DestTemi = $TargertDir + "\Themes"
$OrigineLang = $ProjectDir + "\Languages"
$DestLang = $TargertDir + "\Languages"
Write-Output "Esecuzione azioni Post Build"
@turibbio
turibbio / ajaxcdn
Created April 4, 2015 12:00
Ajax CDN
<script type=”text/javascript”>
function pageLoad(){
var myPic = [
{url: ‘pic/lellone1.jpg’, description: “lellone”},
{url: ‘pic/lellone2.jpg’, description: “lellone”}
];
$create(
Sys.UI.DataView,
{data:myPic},
@turibbio
turibbio / createthumbnails
Created March 28, 2015 14:59
create thumbnails in C#
//Salva la mia foto con dimensioni normali
string myImage = Server.MapPath("~/") + "public/images/" + fuImg.FileName;
fuImg.SaveAs(myImage);
//crea e salva il thumbinail
System.Drawing.Image img = System.Drawing.Image.FromFile(myImage);
System.Drawing.Image.GetThumbnailImageAbort myCallback = new System.Drawing.Image.GetThumbnailImageAbort(ThumbnailCallback);
System.Drawing.Image myThumbnail = img.GetThumbnailImage(65, 65, myCallback, IntPtr.Zero);
myThumbnail.Save(Server.MapPath("~/") + "public/thumbs/" + fuImg.FileName);