App-Cheats
view release on metacpan or search on metacpan
# Enable "Smooth Scrolling" in Chrome
chrome://flags/
Enable: #smooth-scrolling
#
# Does not appear to make a difference on the pi.
# View chrome case information (debug)
chrome://net-internals
# Force Chrome to reload the website and not use the cache (page,renderStatic)
Control + F5
Open the previous page from your browsing history in the current tab (Chrome)
Alt + Left arrow
# Allow running local files in Chrome on Windows 10
# Close all Chrome windows
cd "C:\Program Files (x86)\Google\Chrome\Application"
chrome.exe --allow-file-access-from-files
# Chrome Full Screen Mode
F11
# Create a link in the console which can be opened in the browser (hyperlink,terminal)
using Control+Click
file://absolute_path
# Install Chrome on Ubuntu
#
# Add Key:
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
#
# Set repository:
echo 'deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main' | sudo tee /etc/apt/sources.list.d/google-chrome.list
#
# Install package:
sudo apt-get update
sudo apt-get install google-chrome-stable
# Hide/Show favorites tab in Chrome.
Control + Shift + B
#############################################################
## CSS - Anchor
#############################################################
# CSS to keep an element anchor on the top side
position: absolute;
top: 15%;
#############################################################
## CSS - Blur
#############################################################
# Blur/Unblur (CSS,style)
# blanket is a direct child of body
function blur () {
document.querySelector("#blanket").className = "overlay";
}
function unblur () {
document.querySelector("#blanket").className = "";
}
.overlay{
position: absolute;
width: 100%;
height: 100%;
z-index: 10;
background-color: rgba(0,0,0,0.5); /*dim the background*/
}
#############################################################
## CSS - Box
#############################################################
# Create an empty (check) box using CSS
h1::before {
border: 2px solid black;
width: 1rem;
height: 1rem;
content: "";
box-sizing: border-box;
display: inline-block;
border-radius: 15%;
margin-right: 1rem;
}
#############################################################
## CSS - Center
#############################################################
# Center a child of unknown width and height (CSS,style)
# both vertically and horizontally
.parent {
position: relative;
}
.child {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
#############################################################
## CSS - Debug
#############################################################
# Show the element placement/position (css,color)
# Debug html/table
* { border: 1px dashed blue }
#############################################################
## CSS - Display
#############################################################
# Content inside an element is shown vertically. (CSS)
# This will make it be horizontal (spread out).
display: contents;
SIGURG P2001 Ign Urgent condition on socket (4.2BSD)
SIGUSR1 P1990 Term User-defined signal 1
SIGUSR2 P1990 Term User-defined signal 2
SIGVTALRM P2001 Term Virtual alarm clock (4.2BSD)
SIGXCPU P2001 Core CPU time limit exceeded (4.2BSD);
see setrlimit(2)
SIGXFSZ P2001 Core File size limit exceeded (4.2BSD);
see setrlimit(2)
SIGWINCH - Ign Window resize signal (4.3BSD, Sun)
#############################################################
## Bash - Variables (Special)
#############################################################
# Return status $? (true/false are built-in commands)
true; echo $?
false; echo $?
# Note however that local var=$(command) will (bash)
NOT return the exit code. Instead you need to do
local var;
var=$(command)
# In bash, setting a variable in a subshell
# does not affect the outer shell.
v=1; echo $v; (echo $v; v=2; echo $v; ); echo $v
1
1
2
1
#
# An approach around this is to set the variable
# inside the function.
fun(){ echo $v; v=2; echo $v; }; v=1; echo $v; fun; echo $v
# In bash return 0 means no error. return 1 means error
abc(){ return 0; }; abc && echo "OK" || echo "BAD"
abc(){ return 1; }; abc && echo "OK" || echo "BAD"
# Check if using Bash
echo $0
#############################################################
## Bash - Variables (User)
#############################################################
# Example of using a local variable
n=aaa; echo "1. n = $n"; a(){ m=$n; local n=xyz; echo "2. m = $m"; echo "3. n = $n"; }; a; echo "4. n = $n";
1. n = aaa
2. m = aaa
3. n = xyz
4. n = aaa
# Find out how many characters(length) are in a bash variable
n1=abcd
echo ${#n1}
# Remove from variable bash normal shortest
a="g2s -i ppb.gloascii -allow_overlays -ignore_errors"
echo ${a#*-}
# Remove from variable bash normal longest
a="g2s -i ppb.gloascii -allow_overlays -ignore_errors"
echo ${a##*-}
# Remove from variable bash reverse shortest
a="g2s -i ppb.gloascii -allow_overlays -ignore_errors"
echo ${a%-*}
# Remove from variable bash reverse longest
a="g2s -i ppb.gloascii -allow_overlays -ignore_errors"
echo ${a%%-*}
# View all bash variable with a matching name
echo ${!a*}
# Bash variable replacement uses:
echo "${f/\.mid}" # Replace first occurrence
echo "${f//\.mid}" # Replace all occurrences
echo "${f%\.mid}" # Remove shortest match from end
echo "${f%%\.mid}" # Remove longest match from end
echo "${f#\.mid}" # Remove shortest match from beginning
echo "${f##\.mid}" # Remove longest match from beginning
# Assign to multiple bash variables at once (list assignment)
# This uses process substitution <<<
# Can be thought of as < and <<HERE_DOC together
# Whatever is on the right is expected to be a string and
# it get fed into the STDIN on the command (read in this case).
read var1 var2 <<< $(echo "one two"); echo $var1 $var2
# Replace an occurence of a pattern in a bash variable
name=a_b_c
echo ${name/_/}
# Replace all occurences of a pattern in a bash variable
# (using double folder slash).
name=a_b_c
echo ${name//_/}
# Bash range expansion
echo {1..10}
for n in {1..10}; do echo $n; done
#############################################################
## Bash - While Loop
#############################################################
# While do bash readline
ls -1 | head -1 | while read line; do uicfgcheck $line; done
# read multiple words froma line in bash
while read keyfile hexkey junk; do echo "1[$keyfile] 2[$hexkey] 3[$junk]"; done
# Bash Bug when using a while loop.
# Inside of a loop not affecting outside
a="OUT"
echo "1: $a"
cat $tmp_list | while read line; do
echo "2: $a"
a="IN"
echo "3: $a"
done
echo "4: $a"
# 4: OUT !!!
#
# A fix is to do this instead
a="OUT"
echo "1: $a"
while read line; do
( run in 1.490 second using v1.01-cache-2.11-cpan-5b529ec07f3 )