This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
param( | |
[Parameter(ValueFromPipeline=$true)] | |
$Sid | |
) | |
if($Sid) | |
{ | |
$securityIdentifier = [System.Security.Principal.SecurityIdentifier] $Sid | |
try |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
param( | |
[Parameter(ValueFromPipeline=$true)] | |
$Name | |
) | |
if($Name) | |
{ | |
$ntAccount = [System.Security.Principal.NTAccount] $Name | |
try |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Note: For libfdk_aac requires ffmpeg built with `--enable-libfdk-aac' and not `--enable-gpl', | |
# On Debian-based distros the package from www.deb-multimedia.org repos compiles it as such. | |
# TODO: probably easier in something python based like this https://github.com/Eloston/misc-programs/tree/master/flac_to_ogg | |
ff_flac2aac() ( | |
{ [ -n "${ZSH_VERSION-}" ] && emulate -L zsh -o nullglob; }; local f i of 2>/dev/null | |
if [ $# != 0 ]; then | |
if ([ -d "${1}" ] && [ $# -eq 1 ]); then { cd "${1}" || return; } | |
elif ([ -f "$1" ] && [ $# -eq 1 ]); then { f="${1}"; } | |
elif ([ $# -gt 1 ]); then { for i in "$@";do f+=("${i}");done; } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Set-StrictMode -Version 'Latest' | |
[bool]$IsAdmin = ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole( | |
[Security.Principal.WindowsBuiltInRole]::Administrator) | |
[ScriptBlock]$script = {Get-Volume | Select-Object -ExpandProperty DriveLetter | Foreach-Object{Flush-Volume -DriveLetter $_}} | |
if ($IsAdmin) { | |
if (Get-Command 'Flush-Volume','Write-VolumeCache' -EA:4) { | |
& {$script} | |
} else { | |
throw 'Error' | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<#PSScriptInfo | |
.NAME Get-FileFromUri.ps1 | |
.VERSION 1.0 | |
.GUID 5c779f0b-6db9-43bd-a0c0-246125f9c7e9 | |
.TAGS Get-FileFromUri PSWget wget WebRequest WebClient Invoke-WebRequest | |
#> | |
<# | |
.SYNOPSIS | |
Retrieves remote content to the current directory or OutFile path. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[CmdletBinding(DefaultParameterSetName = "Path")] | |
[OutputType([string])] | |
Param( | |
[Parameter( | |
Mandatory = $false, | |
ValueFromPipeline = $true, | |
ValueFromPipelineByPropertyName = $true)] | |
[ValidateNotNullOrEmpty()] | |
[Alias("Name","FullName","LiteralPath","LP","PSPath")] | |
$Path |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# fishl.sh - safely change shells to fish while fixing its fishy command_not_found_handler | |
# Alternatively, null cnf handler can be used: | |
# 'function __fish_command_not_found_handler --on-event fish_command_not_found; end' | |
if test -x /usr/bin/fish ; then | |
fishl () ( | |
/usr/bin/env -i \ | |
SHELL=/usr/bin/fish \ | |
TERM="${TERM}" \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# autoload | |
alias "$1"="${aliases[$1]:-$1} $argv[2,-1]" | |
# -*- mode: Shell-Script; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- | |
# vim: ft=zsh sts=2 ts=2 sw=2 et fdm=marker fmr={{{,}}} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#autoload | |
#function realpath { | |
emulate -L zsh -o extendedglob -o function_argzero # -o SOURCE_TRACE -o XTRACE -o VERBOSE | |
typeset f='' o='' | |
(($#)) || { | |
print -u2 "$0: missing operand\nUsage: $0 path [path ...]"; | |
return 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# /sbin/service Handle boot and runlevel services | |
# | |
VERSION="18.02.16" | |
sd_booted() | |
{ | |
test -d /sys/fs/cgroup/systemd/ |