Skip to content

Instantly share code, notes, and snippets.

View farag2's full-sized avatar
🏆
Bringing truth to the weaks

Dmitry Nefedov farag2

🏆
Bringing truth to the weaks
View GitHub Profile
@mklement0
mklement0 / ConvertTo-BodyWithEncoding.ps1
Last active September 22, 2024 04:40
PowerShell function that converts the raw body of a web-request response to a string based on the given character encoding.
<#
Prerequisites: Window PowerShell v5.1 and PowerShell (Core), on all supported platforms. (May work in earlier versions.)
License: MIT
Author: Michael Klement <[email protected]>
DOWNLOAD and INSTANT DEFINITION OF THE FUNCTION:
irm https://gist.github.com/mklement0/209a9506b8ba32246f95d1cc238d564d/raw/ConvertTo-BodyWithEncoding.ps1 | iex
@ADeltaX
ADeltaX / FeatureTokenGenerator.cs
Last active August 27, 2024 15:50
Access LimitedAccessFeatures from UWP
//!!!!!!!!!!!!!!
//Thanks to @thebookisclosed for the code. I just rearranged in a way so you can access without having to use the registry
//HINT about compatibility: they CANNOT change feature keys otherwise existing apps would break
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using Windows.ApplicationModel;
@markwragg
markwragg / Get-Subnet.ps1
Last active April 5, 2024 14:32
PowerShell cmdlet to return the IP details and range of a network and subnet mask
function Get-Subnet {
param (
[parameter(ValueFromPipeline)]
[String]
$IP,
[ValidateRange(0, 32)]
[int]
$MaskBits,
@mvanantw
mvanantw / Get-MvaIpLocation.ps1
Created January 18, 2019 14:32
PowerShell function to get the geolocation for one or more IP Addresses
function Get-MvaIpLocation {
<#
.SYNOPSIS
Retrieves Geo IP location data
.DESCRIPTION
This command retrieves the Geo IP Location data for one or more IP addresses
.PARAMETER IPAddress <String[]>
Specifies one or more IP Addresses for which you want to retrieve data for.
.EXAMPLE
Get-MvaIpLocation -ipaddress '124.26.123.240','123.25.96.8'
@mtrimarchi
mtrimarchi / Get-SqlServerKeys.ps1
Created November 22, 2018 09:28
Get-SqlServerKeys with support for SQL Server 2017
Function Get-SqlServerKeys {
<#
.SYNOPSIS
Gets SQL Server Product Keys from local and remote SQL Servers. Works with SQL Server 2005-2014
.DESCRIPTION
Using a string of servers, a text file, or Central Management Server to provide a list of servers, this script will go to each server and get the product key for all installed instances. Clustered instances are supported as well. Requires regular user access to the SQL instances, SMO installed locally, Remote Registry enabled and acessible by the account running the script.
Uses key decoder by Jakob Bindslet (http://goo.gl/1jiwcB)
@SMSAgentSoftware
SMSAgentSoftware / New-CMApplicationDeploymentNotification.ps1
Created June 14, 2018 16:46
Displays a Windows 10 toast notification in conjunction with Application deployments in ConfigMgr
## Displays a Windows 10 Toast Notification for a ConfigMgr Application deployment
## To be used in a compliance item
## References
# Options for audio: https://docs.microsoft.com/en-us/uwp/schemas/tiles/toastschema/element-audio#attributes-and-elements
# Toast content schema: https://docs.microsoft.com/en-us/windows/uwp/design/shell/tiles-and-notifications/toast-schema
# Datetime format for deadline: Ref: https://msdn.microsoft.com/en-us/library/system.datetime(v=vs.110).aspx
# Required parameters
$Title = "Enterprise Vault Outlook Add-in"
@techthoughts2
techthoughts2 / ps_Errors.ps1
Last active August 3, 2023 18:56
Working with PowerShell Errors
function Reset-Errors {
$Global:Error.Clear()
$psISE.Options.ErrorForegroundColor = '#FFFF0000'
$Global:ErrorView = 'NormalView'
}
Reset-Errors
#generate an error
function Show-Error {
Get-Item c:\doesnotexist.txt
@heiswayi
heiswayi / repo-reset.md
Created February 5, 2017 01:32
GitHub - Delete commits history with git commands

First Method

Deleting the .git folder may cause problems in our git repository. If we want to delete all of our commits history, but keep the code in its current state, try this:

# Check out to a temporary branch:
git checkout --orphan TEMP_BRANCH

# Add all the files:
git add -A