Coder Social home page Coder Social logo

stadub / powershellscripts Goto Github PK

View Code? Open in Web Editor NEW
29.0 2.0 10.0 9.76 MB

Monorepo with all my Powershell Scripts

License: BSD 2-Clause "Simplified" License

PowerShell 100.00%
powershell-script powershell uninstall-application powershell-bookmarks directorymarks pushd 7zip zip unzip gzip

powershellscripts's Introduction

Powershell Scripts https://github.com/stadub/PowershellScripts/tree/master/


Powershell Micro Modules

Base64String Base64String - Convert text from/to Base 64 String

https://www.powershellgallery.com/packages/Base64String/ https://github.com/stadub/PowershellScripts/tree/master/Shared-Functions/Base64String/

ConvertFrom-Base64String
  [-EncodedValue] <string>
  [-UrlSafe] <bool>  (default- $false) - Set to produce url safe string


ConvertTo-Base64String
  [-Value] <string>

πŸ‘‰πŸΏ Full documentation and code


Pipe Pipe - Powershell Pipe filtering functions

https://www.powershellgallery.com/packages/Pipe/ https://github.com/stadub/PowershellScripts/tree/master/Shared-Functions/Base64String/

Limit-Type - Filter by element type
   [-Type] <Type>
   [-Strict] (default- $true) - $true - filter by exact type, $false - any assigname type
```powershell

Limit-Type - Filter by element type name
   [-TypeName] <string> Type name
   [-Strict] (default- $true) - $true - filter by exact type, $false - 'like' comparision used

Limit-First - Return only the first element of pipe

Limit-Last - Return only the last element of pipe

Skip-Items - Skip N elements
   [-Count] <int>

Hide-Out - supress output

Limit-Items - Return only N elements from pipe
   [-Count] <int>

πŸ‘‰πŸΏ Full documentation and code


Powershell Modules


Bookmarks Bookmarks - Directory bookmarks

https://www.powershellgallery.com/packages/Bookmarks/ https://github.com/stadub/PowershellScripts/tree/master/Bookmarks/

Add-PSBookmark  - Add folder to the bookmarks list
  [-Name] <string>
  [-Path] <string> (Optional)

Remove-PSBookmark - Remove bookmark from the list
  [-Bookmark] <string>

Open-PSBookmark - Navigate to bookmark
  [-Bookmark] <string>

Get-PSBookmarks - List bookmarks

Remove-AllPSBookmarks - Clear bookmarks list

Update-PSBookmark  - Update folder location in the bookmarks list
  [-Name] <string>
  [-Path] <string> (Optional)

πŸ‘‰πŸΏ Full documentation and code


7Zip 7zip-Archive - 7zip utility powershell wrapper

https://www.powershellgallery.com/packages/7zip-Archive/ https://github.com/stadub/PowershellScripts/tree/master/7Zip/

New-ZipFile - Create new archive
  [-Archive] <string>
  [-Files] <string[]>
  [-Compression] (Optional) {Store, Fastest, Fast, Normal, Maximum, Ultra}
  [-Password] <string> (Optional)
  [-SplitSize] <string> (Optional)
  [-SplitSizeFactor] (Optional) {Byte, Kilobyte, Megabyte, Gigabytes}
  [-UpdateMode] (Optional) {Add, Update, Freshen, Sync}

Get-ZipFileContent - Extract archive new archive
  [-Archive] <string>
  [-FileName] <string> (Optional) - Extrct single file
  [-Password] <string> (Optional)
  [-Force] <Boolean> (Optional) - Overwrite existing file
  [-OutputPath] <string> (Optional) - folder to extract

Read-ZipFile  - List 7zip file content
  [-Archive] <string>
  [-Password] <string> (Optional)

Add-ZipFileContent - Add file to archive
  [-Archive] <string>
  [-File] <string>
  [-Password] <string> (Optional)

Remove-ZipFileContent - Remove file from archive
  [-Archive] <string>
  [-File] <string>
  [-Password] <string> (Optional)


Test-ZipFileContent - Perform zip file check
  [-Archive] <string>
  [-File] <string> (Optional)
  [-Password] <string> (Optional)

πŸ‘‰πŸΏ Full documentation and code


Currency-Conv Currency-Conv - Currecny converter

https://www.powershellgallery.com/packages/Currency-Conv/ https://github.com/stadub/PowershellScripts/tree/master/Currency-Conv/

Get-ExchangeRate - Get exchange rate for amount
  [-From] <string>
  [-To] <string> (Optional "USD")
  [-Amount] <integer> (Optional 1.0)

Get-Countries -Countries list with currencies

Get-Currencies - Supported currencies list

Remove-CurrencyApiKey- Clean key

πŸ‘‰πŸΏ Full documentation and code


FolderEncoder Invoke-FolderEncode - Encode files from a folder for(for example) uploading to the cloud

Used as backups encoding solution.

Encoding performed with 7z password protection

https://www.powershellgallery.com/packages/FolderEncoder/ https://github.com/stadub/PowershellScripts/tree/master/FolderEncoder/

Invoke-FolderEncode - Encode folder
  [-DestFolder] <string>
  [-SrcFolder] <string> (Optional)

πŸ‘‰πŸΏ Full documentation and code


πŸ’² Motivation

The modules are created and actively maintained during evenings and weekends for my own needs. If it's useful for you too, that's great. I don't demand anything in return.

However, if you like it and feel the urge to give something back, a coffee or a beer is always appreciated. Thank you very much in advance.

Buy Me A Coffee Support by Yandex

πŸ“¬ Suggestions and feedback

If you have any idea or suggestion - please add a github issue.

powershellscripts's People

Contributors

stadub avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

powershellscripts's Issues

base64string

#Conversion error when the input and output are encoded differently
$str=".d_'+β™‚Β’Β£"
$in='Unicode'
$to='utf8'
$en=[Convert]::ToBase64String([System.Text.Encoding]::$in.GetBytes($str))
$de=[System.Text.Encoding]::$to.GetString([System.Convert]::FromBase64String($en))
$en;$de
$uri='https://github.com/stadub/PowershellScripts/issues/22'
$r=irm $uri|select-string -Pattern '(?<=gid=")[^"]+' -AllMatches
$r.matches.value
$r.matches.value|%{$_|ConvertFrom-Base64String}

The common encoding in the network is utf8.

Need to use utf8,Or join the conversion option。

7zip linux support

Is your feature request related to a problem? Please describe.
7 zip now works on linux
but module uses p7zip

Describe the solution you'd like
use 7zip package on linux

Use a modern version of 7zip and use already installed 7zip.

Is your feature request related to a problem? Please describe.
I was trying to find a powershell module to uncompress 7zip archives. I found this in the powershell gallery.

Instead of using the 7z.exe that is already installed on my system at 'C:\Program Files\7-Zip\7z.exe'. The module seems to be hard coded to download and install a 9.20 release of 7zip, which was release almost 10 years ago. There have be a number of security vulnerabilities and bugs in older releases of 7zip.

Describe the solution you'd like

Please consider updating use the 7zip that is installed on the system if one is present in the standard install paths instead of installing a really old version.

Currency-Conv module caching works only for some period of time

Describe the bug
The cache doesn't work after globally set time offset expiration

To Reproduce

  1. Set debug out mode on
  2. Wait $global:CurrencyConvExchangeRateCahcheLifetime expired - 60 seconds
  3. Perform several requests

Result
All requests are sent to the server

Expected behavior
Only the first request performed- other cached

Remove-ZipFileContent returns Cannot validate argument on parameter 'FileName'.

Describe the bug
Remove-ZipFileContent returns Cannot validate argument on parameter 'FileName'.

To Reproduce

  1. enter
    Remove-ZipFileContent -Archive .\scripts.7z -File "temp.log"
  2. Powershell return
    Remove-ZipFileContent : Cannot validate argument on parameter 'FileName'. The " Test-Path $_ -pathType leaf " validation script for the argume
    nt with value "temp.log" did not return a result of True.

Expected behavior
file has been deleted from archive

Currency-Conv Api Key always stored in file

Describe the bug
Currency-Conv Api Key always stored in file but for some users, it can be very sensitive information

Expected behavior
User should have the ability to decide if he wants to store info either enter during each module load

7-zpi szc New-ZipFile alias is absent

Describe the bug
In the documentation, there is szc alias for the New-ZipFile function but it doesn't exist in the module

To Reproduce
in PowerShell enter szc

Expected behavior
alias szc is exist

7zip module: Value of HelpInfoURI in the Module Manifest

Describe the bug

The current value of HelpInfoURI will error out on 404, since the value is populated with a valid http/https link but of wrong file extension (.md).
I understand the intent to easier allow users to find the github README and get help by reading it, but currently this causes an error when running Update-Help (to update all the help files on your system)

https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/new-modulemanifest?view=powershell-7.2
https://devblogs.microsoft.com/scripting/helpinfouri-helpuri-and-other-help-mysteries/

To Reproduce
Steps to reproduce the behavior:

  1. Update-Help 7zip-Archive

Expected behavior
If updatable help is the goal then have HelpInfoURI go to a xml or container

Thanks!

Add Currency-conv requests caching

Is your feature request related to a problem? Please describe.
Currency-Conv module generates web request on each cmdlet invocation or even validation

Describe the solution you'd like
After web request Currency Exchange rates and Currencies List are cached locally for some small time.
**It good to have the ability to configure cache lifetime

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.