Skip to content

Instantly share code, notes, and snippets.

@JackGruber
JackGruber / export.ps1
Last active January 5, 2021 11:26
Joplin powershell note export
$endpoint = "http://localhost:41184"
$token = "xxxxxxxxxx"
Try
{
$uri = ($endpoint + "/ping")
if( (Invoke-WebRequest -Uri $uri).Content -ne "JoplinClipperServer")
{
Write-Host "No Joplin API endpoint" -ForegroundColor Red
{
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": "-- Grafana --",
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",
@JackGruber
JackGruber / Get-ProcessOutput.ps1
Created May 11, 2018 17:12
Execute a process and return the output from standard output and standard error
function Get-ProcessOutput
{
Param (
[Parameter(Mandatory=$true)]$FileName,
$Args
)
$process = New-Object System.Diagnostics.Process
$process.StartInfo.UseShellExecute = $false
$process.StartInfo.RedirectStandardOutput = $true
@JackGruber
JackGruber / Get-Groups.ps1
Last active May 11, 2018 16:34
Get locale and domain group membership from current user without AD powershell module
function Get-Groups {
Param(
[string]$isMember
)
if($isMember)
{
$mytoken = [System.Security.Principal.WindowsIdentity]::GetCurrent()
$me = New-Object System.Security.Principal.WindowsPrincipal($mytoken)
return $me.IsInRole($isMember)