Skip to content

Instantly share code, notes, and snippets.


Sid Shetye SidShetye

View GitHub Profile
SidShetye /
Last active May 8, 2020
a shell script to update cloudflare's DNS record
# This is probably better implemented in a real scripting language like powershell script or javascript but
# as a shell script to take minimal dependencies
###### Inputs - change these per your use case
# Go get Zone ID and account ID, log into the CF dashboard -> domain -> overview -> left column, bottom part
# The record we want to update
SidShetye /
Last active Apr 22, 2020
script for system info on Rasbperry Pi
echo "Temperature ....: $(vcgencmd measure_temp | sed 's/.*=//')"
echo "Memory .........: $(free -h | grep Mem | awk '{print $4 " free out of " $2}')"
echo "Storage ........: $(df -H | grep "/$" | awk '{print $4 " free out of " $2}')"
echo "Uptime .........: $(uptime -p)"
echo "CPU Frequency ..: $(($(vcgencmd measure_clock arm | sed 's/^.*=//')/1000000)) MHz"
SidShetye /
Created Nov 7, 2018 — forked from danjargold/
Google script to list (on a Google Sheet) all files shared in your google drive, including all viewers, editors, and sharing permissions. Credit goes to @woodwardtw ( as this is an improvement on his code which only assesses a single folder and one level of sub-folders down.
function listFolders(folder) {
var sheet = SpreadsheetApp.getActiveSheet();
sheet.appendRow(["Name", "Sharing Access", "Sharing Permission", "Get Editors", "Get Viewers", "Date", "Size", "URL", "Download", "Description", "Type"]); //writes the headers
//var folder = DriveApp.getFolderById("INSERT_YOUR_FILE_ID");//that long chunk of random numbers/letters in the URL when you navigate to the folder
//getLooseFiles(folder, sheet);
//getSubFolders(folder, sheet);
//instead of getting folder by ID rather get all folders and cycle through each. Note this will miss loose files in parent directory.
var folder = DriveApp.getFolders()
SidShetye / run-applicationinsights-weeklyemails.csx
Last active Jun 25, 2018
To get application insight emails on a weekly basis. rename to run.csx when moving into azure functions
View run-applicationinsights-weeklyemails.csx
#r "Newtonsoft.Json"
using System.Configuration;
using System.Net.Mail;
using System.Net.Mime;
using Newtonsoft.Json.Linq;
using Newtonsoft.Json;
private const string AppInsightsApi = "";
SidShetye / BCryptAuthenticatedSymmetricCryptoTransform.cs
Created Oct 5, 2017
Modified to pluck tag from end of stream automatically
View BCryptAuthenticatedSymmetricCryptoTransform.cs
// Copyright (c) Microsoft Corporation. All rights reserved.
// Originally from CLR Security licensed by Microsoft under MIT License
// Modified by Crypteron under MIT License
// changelog
// - Make decrypt symmetrical with encrypt by keeping tag at the end
// of ciphertext. This oddity requires some buffer management
// but better to do internally here than expect all users to
// perform tricky buffer management themselves.
SidShetye / ExportAlbumAsFolder.applescript
Last active Aug 14, 2020
Scan through all albums and export media items (movies, images etc) into a suitable folder. There is custom logic to pick the appropriate destination folder.
View ExportAlbumAsFolder.applescript
-- Settings Start: Change these as needed
global gDest
set gDest to "/Volumes/MacPhotos/Pictures/ExportAlbums/" as POSIX file as text -- the destination folder (use a valid path)
global gLogFile
set gLogFile to gDest & "ExportAlbumToFolders.log"
global gKeywordOnSuccess
set gKeywordOnSuccess to "exported"
SidShetye / Get-BuildDateFromVersion.ps1
Created Dec 9, 2016
In .NET builds auto-increment if your code specified build versions like "1.2.*". This powershell script goes the reverse and helps find the date of release given a version number
View Get-BuildDateFromVersion.ps1
[Version] $Version ="1.2.5678.6432"
# Usage as 'Get-BuildDateFromVersion.ps1 -Version'
# Intentionally written in verbose mode, line by line
# From and
# Build = DateTime.Today.Subtract(new DateTime(2000, 1, 1)).Days;
SidShetye / wget.ps1
Last active Sep 5, 2020
Powershell script to download files on Windows Server Nano where Invoke-Webrequest/wget are natively missing
View wget.ps1
Downloads a file
Downloads a file
URL to file/resource to download
file to save it as locally
SidShetye / HardenSSL.ps1
Last active Jan 15, 2020
Script to harden SSL/TLS on Azure Cloud Service
View HardenSSL.ps1
# Call this from inside a startup task/batch file as shown in the next two lines (minus the '# ')
# PowerShell -ExecutionPolicy Unrestricted .\HardenSsl.ps1 >> log-HardenSsl.txt 2>&1
# EXIT /B 0
# Credits:
$nl = [Environment]::NewLine
$regkeys = @(
View Entropy.cs
public class Entropy
private const long Prime = 179426549;
private const long Prime2 = 46633; // another prime
public static long GetEntropySeed()
return Ticks ^ ProcessInfoKey() ^ MemorySizeKey() ^ EnvironmentKey();
You can’t perform that action at this time.