Skip to content

Instantly share code, notes, and snippets.

View bdeb1337's full-sized avatar
🔨

Bob D bdeb1337

🔨
  • Leuven, Belgium
  • 12:02 (UTC +02:00)
View GitHub Profile
@earthdiver
earthdiver / taskbar.ps1
Last active May 11, 2024 10:15
A code snippet to put a resident PowerShell script into the taskbar notification area
#@Powershell -NoP -W Hidden -C "$PSCP='%~f0';$PSSR='%~dp0'.TrimEnd('\');&([ScriptBlock]::Create((gc '%~f0'|?{$_.ReadCount -gt 1}|Out-String)))" %* & exit/b
# by earthdiver1 V1.05
if ($PSCommandPath) {
$PSCP = $PSCommandPath
$PSSR = $PSScriptRoot
$code = '[DllImport("user32.dll")]public static extern bool ShowWindowAsync(IntPtr hWnd,int nCmdShow);'
$type = Add-Type -MemberDefinition $code -Name Win32ShowWindowAsync -PassThru
[void]$type::ShowWindowAsync((Get-Process -PID $PID).MainWindowHandle,0)
}
Add-Type -AssemblyName System.Windows.Forms, System.Drawing
@heardk
heardk / OneNote-to-MD.md
Last active September 17, 2024 12:43
Convert notes from OneNote into Markdown

Converting One Note to Markdown

This is an example of how to convert notes from OneNote into Markdown to use in other, less annoying Note applications. I am using PowerShell on Windows here, but other shell/scripting environments would work as well. If you want separate .md files, you'll need to export your OneNote pages separately. Exporting a section, or a selection of pages creates a single .docx file.

  • Download and install Pandoc
  • Export each of your note pages to a .docx (Word) format using OneNote export from the File menu
  • Gather all of these .docx files into a directory
  • Open directory in File Explorer
  • Open Powershell from the File Explorer using File -> Open Windows Powersell
  • Run the following command:
@coolbrg
coolbrg / powershell.go
Last active July 30, 2024 17:36
Playing PowerShell command via Golang
package main
import (
"bytes"
"fmt"
"os/exec"
"strings"
)
// PowerShell struct
@crshnbrn66
crshnbrn66 / user-profile.psm1
Last active July 9, 2024 14:38 — forked from MSAdministrator/Create-NewProfile.ps1
PowerShell functions to create a new user profile
<#
.Synopsis
Rough PS functions to create new user profiles
.DESCRIPTION
Call the Create-NewProfile function directly to create a new profile
.EXAMPLE
Create-NewProfile -Username 'testUser1' -Password 'testUser1'
.NOTES
Created by: Josh Rickard (@MS_dministrator) and Thom Schumacher (@driberif)