Skip to content

Instantly share code, notes, and snippets.

krowe

Block or report user

Report or block krowe

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@krowe
krowe / Konsole.cs
Created Oct 3, 2018
Konsole Library
View Konsole.cs
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 Nov 26, 2018
This is a handy PHP file for development machines which includes phpinfo information and a directory listing.
View index.php
<?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 Aug 29, 2015
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.
View bcat
#!/bin/bash
while read -r; do
printf "%b\n" "$REPLY"
done < $1
printf "\e[0m"
@krowe
krowe / ApacheHostSync.md
Last active Aug 29, 2015
This PHP file will search through the Apache vhosts specified and automatically generate a port configuration file so you don't need to maintain it seperately.
View ApacheHostSync.md

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 Oct 24, 2018
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.
View numeric_rename.bat
@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 Oct 19, 2014
A batch file for creating numbered directories. Such as: dir1, dir2, dir3, dir4
View MKDIR_RANGE.BAT
@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 Aug 27, 2014
A RegEx replace script which uses Hybrid Batch\JScript code
View repl.bat
@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 Aug 29, 2015
This file is used for testing various file\directory tasks. It creates a huge directory tree with some error folders very quickly.
View mkdir_tree.bat
@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 Dec 18, 2015
A RegEx match script which uses Hybrid Batch\JScript code
View jgrep.bat
@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 / GNU_Win32.md
Last active Jan 29, 2019
This guide shows you how to make a more GNU friendly Windows environment
View GNU_Win32.md

Guide to a more GNU-like Windows CLI

This is a guide to setting up a Windows command line environment which supports many of the commonly used features available in a GNU\Linux environment. It is most useful to people whom work in mixed environments and would like a more seamless experience when switching back and forth but is also useful to those who've never used the GNU tools before.

This will consist of adding a package manager, the GNU tools library, a DOSKEY replacement for better command line completion and a better

You can’t perform that action at this time.