Last active
December 29, 2017 16:37
-
-
Save joshschmelzle/bf5c92d39c91aace7afadd2149d7cb12 to your computer and use it in GitHub Desktop.
doskey macro loader for win32 systems
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
cd C:\ | |
REM This batch file loads up doskey macros from a file. | |
REM Additionally it displays a random quote from a file to inspire the reader. | |
REM ::: MACROS START ::: | |
title Free Your Mind %1 | |
REM Create a .bat or .cmd file with your DOSKEY commands. | |
REM Run regedit and go to HKEY_CURRENT_USER > Software > Microsoft > Command Processor. | |
REM Add String Value entry with the name AutoRun and the full path of your .bat/.cmd file. | |
REM For speed, load macros from another file rather than using DOSKEY | |
echo started loading macros at %time%. | |
REM Load the macros | |
doskey /macrofile=C:\Josh\dev\bin\doskey_macros.txt | |
echo finished loading macros at %time%. | |
echo construct ready. | |
REM ::: MACROS END ::: | |
REM ::: RANDOM QUOTE START ::: | |
echo digging up a quote. | |
setlocal EnableDelayedExpansion | |
set "file=C:\Josh\dev\bin\doskey_quotes.txt" | |
set /A i=0 | |
for /F "usebackq delims=" %%a in ("%file%") do ( | |
set /A i+=1 | |
rem call echo %%i%% | |
call set quote[%%i%%]=%%a | |
call set n=%%i%% | |
) | |
rem Get the index of a random element | |
call :getRandomElem r= | |
REM Check if a variable is defined and echo output | |
REM IF DEFINED r (ECHO r IS defined) ELSE (ECHO r is NOT defined) | |
REM IF DEFINED n (ECHO n IS defined) ELSE (ECHO n is NOT defined) | |
REM Display every element in the array | |
REM for /L %%i in (1,1,%n%) do (call echo %%quote[%%i]%%) | |
REM Selecting a single element | |
REM call echo(%%quote[7]%% | |
REM Select a "random" element | |
call echo(%%quote[!r!]%% | |
REM ::: RANDOM QUOTE END ::: | |
REM ^ is the escape character. e.g. ^\ ^& ^| ^> ^< ^^ | |
REM ASCII art | |
echo __ _ | |
echo / _^| (_) | |
echo ^| ^|_ ___ _ __ ___ ___ _ ___ _ __ ___ ___ | |
echo ^| _/ _ \^| '__^| / __^|/ __^| ^|/ _ \ '_ \ / __/ _ \ | |
echo ^| ^|^| (_) ^| ^| \__ \ (__^| ^| __/ ^| ^| ^| (_^| __/_ | |
echo ^|_^| \___/^|_^| ^|___/\___^|_^|\___^|_^| ^|_^|\___\___(_) | |
goto :EOF | |
rem Get the index of a random element greater than 0 from gameID array | |
:getRandomElem r= | |
rem I have no idea why, but duplicating this line gets me the result I want. | |
set /A r = n * %random% / 32768 + 1 | |
set /A r = n * %random% / 32768 + 1 | |
if !quote[%r%]! equ 0 goto getRandomElem | |
exit /B |
sample quotes:
I get as much enjoyment from trashing code as I do from scratching it out in the first place! -Anonymous
Talk is cheap, show me the code! -Linus Torvolds
In order to understand recursion, one must first understand recursion. -Anonymous
Whatever code we hack, be it programming language, poetic language, math or music, curves or colourings, we create the possibility of new things entering the world. Not always great things, or even good things, but new things. -McKenzie Wark in "A hacker Manifesto":02
It's OK to figure out murder mysteries, but you shouldn't need to figure out code. You should be able to read it. -Steve McConnell
To err is human, but to really foul things up you need a computer. -Paul Ehrlich
If you lie to the compiler, it will get its revenge. -Henry Spencere
There is a great satisfaction in building good tools for other people to use. -Freeman Dyson
Code never lies, comments sometimes do. -Ron Jeffries
In software systems, it is often the early bird that makes the worm. -Alan J. Perlis
There are 10 types of people in the world, those who can read binary, and those who can't. -Anonymous
Compatibility means deliberately repeating other people's mistakes. -Anonymous
There is no programming language, no matter how structured, that will prevent programmers from making bad programs. -Larry Flon
When we write programs that "learn", it turns out that we do and they don^'t. -Alan J. Perlis
Java is C++ without the guns, knives, and clubs. -James Gosling
Should array indices start at 0 or 1? My compromise of 0.5 was rejected without, I thought, proper consideration. -Stan Kelly-Bootle
It works on my machine. -Anonymous
If you don^'t fail at least 90 percent of the time, you^'re not aiming high enough. -Alan Kay
"It depends" is the answer to all good software engineering questions, but to be a good software engineer, you should know on what it depends, and why. -Anonymous
It^'s 5.50 a.m.... Do you know where your stack pointer is? -Anonymous
Any code of your own that you haven^'t looked at for six or more months might as well have been written by someone else. -Eagleson^'s Law
The two most common elements in the universe are hydrogen and stupidity. -Harlan Ellison
If you get it free, it is worthless. If you pay for it, it has value. If you build it yourself, it is priceless. -Raj More
Team debugging: the act of intimidating a PC into doing for two people what it refuses to do for one. -Anonymous
The best writing is rewriting. -E. B. White
We^'re even wrong about which mistakes we^'re making. -Carl Winfeld
As soon as you agree on the number of spaces for indentation, no-one argues for tabs. -Alvar Lumberg
"90% of everything is crap" -"Sturgeon^'s Revelation"
It is easier to port a shell than a shell script. -Larry Wall
Remember, a great way to avoid broken code is to have less of it. The code that you never write will work forever. -Russ Olsen
If it works, leave it alone — there^'s no need to understand it. If it fails, try to fix it — there^'s no time to understand it. -Bill Pfeifer
"The only valid measurement of code quality: WTFs / minute" -Thom Holwerda
Programming is an unnatural act. -Alan J. Perlis
The function of good software is to make the complex appear to be simple. -Grady booch
Intellectuals solve problems; geniuses prevent them. -Albert Einstein
I think there^'s a world market for about five computers. -Thomas J Watson Senior, 1945
Blame doesn^'t fix bugs.
Don^'t fix bugs later; fix them now. -Steve Maguire
When it comes to code it never pays to rush. -Marick^'s Law
When a programming language is created that allows programmers to program in simple English, it will be discovered that programmers cannot speak English.
Anything that can go wrong, will go wrong. -Murphy^'s Law
Computer programmers don^'t byte, they nibble a bit.
Software with no bugs is obsolete.
Jesus saves but only Buddha makes incremental backups.
It compiles. Ship it!
Perspective is worth 80 I.Q. points -Alan Kay
It^'s hard enough to find an error in your code when you^'re looking for it; it^'s even harder when you^'ve assumed your code is error-free. -Steve McConnell
It’s hardware that makes a machine fast. It’s software that makes a fast machine slow. -Craig Bruce
Behind Every Successful Coder, there^'an even more successful De-Coder to understand that Code.
Some programmers try to reach higher by standing on other programmers^' shoulders. Other programmers try to reach higher by standing on other programmers^' toes.
Process is no substitute for synaptic activity. -Jeff Deluca
Rules are for the obedience of the inexperienced and the guidance of the wise.
God is a hacker, not an engineer. You can do reverse engineering, but you can’t do reverse hacking. -Francis Crick
When I have a specific goal in mind and a complicated piece of code to write, I spend my time making it happen rather than telling myself stories about it. -Steve Yegge
If your bug has a one in a million chance of happening, it^'ll happen next tuesday.
I^'ve never written the best code I^'ve ever written.
The reason we plan ahead is so that we don^'t have to do anything right now.
Lines of code are only worth counting, when time has come to delete them.
If at first you don^'t succeed, try/catch, try/catch again.
A computer scientist counts to ten: 0, 1, 2, 3, 4 ... Everyone else counts to ten: 1, 2, 3, 4, 5
A documented bug is not a bug; it is a feature. -James P. MacLennan
Amateur programmers think there are 1000 bytes in a kilobyte; Real Programmers know there are 1024 meters in a kilometer.
Like wine, the mastery of programming matures with time. But, unlike wine, it gets sweeter in the process.
The third version is the first version that doesn^'t suck. -Mike Simpson
A fool with a tool is still a fool.
If you lie to the compiler, it will get its revenge. -Henry Spencere
No code is faster than no code.
I have always found that plans are useless, but planning is indispensable. -Dwight D. Eisenhower
The best things are simple, but finding these simple things is not simple.
Good software, like wine, takes time. -Joel Spolsky
If it doesn^'t work, change the documentation.
If you can build it, your users can break it.
Inside every complex program is a simple program trying to get out.
Don^'t code today what you can^'t debug tomorrow.
Simplicity is the ultimate sophistication. -Leonardo da Vinci
On the 7th day ... God began debugging.
Documentation is like sex. When it^'s good, it^'s fantastic. When it^'s bad, it^'s still better than nothing.
Designing software in a team is like writing poetry in a committee meeting. -Joel Spolsky
Software is hard. -Donald Knuth
Deleted code is debugged code. -Jeff Sickel
No one hates software more than software developers. -Jeff Atwood
There are no significant bugs in our released software that any significant number of users want fixed. -Bill Gates
The Internet? Is that thing still around? -Homer Simpson
People who deal with bits should expect to get bitten. -Jon Bentley
Multitasking is the art of distracting yourself from two things you’d rather not be doing by doing them simultaneously.
Don^'t tell people how to do things, tell them what to do and let them surprise you with their results. -George S. Patton
^'Goto^' is always evil, like in ^'goto school^' or ^'goto work^'.
If we^'d asked the customers what they wanted, they would have said "faster horses". -Henry Ford
There is no IRL, only AFK
Good design adds value faster than it adds cost. -Thomas C. Gale
With all due respect John, I am the head of IT and I have it on good authority. If you type "Google" into Google, you can break the Internet. -Jen, "The IT Crowd"
If you can^'t explain something to a six-year-old, you really don^'t understand it yourself. -Albert Einstein
Pasting code from the Internet into production code is like chewing gum found in the street.
Simplicity is prerequisite for reliability. -Edsger Dijkstra
I have not failed. I^'ve just found 10,000 ways that won^'t work. -Thomas A. Edison
If you don^'t have time to do it right, when will you have time to do it over? -John Wooden, basketball coach
You start writing code, I^'ll go see what the customer wants
Think twice before you start programming or you will program twice before you start thinking.
If we^'re supposed to work in Hex, why have we only got A fingers?
Before software should be reusable, it should be usable. -Ralph Johnson
Better train people and risk they leave – than do nothing and risk they stay.
In order to understand recursion, one must first understand recursion.
Java is to JavaScript what Car is to Carpet. -Chris Heilmann
Walking on water and developing software from a specification are easy if both are frozen. -Edward V Berard
Mostly, when you see programmers, they aren^'t doing anything. One of the attractive things about programmers is that you cannot tell whether or not they are working simply by looking at them. Very often they^'re sitting there seemingly drinking coffee and gossiping, or just staring into space. What the programmer is trying to do is get a handle on all the individual and unrelated ideas that are scampering around in his head. -Charles M Strauss
Brevity is the soul of wit. -Shakespeare
An idiot with a computer is a faster, better idiot. -Rich Julius
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
sample aliases: