Skip to content

Instantly share code, notes, and snippets.

View kevduc's full-sized avatar
📙
Focusing

Kevin Duconge kevduc

📙
Focusing
View GitHub Profile
@kevduc
kevduc / git-remove-large-file.sh
Created September 21, 2021 01:27
Remove large file from commit history
#From https://www.deployhq.com/git/faqs/removing-large-files-from-git-history
git filter-branch --force --index-filter 'git rm --cached --ignore-unmatch path/to/file' --prune-empty --tag-name-filter cat -- --all
@kevduc
kevduc / watch-logs.ps1
Created September 20, 2021 15:25
Watch log files inside folder and copy them when changed
# From https://stackoverflow.com/questions/29066742/watch-file-for-changes-and-run-command-with-powershell
$folder = "C:\Users\LOCAL_~1\AppData\Local\Temp\3"
$filter = "*.log"
$destination = "C:\Users\Documents"
$Watcher = New-Object IO.FileSystemWatcher $folder, $filter -Property @{
IncludeSubdirectories = $false
NotifyFilter = [IO.NotifyFilters]'FileName, LastWrite'
}
@kevduc
kevduc / ExtractIcon.ps1
Last active September 20, 2021 14:33
Extract the icon of an exe file using PowerShell
# Based on https://community.spiceworks.com/topic/592770-extract-icon-from-exe-powershell
[System.Reflection.Assembly]::LoadWithPartialName('System.Drawing') | Out-Null
[System.Drawing.Icon]::ExtractAssociatedIcon('full-path-to/file.exe').ToBitmap().Save('full-path-to/icon.ico')
const measure = (f, sampleSize, ...args) => {
const start = Date.now()
for (let i = 0; i < sampleSize; i++) f(...args)
return (Date.now() - start) / sampleSize
}
const perfDiff = (value1, value2) => (100 * (value1 - value2)/value1).toFixed(2) + '%'
const callback = (_,i) => i