Skip to content

Instantly share code, notes, and snippets.

@BalajiVelaga
BalajiVelaga / win_set_proxy_server_powershell.ps1
Created March 8, 2024 05:35 — forked from hygorluz/win_set_proxy_server_powershell.ps1
Set Windows Proxy Server via PowerShell
####
# SET-INTERNETPROXY
#
# DESCRIPTION
# This function will set the proxy server and (optional) Automatic configuration script.
#
# SYNTAX
# Set-InternetProxy [-Proxy] <string[]> [[-acs] <string[]>] [<CommonParameters>]
#
# EXAMPLES
@BalajiVelaga
BalajiVelaga / keepawake.ps1
Created February 14, 2022 04:12 — forked from jamesfreeman959/keepawake.ps1
A very simple PowerShell script to keep a Windows PC awake and make lync think the user is active on the keyboard
# Useful references:
#
# https://superuser.com/questions/992511/emulate-a-keyboard-button-via-the-command-line
# https://ss64.com/vb/sendkeys.html
# https://social.technet.microsoft.com/Forums/windowsserver/en-US/96b339e2-e9da-4802-a66d-be619aeb21ac/execute-function-one-time-in-every-10-mins-in-windows-powershell?forum=winserverpowershell
# https://learn-powershell.net/2013/02/08/powershell-and-events-object-events/
#
# Future enhancements - use events rather than an infinite loop
$wsh = New-Object -ComObject WScript.Shell
while (1) {
@BalajiVelaga
BalajiVelaga / lambda_handler.py
Created August 22, 2021 06:55 — forked from g-a-d/lambda_handler.py
Process either S3 event notifications or SNS messages with python in AWS Lambda
import urllib
def lambda_handler(event, context):
for record in event['Records']:
try:
if 'aws:sns' == record['EventSource'] and record['Sns']['Message']:
record = json.loads(record['Sns']['Message'])['Records'][0]
except KeyError:
pass
bucket = record['s3']['bucket']['name']
@BalajiVelaga
BalajiVelaga / New-RulesFromNetstat.ps1
Created July 5, 2019 00:04 — forked from jeffpatton1971/New-RulesFromNetstat.ps1
A script to create firewall rules based on netstat output
<#
Create FW rules for TCP and UDP Listening Ports
netstat -an -p tcp |Select-String "Listening"
netstat -an -p udp |Select-String "Listening"
for each entry in netstat create firewall rule
name = -p tcp|udp port port #
description = automatic allow rule generated by powershell on get-date
@BalajiVelaga
BalajiVelaga / Get-MsdnKeys.ps1
Created April 9, 2018 10:55 — forked from Jaykul/Get-MsdnKeys.ps1
PowerShell + Selenium Demo: Getting Started, and reusing cookies with Invoke-Request
# It might work in 4, but I'm not testing there. Lower you'll have to tweak code
#requires -Version 5.0
param(
# Your Live ID for MSDN login
[Parameter(Mandatory)]
[PSCredential]
[System.Management.Automation.CredentialAttribute()]
$Credential,
# Pick a browser to use. Defaults to Firefox (which doesn't seem to require an external Driver file)