App-Cheats

 view release on metacpan or  search on metacpan

cheats.txt  view on Meta::CPAN

# like int() in perl.
# ceil() returns the smallest integer, but rounding up.
#
# ceil did not for so used this instead:
int total_pages = (amount + tool_limit - 1) / tool_limit;

# Cpp std::string for const char *
string myStr;
myStr.c_str();

# Raw string in CPP. Do not need to escape characters.
# R"ABC(TEXT)ABC";
#
R"sql(CREATE TABLE IF NOT EXISTS version (
	version INTEGER
);)sql"


#############################################################
## C,CPP - Templates
#############################################################

cheats.txt  view on Meta::CPAN

stat -c %h /run

# View the group id (GID) of a file.
stat -c %g ~/.vimrc


#############################################################
## Linux Commands - stty
#############################################################

# View the control character escapes
stty -a

# Fix terminal after doing a hard exit in a script (control-C).
reset
tset
stty echo


#############################################################
## Linux Commands - systemctl

cheats.txt  view on Meta::CPAN


# Change fond/colors of an xterm window
RESTORE='\033[0m'
RED='\033[00;31m'
GREEN='\033[00;32m'
YELLOW='\033[00;33m'
VIOLET='\033[00;35m'
TEAL='\033[00;36m'
GREY='\033[00;37m'

# View color ansi escapes with less (like Vim)
less -R file

# Make xterm text color bold
BOLD='\033[1m'

# Make xterm text color blink
BLINK='\033[5m'

# Move mouse to a specific location on the screen/xterm window (on lnxbr42)
xdotool mousemove 764 11

cheats.txt  view on Meta::CPAN

echo "A${v3:- }B"

# Trick/hack to prevent work sptting when assigning the output
# of a bash function to an array.
unset v; IFS=$'\n' read -r -d '' -a v < <(_build_AND_regex); declare -p v
#
# IFS=$'\n': This sets the Internal Field Separator (IFS) to newline (\n).
    This ensures that spaces in the output of _my_function won't cause
    word splitting.
# read -r -d '' -a v: This command reads input into the array variable v.
# -r: Prevents backslash escapes from being interpreted.
# -d '': Delimiter option set to an empty string. This ensures that
    read reads until it encounters a null byte (this effectively
    reads the whole output as a single line).
# -a v: Assigns the input to the array variable v.
# < <(_my_function): This redirects the output of _my_function to the
    read command.


#############################################################
## Bash - Ascii Art

cheats.txt  view on Meta::CPAN


# Using a terminal animation framework (with colors)
perl -MTerm::Animation -MCurses -E 'use v5.32; my $anim = Term::Animation->new; halfdelay(1); $anim->color(1); $anim->new_entity(shape => "<=0=>", position => [3,7,10], callback_args => [1,0,0,0], wrap => 1, default_color => "yellow"); while(1){ $ani...


#############################################################
## Perl Modules - Term::ANSIColor
#############################################################

# Proper way to color text in perl instead of hardcoding
# escape codes (which are not all the same on all devices).
perl -MTerm::ANSIColor -E 'say colored ($_,$_) for qw( RED YELLOW GREEN ON_BRIGHT_BLACK )'

# Color an remote color (uncolor).
perl -MTerm::ANSIColor=colored,colorstrip -E 'say length colorstrip(colored("HEY", "YELLOW"))'
3


#############################################################
## Perl Modules - Term::ProgressBar
#############################################################

cheats.txt  view on Meta::CPAN

:set

# History is not working (Vim)
# Check permissions of ~/.viminfo

# View man page (Vim,help)
:h

# Search for spaces (Vim)
/\s\+
# \+ since all are taken literally unless escaped

# If accidentally pressed <Control> + s (Vim)
# that will freeze the terminal. This is due to  "flow control"
# Do this to undo the effect:
<Control> + q
#
# To permanently disable this from occurring put this in .bashrc
stty -ixon

# Stop all output to terminal/xterm (Vim)



( run in 0.433 second using v1.01-cache-2.11-cpan-c21f80fb71c )