App-Cheats

 view release on metacpan or  search on metacpan

cheats.txt  view on Meta::CPAN

# Docker Kubernetes - Roles
# Check for permissions.
auth can-i delete nodes --as dev-user           # no
k auth can-i delete nodes                       # yes


#############################################################
## DOM
#############################################################

# DOM - Update the text of an iframe.
document.querySelector('iframe').contentDocument.querySelector('body').innerText += '\n' + text;

# DOM - Get the html content of an iframe.
document.querySelector('iframe').contentDocument.querySelector('body').innerHTML;
#
# Perl
$Selenium->switch_to_frame(
    $Selenium->find('//iframe')
)
my $HTML = $Selenium->find('//body')->get_attribute('innerHTML');
$Selenium->switch_to_frame()


## E


#############################################################
## FontForge
#############################################################

# FontForge program can update a .ttf file pixmap

cheats.txt  view on Meta::CPAN

# Default for "-L"
gcc -print-search-dirs

# Create shared library (.so)
gcc -Wall -fPIC -c *.c
gcc -shared -Wl,-soname,libctest.so.1 -o libctest.so.1.0   *.o

# Definition: (c programming,gcc)
# -fexceptions
#     Enable exception handling.  Generates extra code needed to propagate exceptions.  For some targets,
#     this implies GCC will generate frame unwind information for all functions, which can produce
#     significant data size overhead, although it does not affect execution.  If you do not specify this
#     option, GCC will enable it by default for languages like C++ which normally require exception
#     handling, and disable it for languages like C that do not normally require it.  However, you may need
#     to enable this option when compiling C code that needs to interoperate properly with exception
#     handlers written in C++.  You may also wish to disable this option if you are compiling older C++
#     programs that don't use exception handling.

# -l library (gcc option,flag,order)
# Search the library named library when linking.
#

cheats.txt  view on Meta::CPAN

    // Draw shape
    ctx.arc(centerX, centerY, radius, 0, 2 * Math.PI, false);
    ctx.fillStyle = '#ffffff'; // light grey
    ctx.fill();
}

# Create a simple CSS/HTML animation (blink an element)
.blink {
    animation: blinker 2s linear infinite;
}
@keyframes blinker {
  50% {
    opacity: 0.5;
  }
}

# Function to unshow the loading spinner
function hide_loading(){
    const screen = document.querySelector("#glass");
#
    if(screen.children.length){

cheats.txt  view on Meta::CPAN

  border-bottom: 2px solid #777;  /* dark */
  border-left:   2px solid #ccc;  /* light */
  border-right:  2px solid #ccc;  /* light */
  border-radius: 50%;
  height:        150px; /* Diameter of ring */
  width:         150px; /* Diameter of ring */
  margin-top:   -77px;  /* height/2 + border */
  margin-left:  -77px;  /* width/2  + border */
  animation:    spin 3s linear infinite;
}
@keyframes spin {
  0%   { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}


#############################################################
## Javascript - Strings
#############################################################

# Capitalize first letter of a word in Javascript

cheats.txt  view on Meta::CPAN

if [ -n "$PS1" ]; then
  bind 'set enable-bracketed-paste on'
fi

# Create a perl debug file. Watch parameters. view code around (v) (debugger)
cat > .perldb
@DB::typeahead = (
    '{{v',
  # 'c',
  # 'Nonstop',
  # 'frame=0',
);
parse_options('inhibit_exit=0');

# Go into a similar session as with python (debugger)
perl -de0

# Graphical perl debugger (only on lnxbr42)
perl -d:ptkdb -e 'print for 1..10'


cheats.txt  view on Meta::CPAN

has & and spaces
#
perl -MTemplate -E 'my $out; Template->new->process( \("[% id | uri %]"), { id => "has & and spaces" }, \$out); say $out'
has%20%26%20and%20spaces


#############################################################
## Perl Modules - Term::Animation
#############################################################

# Using a terminal animation framework
perl -MTerm::Animation -MCurses -E 'use v5.32; my $anim = Term::Animation->new; halfdelay(2); $anim->new_entity(shape => "<=0=>", position => [3,7,10], callback_args => [1,0,0,0], wrap => 1); while(1){ $anim->animate; my $in = getch(); last if $in eq...

# 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 )'

cheats.txt  view on Meta::CPAN


# Bind Enter/Carriage Return key (PTk)
$e->bind("<Return>"

# Swap button (PTk)
perl -MTk -le '$mw=MainWindow->new; for(1..3){my $b=$mw->Button(-text => "B$_", -width => 20)->pack; $b->configure(-command => sub{ ($n)=grep{$b[$_] eq $b}0..$#b; return unless $n > 0; @b[$n,$n-1]=@b[$n-1,$n]; $_->packForget for @b; $_->pack for @b})...

# Drag and swap buttons (PTk)
perl -MTk -le '$mw=MainWindow->new; my @b; sub id{my($n)=grep{$b[$_] eq $_[0]}0..$#b; $n} for(1..3){push @b, $mw->Button(-text => "B$_", -width => 20)->pack} $mw->bind("<ButtonRelease-1>",[sub{$m=id(shift); $n=id($mw->containing(@_)); @b[$m,$n]=@b[$n...

# Swap frames of buttons (PTk)
perl -MTk -le '$mw=MainWindow->new; my @b; sub id{my($n)=grep{$b[$_] eq $_[0]}0..$#b; $n} for my $fi(1..3){my $f=$mw->Frame->pack; push @b,$f; $f->Button(-text => "Btn - $fi - $_", -width => 20)->pack(-side => "left") for 1..3} $mw->bind("<ButtonRele...

# Notebook example 1. multiple pages/tabs (PTk)
perl -MTk -MTk::NoteBook -le '$nb=MainWindow->new->NoteBook->pack(-fill => "both", -expand => 1); @pgs = map { $nb->add("page$_", -label => "Page $_") } 0..5; $pgs[0]->Button(-text => "Button $_")->pack(-fill => "both") for 1..5; $pgs[1]->Label(-text...

# Notebook example 2. multiple pages/tabs (PTk)
# Command when clicking a page/tab
perl -MTk -MTk::NoteBook -le '$nb=MainWindow->new->NoteBook(-font => "Courier 14 bold")->pack(-fill => "both", -expand => 1); @pgs = map { $nb->add("page$_", -label => "Page $_") } 0..20; $pgs[0]->Button(-text => "Button $_")->pack(-fill => "both") f...

# Notebook example 3. multiple pages/tabs (PTk)

cheats.txt  view on Meta::CPAN

# N - specifies a real-time clock number (0-4 on the first CPU board,
#     and 0-2 on additional CPU boards)

# RTCP Commands (DES)
ats    Attach timing source to an FBS
chs    Change permissions for an FBS
cs     Configure an FBS
dts    Detach timing source from an FBS
rms    Remove an FBS
svs    Save scheduler configuration
vc     View minor cycle/major frame count
vr     View a rdevfs file configuration
vs     View scheduler configuration
rc     Start real-time clock
rd     Register a Coupled FBS device
sc     Stop real-time clock
stc    Set real-time clock values
gtc    Get real-time clock values
start  Start scheduling on an FBS
reg    Register a Closely-Coupled FBS timing device
resume Resume scheduling on an FBS

cheats.txt  view on Meta::CPAN

-n proc_name     process name
-o {halt|nohalt} halt FBS on overrun flag (default = nohalt)
-p priority      process priority
-r {cycle|task}  deadline origin flag  (default = cycle)
-s scheduler     FBS scheduler key
-t {in|ex}       include or exclude interrupt time in pm monitor
-v parameter     process initiation parameter
-x {av|mi|ma|al} performance monitor display option (default = average)

# RTCP Options (DES,rtcp he opt2)
-C cycles/frame  number of minor cycles per major frame
-D duration      clock tick duration  (default = 10us)
-G gid           effective group ID for FBS  (default = current user)
-I permissions   permissions for FBS in octal  (default = 0600)
-L soft_limit    soft overrun limit  (default = 0)
-M progs/cycle   maximum number of processes per minor cycle
-N progs/fbs     maximum number of processes per FBS
-O clock_ticks   number of clock ticks per minor cycle
-P {ON|OFF}      enable/disable performance monitor (default = OFF)
-R {-1 | 0 | 1}  reset process flag  (default = 0)
-S delay         time to delay, in seconds



( run in 1.206 second using v1.01-cache-2.11-cpan-e1769b4cff6 )