Skip to content

Instantly share code, notes, and snippets.

View cloudchristoph's full-sized avatar
🏠
Working from home

Christoph Vollmann cloudchristoph

🏠
Working from home
View GitHub Profile
@cloudchristoph
cloudchristoph / chat.sh
Created July 19, 2023 11:45
Chat directly from command line ▶️ ./chat.sh 'Hello Llama!'
View chat.sh
# Prerequisite: https://gist.github.com/adrienbrault/b76631c56c736def9bc1bc2167b5d129
export MODEL=llama-2-13b-chat.ggmlv3.q4_0.bin
# Check if command line argument is given
if [ $# -eq 0 ]; then
echo "Prompt: " &&
read PROMPT
else
PROMPT=$1
@cloudchristoph
cloudchristoph / main.bicep
Last active November 5, 2021 14:33
Bicep - nested loop with module
View main.bicep
param sbNamespaceName string = 'sbnamespace'
param topics array = [
{
name: 'topic1'
subscriptions: [
'sub1.1'
'sub1.2'
]
}
{
@cloudchristoph
cloudchristoph / FirstFreeSlot.ps1
Last active June 15, 2021 14:19
Prüft die Impfterminseite von Magdeburg auf neue Termine
View FirstFreeSlot.ps1
while ($true) {
$freeslotData = Invoke-WebRequest -Uri "https://impfzentrum.termin-direkt.de/rest-v2/api/Calendars/8/FirstFreeSlot" -Headers @{
"method" = "GET"
"authority" = "impfzentrum.termin-direkt.de"
"scheme" = "https"
"path" = "/rest-v2/api/Calendars/8/FirstFreeSlot"
"sec-ch-ua" = "`" Not;A Brand`";v=`"99`", `"Google Chrome`";v=`"91`", `"Chromium`";v=`"91`""
"dnt" = "1"
"sec-ch-ua-mobile" = "?0"
"user-agent" = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.101 Safari/537.36"
@cloudchristoph
cloudchristoph / mytemplate.bicep
Created September 6, 2020 10:40
Azure Bicep - Erstes Template
View mytemplate.bicep
param location string = resourceGroup().location
param environment string = 'dev'
param appName string = 'myapp'
var storageAccountName = 'st${appName}${environment}'
resource MyStorageAccount 'Microsoft.Storage/storageAccounts@2019-06-01' = {
name: storageAccountName
location: location
kind: 'Storage'
sku: {
@cloudchristoph
cloudchristoph / Update-AzModules.ps1
Created May 28, 2020 07:18
Script for updating all AZ PowerShell Modules at once
View Update-AzModules.ps1
# Source: https://robertsmit.wordpress.com/2020/05/27/update-all-az-azure-powershell-modules-powershell-azure-script-modules/
# Author: Robert Smit
Get-Module -Name az.* -ListAvailable |
Where-Object -Property Name -ne 'Az.' |
ForEach-Object {
$currentVersion = [Version] $_.Version
$newVersion = [Version] (Find-Module -Name $_.Name).Version
if ($newVersion -gt $currentVersion) {
Write-Host -Object "Updating $_ Module from $currentVersion to $newVersion"
Update-Module -Name $_.Name -RequiredVersion $newVersion -Force
View GetWebSizes.ps1
function GetWebSizes ($StartWeb)
{
$web = Get-SPWeb $StartWeb
[long]$total = 0
$total += GetWebSize -Web $web
$total += GetSubWebSizes -Web $web
$totalInMb = ($total/1024)/1024
$totalInMb = "{0:N2}" -f $totalInMb
$totalInGb = (($total/1024)/1024)/1024
$totalInGb = "{0:N2}" -f $totalInGb
@cloudchristoph
cloudchristoph / DCGracefulShutdown.ps1
Last active July 19, 2017 14:15
Gracefully shutdown the Distributed Cache Instance on the server; SharePoint 2013, SharePoint 2016
View DCGracefulShutdown.ps1
# Source: https://technet.microsoft.com/en-us/library/jj219613.aspx?f=255&MSPPError=-2147217396#graceful
# changed it to dynamic hostname
# Run this on the Cache Host that should be stopped
$hostName = [System.Net.Dns]::GetHostByName(($env:COMPUTERNAME)).HostName
$startTime = Get-Date
$currentTime = $startTime
$elapsedTime = $currentTime - $startTime
View MoveSearchComponents_Traditional2Streamlined.ps1
asnp *share*
$wfeServerName = "SP2016-1"
$appServerName = "SP2016-2"
$ssa = Get-SPEnterpriseSearchServiceApplication
$active = Get-SPEnterpriseSearchTopology -SearchApplication $ssa -Active
$clone = New-SPEnterpriseSearchTopology -SearchApplication $ssa -Clone –SearchTopology $active
View StartStopDevVMs.ps1
# Change VM names to your own names
$baseVMs = @("ROUTER","AD")
$sqlVMs = @("SPSQL2016")
$sharepointVMs = @("SP2016-1","SP2016-2")
# -------------------------------------------------------------------------------------------------
function Start-VMSet($vmSet){
View RunAllHealthAnalyzerTimerJobs.ps1
asnp *share*
write-host "Getting timerjob definitions..."
$jobs = Get-SPTimerJob | ? {$_.Title -like "Health Analysis Job*"}
if (!$jobs -or $jobs.Count -eq 0) {
# Maybe in German? :)
$jobs = Get-SPTimerJob | ? {$_.Title -like "Integritätsanalyseauftrag*"}
}