App-Cheats

 view release on metacpan or  search on metacpan

cheats.txt  view on Meta::CPAN


# Change boot loader to use certain cpu's (DES,UI,Mark,shielding)
cd /boot/grub
sudo vi grub.cfg
/\Vlinux /boot/vmlinuz-3.16.51+20180205+1524
/\Vlinux /boot/vmlinuz-3.16.51+20180205+1524
# Add this to
isolcpus=0,1,2,3,4,5,6,7,8,9
cat /proc/cmdline

# Check timer frequency (DES,UI,CONFIG_HZ_1000)
cat /usr/src/linux.config | OR CONFIG_COMPAT_BRK CONFIG_HZ_PERIODIC CONFIG_X86_GENERIC CONFIG_SCHED_SMT CONFIG_HZ_1000

# find biggest binary number on the machine
perl -lE '@a=split //, sprintf "%b",  ~~-1; print @a'
perl -lE '@a=split //, sprintf "%b",  ~~-1; print scalar @a'

# Size of an integer on this system
perl -le 'print length pack "i"'


cheats.txt  view on Meta::CPAN

# Prevent control-C from doing anything (signal)
abc(){ echo -e "\n\nNOPE"; }
trap abc SIGINT
<Control-C>

# Prompt on a control-C (signal handling)
signal_handler(){ echo -e "\n${RED}Caught Control-C$RESTORE "; read -p "Are you sure you want to abort? (y/n): " ans; [[ $ans =~ [yY]  ]] && echo "continue" || echo "exit"; }
trap signal_handler SIGINT
<Control-C>

# Create a timer in bash (aborts the session)
handler(){ echo "done"; exit 1; }
set_timer(){ (sleep $1; kill -ALRM $$)& }
trap handler SIGALRM
set_timer 5
while [ 1 ]; do echo $$; sleep 1; done

# Trap alarm signal
trap 'echo "Hit alarm"; break' SIGALRM
while true; do echo $$; sleep 1; done
# In another window:
kill -s ALRM 11657

# List of Bash signals and meanings.
Signal      Standard   Action   Comment

cheats.txt  view on Meta::CPAN

SIGINFO        -                A synonym for SIGPWR
SIGINT       P1990      Term    Interrupt from keyboard
SIGIO          -        Term    I/O now possible (4.2BSD)
SIGIOT         -        Core    IOT trap. A synonym for SIGABRT
SIGKILL      P1990      Term    Kill signal
SIGLOST        -        Term    File lock lost (unused)
SIGPIPE      P1990      Term    Broken pipe: write to pipe with no
                                readers; see pipe(7)
SIGPOLL      P2001      Term    Pollable event (Sys V);
                                synonym for SIGIO
SIGPROF      P2001      Term    Profiling timer expired
SIGPWR         -        Term    Power failure (System V)
SIGQUIT      P1990      Core    Quit from keyboard
SIGSEGV      P1990      Core    Invalid memory reference
SIGSTKFLT      -        Term    Stack fault on coprocessor (unused)
SIGSTOP      P1990      Stop    Stop process
SIGTSTP      P1990      Stop    Stop typed at terminal
SIGSYS       P2001      Core    Bad system call (SVr4);
                                see also seccomp(2)
SIGTERM      P1990      Term    Termination signal
SIGTRAP      P2001      Core    Trace/breakpoint trap

cheats.txt  view on Meta::CPAN

# Basics of using Deferred and Promise (JQuery,Deferred,Promises)
#
# Can check the progress of a deferred using notifications.
var deferred = $.Deferred().progress(function (value) {
   $('.progress').text(value + '%');
});
#
# Then send the notification:
deferred.notify(value);

# Promise based timer (JQuery,Deferred,Promises)
function timeout(milliseconds) {
	var deferred = $.Deferred();
	setTimeout(deferred.resolve, milliseconds);
	return deferred.promise();
}
timeout(1000).done(function() {
	alert('I waited for 1 second!');
});

# Wait for animations to finish (JQuery,Deferred,Promises)

cheats.txt  view on Meta::CPAN

In My.pmc


#############################################################
## Perl Modules - AnyEvent
#############################################################

# Simple exmplae of parallel processing
# (Perl Modules - AnyEvent)
# NOT WORKING!
perl -MAnyEvent -E 'my @files = (1..30); my $cv = AnyEvent->condvar; foreach my $file (@files) { $cv->begin; AnyEvent->timer(after => 0, cb => sub { say "Processing file $file"; sleep(1); $cv->end; }); } $cv->recv;'


#############################################################
## Perl Modules - Automake::Config
#############################################################

# Install Automake::Config (termux)
git clone git@github.com:poti1/arm-none-eabi.git
cd arm-none-eabi
cpanm --look automake-1.15.gz

cheats.txt  view on Meta::CPAN

#############################################################

# Promise usage
perl -Mojo -E "my $p = Mojo::Promise->new; $p->then(sub($robot,$human){ say qq(robot: $robot); say qq(human: $human); }, sub{ say qq!Rejected with: @_!} )->catch( sub{say qq!Error: @_!} ); $p->resolve(qw/Bender Fry Leela/); $p->wait"

# Simple Mojo promise example
perl -MMojo::Promise -E '$p = Mojo::Promise->new; $p->then(sub{say "OK"}); $p->resolve; $p->wait'
perl -MMojo::Promise -E '$p = Mojo::Promise->new; $p->then(sub{say "OK"}, sub{say "BAD"}); $p->resolve; $p->wait'
perl -MMojo::Promise -E '$p = Mojo::Promise->new; $p->then(sub{say "OK"}, sub{say "BAD"}); $p->reject; $p->wait'

# Simple Mojo promise example - timer (OK)/ timeout (BAD)
perl -MMojo::Promise -E "$p = Mojo::Promise->new; $p->then(sub{say 'OK'}, sub{say 'BAD'}); $p->timeout(1); $p->wait"
perl -MMojo::Promise -E "$p = Mojo::Promise->new; $p->then(sub{say 'OK'}, sub{say 'BAD'}); $p->timer(1); $p->wait"

# Chain of promises - short way, but not working for the 2nd level
perl -Mojo -MMojo::Promise -E "my $p = Mojo::Promise->new; $p->then(sub{say '1-OK'}, sub{say '1-BAD'})->then(sub{say '2-OK'}, sub{say '2-BAD'}); $p->reject; $p->wait"

# Chain of promises - long way
perl -Mojo -MMojo::Promise -E "my $p = Mojo::Promise->new; my $p2; $p2 = $p->then(sub{say '1-OK'; $p2->resolve}, sub{say '1-BAD'; $p2->reject}); $p2->then(sub{say '2-OK'}, sub{say '2-BAD'}); $p->reject; $p->wait"

# Using get_p (GET with a promise)
perl -Mojo -MMojo::Promise -E "my $ua = Mojo::UserAgent->new; $ua->get_p(shift)->then(sub{say qq(1-OK: @_)}, sub{say qq(1-BAD: @_)})->wait" mojolicious.org

cheats.txt  view on Meta::CPAN

lint

# Missing Node modules folder
npm install

# Setup vue webpack (many files)
npm install --global vue-cli
vue init webpack

# Vue - Watch for changes to this.$refs
this.$watch(() => this.timerRef ? this.timerRef.timer.time : null, (newTime, oldTime) => {
    console.log('Watched time: ', newTime, oldTime);
    this.$refs.form.values.AccountedTime = newTime;
});


#############################################################
## WII
#############################################################

# Write files/games to WII.



( run in 1.056 second using v1.01-cache-2.11-cpan-49f99fa48dc )