Skip to content

Instantly share code, notes, and snippets.

@krowe
krowe / color.sh
Created August 22, 2014 12:11
Displays a table of shell color codes
#!/bin/bash
useage() {
printf "\n\e[1;4mAscii Escape Code Helper Utility\e[m\n\n"
printf " \e[1mUseage:\e[m colors.sh [-|-b|-f|-bq|-fq|-?|?] [start] [end] [step]\n\n"
printf "The values for the first parameter may be one of the following:\n\n"
printf " \e[1m-\e[m Will result in the default output.\n"
printf " \e[1m-b\e[m This will display the 8 color version of this chart.\n"
printf " \e[1m-f\e[m This will display the 256 color version of this chart using foreground colors.\n"
printf " \e[1m-q\e[m This will display the 256 color version of this chart without the extra text.\n"
@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 / 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_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 / 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"
@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 / 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 / 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.");
}
@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 / 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]