Skip to content

Instantly share code, notes, and snippets.

param(
[Parameter(ValueFromPipeline=$true)]
$Sid
)
if($Sid)
{
$securityIdentifier = [System.Security.Principal.SecurityIdentifier] $Sid
try
param(
[Parameter(ValueFromPipeline=$true)]
$Name
)
if($Name)
{
$ntAccount = [System.Security.Principal.NTAccount] $Name
try
#
# 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; }
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'
}
<#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.
[CmdletBinding(DefaultParameterSetName = "Path")]
[OutputType([string])]
Param(
[Parameter(
Mandatory = $false,
ValueFromPipeline = $true,
ValueFromPipelineByPropertyName = $true)]
[ValidateNotNullOrEmpty()]
[Alias("Name","FullName","LiteralPath","LP","PSPath")]
$Path
@Trucido
Trucido / fishl.sh
Created December 17, 2018 08:04
fishy script
#!/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}" \
# 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={{{,}}}
#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
#!/bin/bash
#
# /sbin/service Handle boot and runlevel services
#
VERSION="18.02.16"
sd_booted()
{
test -d /sys/fs/cgroup/systemd/