App-Cheats
view release on metacpan or search on metacpan
#############################################################
# Compile, link, and run assembly program on windows
nasm -fwin64 hello.asm && gcc hello.obj -o hello.exe && hello.exe
#############################################################
## Batch - Conditions
#############################################################
# If statement in windows 10 DOS (windows 10, command prompt)
if exist "C:\Program Files\Git\usr\bin\perl2.exe" (echo FOUND) else (echo not found)
# Batch check if file/folder exists (windows,dos)
set folder=D:\my\ncfile\dev\assets
echo %folder%
IF EXIST %folder% (
echo Yes;
echo 123;
) ELSE (
echo No;
echo 456;
)
# If else statement in windows 10 DOS (windows 10, command prompt)
if "%val%" == "-1" (
echo.
echo Error: No tool provided! tool="%tool%"
echo.
) else (
if "%val%" == "-2" (
echo.
echo Error: Tool "%tool%" is not found in the PATH!
echo.
) else (
dir E:\*.* /s /b /ad
# Recursively search through files
findstr /s /c cell *js
#############################################################
## Batch - Foreach Loop
#############################################################
# Windows 10 dos command prompt for each loop
for %a in (path-a, path-b, path-c) do (@echo %a)
#
# Use %%a inside a script (%a on the command line)
for %%a in (
path-a,
path-b,
path-c
) do (
@echo "[%%a]"
)
@echo off
for /f "tokens=*" %%A in ('perl -x -S -l %0 %*') do set my_path=%%A
echo Going to : %my_path%
cd %my_path%
#############################################################
## Batch - Strings
#############################################################
# Remove double quotes from a variable in dos (windows 10, command prompt)
set a="here is data"
set a=%a:"=%
echo %a%
# Split long commands unto multiple lines (windows 10,caret)
long command^
can be split^
this this
#############################################################
## Batch - Terminal
#############################################################
# Change the title of the command prompt window
title MY_TITLE
# Change the dimentions/size of a commmand prompt window (length,width)
mode con: cols=80 lines=10
# Temporarily chang ethe command prompt language to english
set LANG=US
# Enable ANSI colors in Windows 10 using system '' (magic!?)
perl -E "system ''; say qq(\033[35mHEY\033[0m)"
# Terminator config location
/home/tim/my/git/otrs/SETUP/terminator/config
#############################################################
# Reset/Change a users password (admin)
Log unto fs
sudo passwd xbexxxx
asdf1234
asdf1234
sudo make -C /var/yp
# Change root password
sudo passwd root
# Reset password in a script with no prompt (change)
# Can only supply one user to "passwd"
echo asdf1234 | sudo passwd xbe4092 --stdin; sudo make -C /var/yp
echo -e "xbe4092:asdf1234\npotapov:asdf1234" | sudo chpasswd; sudo make -C /var/yp
# Reset password over ssh (change,admin)
ssh -qtY potapov@lnxbrfs01 'echo -e "xbe4092:asdf123\npotapov:asdf123" | sudo /usr/sbin/chpasswd; sudo make -C /var/yp'
sb fs1 'echo -e "xbe4092:asdf123\npotapov:asdf123" | sudo /usr/sbin/chpasswd; sudo make -C /var/yp'
# Reset password of many users (admin,change)
echo "xbe4092:asdf1234" | sudo chpasswd
# Unlock a file
co -u file
# RCS error: file is in use
rm -f RCS/,file_name
# RCS error: file locked by pwxxxx
rcs -U file
# RCS: check in a file initially without the prompt message
ci -t-msg tiny2_rcs.tst
#############################################################
## Linux Commands - read
#############################################################
# Read input from the keyword/user without showing the password (much easier in bash)
read -s pass; echo "got [$pass]"
read -s -p "Password:" pass; echo; echo "got [$pass]"
# Check if xterm environment is working (Added: 2017-11-02 03:56:18 PM)
xeyes
# Check what kind of terminal I am using (xterm,bench)
echo $TERM
# Wrap long lines unto next row in bash/linux
# Exclose PS1 in '\[PS1_VALUE\]'
# Function which run on each prompt.
PROMPT_COMMAND=__prompt_command
__prompt_command ()
{
local EXIT="$?";
PS1=$_PS1;
if [ $EXIT != 0 ]; then
PS1+=$RED$'\u2716'$RESTORE
else
PS1+=$GREEN$'\u279c'$RESTORE
fi;
PS1+=" "
}
git diff :old :new
git diff :old new
# Compare exceptions template files for differences
cat ~/junk/exceptions | while read n; do ls -l $n~ $n; done
cat ~/junk/exceptions | while read n; do diff $n~ $n -qs; done
cat ~/junk/exceptions | while read n; do git diff $n~ $n; done
# Setup vimdiff as the default difftool
git config --global diff.tool vimdiff
git config --global difftool.prompt false
# Use vimdiff for seeing changes in git
git difftool commit1 commit2 file
# Ignore whitespace
git diff -w
#############################################################
## Git - Apply Commands
# Enable Restore Points in Windows 10
Win + r
Type: regedit
Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows NT\SystemRestore
Double - Click "DisableSR"
1 - Disabled
0 - Enabled
#
# Restart PC for changes to take effect.
# Add the "Open command window here" option back to windows 10 commamd prompt (registry,DOS)
# when doing right click.
#
# Go to the regestry
Win + r
type: regedit
#
# For these paths:
Computer\HKEY_CLASSES_ROOT\Directory\shell\cmd
Computer\HKEY_CLASSES_ROOT\Directory\background\shell\cmd
#
( run in 1.031 second using v1.01-cache-2.11-cpan-6aa56a78535 )