Skip to content

Instantly share code, notes, and snippets.

View auberginehill's full-sized avatar

auberginehill

View GitHub Profile
@auberginehill
auberginehill / Disable-Defrag.ps1
Last active November 4, 2023 13:39
A Windows PowerShell script for disabling the automatic disk defragmentation.
<#
Disable-Defrag.ps1
#>
# Requires administrator rights
# Note: This script is mainly intended to use with systems with SSD drives, and is not particularly well suitable for systems with "traditional" HDD drives (with rotating disks).
# Note: The computer will be automatically rebooted at the end of this script (the first Step 5)
$path = $env:temp
$empty_line = ""
@auberginehill
auberginehill / Get-PowerShellSpecialFolders.ps1
Last active October 9, 2023 00:11
Retrieves Special Folders' names and corresponding paths along with the environment variable values in Windows PowerShell, and displays the generated commands used to get each value.
<#
Get-PowerShellSpecialFolders.ps1
#>
# Create an array that contains commands, how to get a particular special folder, and the values (paths) that they produce
$special_folders = @()
$names = [Environment+SpecialFolder]::GetNames([Environment+SpecialFolder]) | Sort
ForEach ($name in $names) {
@auberginehill
auberginehill / Rename-Files.ps1
Last active December 30, 2022 22:51
A Windows PowerShell script for renaming files.
<#
Rename-Files.ps1
#>
# Find all wmv-files with a string "oldstring" and replace "oldstring" with "newstring" in the filename
Get-ChildItem *.wmv -Filter "*oldstring*" | ForEach { Rename-Item $_ -NewName $_.Name.Replace("oldstring","newstring") }
# Change the file extension of all .jpeg files to .jpg
@auberginehill
auberginehill / gapps-config.txt
Last active March 28, 2021 16:27
Open GApps installer configuration file (Android)
### Open GApps installer Options
#
# File Name: .gapps-config (takes precedence, filename begins with a dot )
# gapps-config.txt
# .gapps-config-DEVICENAME Device-specific config files will take precedence over the non-device-specific ones.
# The DEVICENAME can be found in open_apps_log.txt or in the name of the ROM download.
# gapps-config-DEVICENAME.txt Device-specific config files will take precedence over the non-device-specific ones.
# The DEVICENAME can be found in open_apps_log.txt or in the name of the ROM download.
#
@auberginehill
auberginehill / Boston Celtics Regular Season Schedule 2018-19.md
Last active December 16, 2019 16:01
Boston Celtics Regular Season Schedule 2018-19 in table format including NBA League Pass Premium game links and box score links.
# Date Opponent Type Time NBA Box Score National TV
1 Tue, Oct 16 Philadelphia 76ers Home 8 p.m. https://watch.nba.com/game/20181016/PHIBOS https://www.basketball-reference.com/boxscores/201810160BOS.html TNT
2 Fri, Oct 19 Toronto Raptors Away 8 p.m. https://watch.nba.com/game/20181019/BOSTOR https://www.basketball-reference.com/boxscores/201810190TOR.html
3 Sat, Oct 20 New York Knicks Away 7:30 p.m. https://watch.nba.com/game/20181020/BOSNYK https://www.basketball-reference.com/boxscores/201810200NYK.html
4 Mon, Oct 22 Orlando Magic Hom
@auberginehill
auberginehill / Convert-JsonToCsv.ps1
Last active July 26, 2019 10:25
Converts a certain JSON-file (from the current directory) into a CSV-file to the Temp-folder (a Windows PowerShell script).
<#
Convert-JsonToCsv.ps1
#>
# Establish common parameters
$ErrorActionPreference = "Stop"
$path = $env:temp
$enumeration = @()
$counter = 0
@auberginehill
auberginehill / CDS_SCPD.xml
Last active May 17, 2019 12:49
Panasonic Lumix LX10/LX15 settings
<?xml version="1.0"?>
<scpd
xmlns="urn:schemas-upnp-org:service-1-0">
<specVersion>
<major>1</major>
<minor>0</minor>
</specVersion>
<actionList>
<action>
<name>GetSearchCapabilities</name>
@auberginehill
auberginehill / Sync-WindowsTime.ps1
Last active April 10, 2019 14:39
Syncs Windows Time from an External Time Source (a Windows PowerShell script).
<#
Sync-WindowsTime.ps1
#>
# Requires administrator rights
$empty_line = ""
# Check if the PowerShell session is elevated (has been run as an administrator)
@auberginehill
auberginehill / Download-NikonAGPSUpdateFile.ps1
Last active February 22, 2019 06:04
Downloads the most recent Nikon A-GPS update file (NMT_14A.ee) from Nikon to $env:temp (a Windows PowerShell script).
<#
Download-NikonAGPSUpdateFile.ps1
#>
# Set the common parameters
# Note: Will overwrite the existing NMT_14A.ee file
$ErrorActionPreference = "Stop"
$start_time = Get-Date
$path = $env:temp
@auberginehill
auberginehill / Append-Csv.ps1
Last active July 27, 2018 20:21
Appends CSV-files with Windows PowerShell v2.0, adds two custom extra columns to the merged file & replaces an expression inside the outputted CSV-file.
<#
Append-Csv.ps1
#>
# The directory name contains at least one underscore in its name, and the first part
# is used in the outputted filename as a denominator ($directory = "denominator").
# Note: UTF8 encoding in source files, perhaps? (for special characters et al.)
$path = "$env:USERPROFILE\Documents\denominator_split_files"
$directory = (Split-Path $path -Leaf).Split("_")[0]
$csv_file = "$path\merged_csvfile_$directory.csv"