Skip to content

Instantly share code, notes, and snippets.

View wahidshalaly's full-sized avatar

Wahid Shalaly wahidshalaly

View GitHub Profile
@joseluisq
joseluisq / stash_dropped.md
Last active July 16, 2024 11:38
How to recover a dropped stash in Git?

How to recover a dropped stash in Git?

1. Find the stash commits

git log --graph --oneline --decorate ( git fsck --no-reflog | awk '/dangling commit/ {print $3}' )

This will show you all the commits at the tips of your commit graph which are no longer referenced from any branch or tag – every lost commit, including every stash commit you’ve ever created, will be somewhere in that graph.

@scottcowan
scottcowan / move-octopus-variables.ps1
Last active November 25, 2016 17:16
Move octopus deploy variables between sets
# setup octoposh first
# http://octoposh.net/
$varset = Get-OctopusVariableSet -LibrarySetName "variable set 1" -ResourceOnly
$varset2 = Get-OctopusVariableSet -LibrarySetName "variable set 2" -ResourceOnly
$vars = $varset.Variables | ?{$_.name.StartsWith("AchievementRate")}
foreach ($var in $vars) {$varset2.Variables.Add($var)}
Update-OctopusResource -Resource $varset2
# it's important to use resource only or you'll get an error about fixed collection size
@DamianMac
DamianMac / DbUp.cs
Last active November 22, 2021 14:02
DbUp Config to exec all stored procedure scripts from a directory
var upgrader =
DeployChanges.To
.SqlDatabase(connectionString)
.JournalTo(new NullJournal()) //means the execution won't get logged, so each script is run each time
.WithScriptsFromFileSystem("D:\\mystoredprocs\\")
.LogToConsole()
.Build();
var result = upgrader.PerformUpgrade();
@aaronpowell
aaronpowell / gist:8776893
Created February 2, 2014 23:51
Delete wifi profiles in Windows
function PromptForRemoval {
param (
[string]
[Parameter(Mandatory=$true)]
$Networkname
)
$title = "Delete network $NetworkName"
$message = "Do you want to delete the wifi network named $NetworkName"