Skip to content

Instantly share code, notes, and snippets.

rm -rf ContactCentre.git/
git clone --mirror [email protected]:Askia/ContactCentre.git
cd ContactCentre.git/
git filter-branch -f --prune-empty --index-filter \
'git rm --cached -r -q -- . ; git reset -q $GIT_COMMIT -- Setups/ BuildScripts/ _Utilities/MyForceBuilder/ _MI4C\ Build\ Scripts/ ' -- --all
du . -h
git for-each-ref --format="%(refname)" refs/original/ | xargs -n 1 git update-ref -d
git reflog expire --expire=now --all
git gc --prune=now
dotnet new sln -o FxMovieAlert
dotnet new -h
dotnet new console -o Grabber
dotnet sln add .\Grabber\Grabber.csproj
dotnet new classlib -o FxMoviesDB
dotnet sln add .\FxMoviesDB\FxMoviesDB.csproj
dotnet add package Microsoft.Extensions.Configuration
dotnet add .\Grabber\ package Microsoft.Extensions.Configuration
dotnet add .\Grabber\ package Microsoft.Extensions.Configuration.Json
dotnet add package Microsoft.EntityFrameworkCore
@WimObiwan
WimObiwan / mon-ssl.sh
Last active June 7, 2020 00:57
Monitor SSL or TLS certificate using OpenSSL
#!/bin/bash
function test-ssl {
# $1: descr
# $2: server:port
# $3: (optional) StartTLS indicator: [pop3|smtp]
echo "(certificate"
echo "-\\n"
@WimObiwan
WimObiwan / CmdletBinding.ps1
Created July 19, 2018 07:29
Powershell codeblocks
<#
https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_functions_cmdletbindingattribute?view=powershell-6
https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_functions_advanced_parameters?view=powershell-6
#>
[CmdletBinding(
ConfirmImpact = "",
DefaultParameterSetName = "",
HelpUri = "",
SupportsPaging = $false,
<#
cd <waar je het script wil zetten>
$url = 'https://gist.githubusercontent.com/WimObiwan/78def2eb9b5c1254e5cbc12d7bd11e9f/raw'
wget $url -OutFile 'PhoneApps.ps1'
. .\PhoneApps.ps1
New-PhoneAppsShortcuts
#>
@WimObiwan
WimObiwan / SqlFragmentationPerIndex.sql
Last active October 29, 2018 14:45
SQL Analyze Index fragmentation
WITH fragmented_indexes AS
(
SELECT
s.name [schema], t.name [table], i.name [index], ips.page_count,
ips.avg_fragmentation_in_percent,
ips.page_count * ips.avg_fragmentation_in_percent weight
FROM sys.dm_db_index_physical_stats (DB_ID(), NULL, NULL, NULL, NULL) ips
JOIN sys.indexes i ON ips.object_id = i.object_id AND ips.index_id = i.index_id
JOIN sys.tables t ON i.object_id = t.object_id
JOIN sys.schemas s ON t.schema_id = s.schema_id
@WimObiwan
WimObiwan / AutoTask.ps1
Last active December 11, 2018 12:15
AutoTask
# one-time installation
Install-Module -Name Autotask
# initialize
Import-Module Autotask
$Credential = Get-Credential
Connect-AutotaskWebAPI -Credential $Credential
function ArrayToHash($a)
{
@WimObiwan
WimObiwan / Get-DiskUsage.ps1
Created January 21, 2019 13:51
Get-DiskUsage
function Get-DiskUsage ($Path)
{
$BIG_THRESHOLD_MB = 50
$directories = @(Get-ChildItem $Path -Directory)
function Get-DiskUsage2 ($directoryFullName, $directoryName, $recurse)
{
$items = Get-ChildItem -Recurse:$recurse $directoryFullName | ?{ -not $_.PSIsContainer } | Select Length
$measure = $items | Measure-Object Length -Sum -Average -Maximum -Minimum -StandardDeviation
@WimObiwan
WimObiwan / Remove-OldItems.ps1
Last active May 6, 2020 10:07
Remove-OldItems
# Original script located at https://gist.github.com/WimObiwan/e04d2e18c84161e2651260f4df701c07
# https://stackoverflow.com/a/40887001
function DisplayInBytes($num)
{
$suffix = "B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"
$index = 0
while ($num -gt 1kb)
{
$num = $num / 1kb