Skip to content

Instantly share code, notes, and snippets.

@krowe
krowe / Add_hidden_dot_items_to_context_menu.reg
Last active December 10, 2021 04:10
These add a menu to Windows Explorer which shows or hides hidden files. It also will add menu items which show and hides protected system files. You can optionally also add menus for showing and hiding files which begin with a dot in the current folder.
Windows Registry Editor Version 5.00
; Created by: Kevin Rowe
; Created on: December 9, 2021
; Based on work by (you will probably want to install his script to work along with this script):
; Created by: Shawn Brink
; Tutorial: https://www.tenforums.com/tutorials/75901-hidden-items-add-context-menu-windows-10-a.html
[HKEY_CLASSES_ROOT\Directory\Background\shell\HiddenFiles]
@krowe
krowe / Konsole.cs
Last active December 10, 2021 03:57
Konsole Library - This is a single C# file which provides many common functions for formatting console output.
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Text.RegularExpressions;
namespace BuildSite {
public class Kolor {
@krowe
krowe / index.php
Last active November 26, 2018 11:56
This is a handy PHP file for development machines which includes phpinfo information and a directory listing.
<?php
// BEGIN CONFIGURATION
$server_name = gethostname().' - Development Machine';
$search = dirname(__FILE__); // The directory you want to search.
// This uses a filesystem style pattern and ignores case (even on linux systems).
$ignore = array('.*','index.*','*.bak','aspnet_client'); // Files with these names are always ignored.
$usr = array( // These describe the user whom can log in and what group they are in
@krowe
krowe / bcat
Last active August 29, 2015 14:10
This bash script is similar to the cat GNU tool but it will interpret escape codes as it prints. This allows for you to use bash escape codes to make rich text files.
#!/bin/bash
while read -r; do
printf "%b\n" "$REPLY"
done < $1
printf "\e[0m"

Apache Host Sync

This script is useful for web developers and administrators whom use Apache name based virtual hosts to host multiple websites on the same server and would like to have the Listen and NameVirtualHost directives automatically updated when they add or remove virtual hosts.

Even though these are usually easy to configure it can be tedious to keep these values updated on some setups where hosts are being added and removed frequently. In these setups you could just add these directives to your vhost configuration but, in the case of the Listen directive, you'll need to ensure that they do not conflict so it is more handy to have them all listed in the same place. This is why the default Apache setup breaks these out into a separate file called ports.conf on most setups. Using this script you'll have the best of both worlds by being able to configure only the vhost definition while still having a central definition to avoid conflicts.

It works by scanning a list of configuration files

@krowe
krowe / numeric_rename.bat
Last active October 24, 2018 15:27
This file will change the file title of all files is a directory so that they are all just an incremented number with the original extension still in place.
@set @junk=1 /*
@cscript //nologo //E:jscript %~f0 %*
@goto :eof */
var args=WScript.Arguments, shell=WScript.CreateObject("WScript.Shell"), bForced, nStartIndex, sFilter;
if(args.length==0||(args.length==1&&(bForced=args(0).toLowerCase()=='-f'||args(0).toLowerCase()=='--force')))
err(1, "You must provide a starting value to begin counting at.");
if(args(0)=='-?'||args(0).toLowerCase()=='--help') { showHelp(); WScript.Quit(0); }
if(isNaN(nStartIndex=parseInt(args(bForced?1:0)))||nStartIndex<0)
@krowe
krowe / MKDIR_RANGE.BAT
Created October 19, 2014 01:36
A batch file for creating numbered directories. Such as: dir1, dir2, dir3, dir4
@echo off
SETLOCAL
:: Help is a special type of flag which is also
:: the default which has many ways to trigger.
IF "%1"=="" ( SET hflag_help=1 ) ELSE ( SET hflag_help=0)
IF "%1"=="/?" ( SET hflag_help=1 & SHIFT )
IF "%1"=="-?" ( SET hflag_help=1 & SHIFT )
IF "%1"=="--help" ( SET hflag_help=1 & SHIFT )
:: The other flags are all similar.
@krowe
krowe / repl.bat
Created August 27, 2014 15:45
A RegEx replace script which uses Hybrid Batch\JScript code
@if (@X)==(@Y) @end /* Harmless hybrid line that begins a JScript comment
::************ Documentation ***********
::REPL.BAT version 4.1
:::
:::REPL Search Replace [Options [SourceVar]]
:::REPL /?[REGEX|REPLACE]
:::REPL /V
:::
::: Performs a global regular expression search and replace operation on
@krowe
krowe / mkdir_tree.bat
Last active August 29, 2015 14:05
This file is used for testing various file\directory tasks. It creates a huge directory tree with some error folders very quickly.
@ECHO OFF
IF EXIST TREE (
RMDIR /S /Q TREE
ECHO Tree Removed.
GOTO :EOF
)
FOR %%A IN (1,2,3) DO (
ECHO Creating [ %%A ] and it's sub directories...
FOR %%B IN (%%A_1,%%A_2,%%A_3) DO (
@krowe
krowe / jgrep.bat
Last active January 6, 2021 19:05
A RegEx match script which uses Hybrid Batch\JScript code
@set @junk=1 /*
@cscript //nologo //E:jscript %~f0 %*
@goto :eof */
var args=WScript.Arguments, argCnt=args.Length, stdin=WScript.StdIn, stdout=WScript.StdOut;
var replaceSingleQuotes=false, printMatchesOnly=false, matchString, flagString, regex, argDx=0;
if(argCnt==0) {
throw new Error("You must provide search criteria.");
}