Skip to content

Instantly share code, notes, and snippets.

@skkut
skkut / FirewallBlockAllAppsInFolder.bat
Last active July 21, 2026 22:00
A windows batch file to block all applications in a folder in Windows firewall
@ setlocal enableextensions
@ cd /d "%~dp0"
for /R %%a in (*.exe) do (
netsh advfirewall firewall add rule name="Blocked with Batchfile %%a" dir=out program="%%a" action=block
)
@skkut
skkut / MoveMissingFilesToFolder.ps1
Last active November 7, 2018 11:01
Identify files that are not backed up and move them to a new sub folder. Already backed up filenames are in filelist.txt
$dir = 'D:\sample_folder'
$FileList = $dir + '\filelist.txt'
$BackupFolderName = (get-item $dir).BaseName + " Backup"
$BackupFolder = Join-Path $dir $BackupFolderName
New-Item -ItemType Directory -Force -Path $BackupFolder
$BackedFiles = Get-Content $FileList
$Files = Get-ChildItem -Path $dir -File
foreach ($file in $Files)
{
@skkut
skkut / CompareFoldersDeleteCommonFiles.ps1
Last active November 7, 2018 11:19
Powershell script to compare 2 folders and delete common files in target folder
$compareFolder = 'C:\sample_compare_folder'
$targetFolder = 'C:\sample_target_folder'
$compareFiles = Get-ChildItem -Path $compareFolder -File
$targetFiles = Get-ChildItem -Path $targetFolder -File
$targetFiles | Where-Object {$compareFiles.BaseName -contains $_.BaseName} | Remove-Item -Force
@skkut
skkut / UpdateDailyValuesFromWeb.gs
Last active October 9, 2015 20:42
This google script code scrubs a website, gets a particular text value and inserts new row in a google spreadsheet with the date and value. I use this with a daily time-driven trigger to update the spreadsheet and show an interactive graph.
function UpdateDailyGoldValues()
{
//Initialize website url and get content
var dinamalarWS = UrlFetchApp.fetch("http://business.dinamalar.com/gold_silver_rate.asp");
var strs = dinamalarWS.getContentText();
//get string
var index1 = strs.search("<div id=\"selGoldk\"> <span id=\"selGoldkt\"> 22 காரட் 1கி் </span><br>");
var index2 = strs.search("<div style=\"border:none;\" id=\"selGoldk\"> <span id=\"selGoldkt\"> 24 காரட் 10கி் </span> <br>");
var substrs = strs.slice(index1, index2);
@skkut
skkut / ConvertRomanToNumerals.cs
Last active March 6, 2019 10:29
A command line application that takes a folder as an argument, searches for a regex pattern that contains the roman numerals in all the files and converts the roman numerals to numbers.
using System;
using System.IO;
using System.Text.RegularExpressions;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConvertRomanToNumeral
{