App-Cheats

 view release on metacpan or  search on metacpan

cheats.txt  view on Meta::CPAN

echo Abd | tr [:lower:] [:upper:]


#############################################################
## Linux Commands - useradd
#############################################################

# Create a new user account for BENCH
uid=$UID
user=SOME_USER
gid=123
/usr/sbin/useradd -u $uid -g $gid -d /home/$user -m $user
passwd SOME_USER          # asdf1234

# Create new user accounts
i=1001
for u in potapov SOME_USER; do
   /usr/sbin/useradd -u $i -g systems -d /home3/$u -m $u -s /bin/bash
   let "i++"
done
# run 'passwd $u' for each user

cheats.txt  view on Meta::CPAN


# Remove all users accounts in a list
# $a contains a list of "username - home_directory"
echo "$a" | while read u h; do echo -e "\n# Deleting $u\n"; sudo userdel -r $u; done


#############################################################
## Linux Commands - usermod
#############################################################

# Change group id of a user (DES,gid)
sudo usermod -g 1000 potapov

# Change user id of a user (DES,uid)
sudo usermod -u 10285 potapov

# Add user to a new group/groups (passwd)
Log unto fs01
sudo usermod -a -G controls,system potapov
sudo make -C /var/yp

cheats.txt  view on Meta::CPAN

# -a <FILE>  True if <FILE> exists. (not recommended, may collide with -a for AND, see below)
# -e <FILE>  True if <FILE> exists.
# -f <FILE>  True, if <FILE> exists and is a regular file.
# -d <FILE>  True, if <FILE> exists and is a directory.
# -c <FILE>  True, if <FILE> exists and is a character special file.
# -b <FILE>  True, if <FILE> exists and is a block special file.
# -p <FILE>  True, if <FILE> exists and is a named pipe (FIFO).
# -S <FILE>  True, if <FILE> exists and is a socket file.
# -L <FILE>  True, if <FILE> exists and is a symbolic link.
# -h <FILE>  True, if <FILE> exists and is a symbolic link.
# -g <FILE>  True, if <FILE> exists and has sgid bit set.
# -u <FILE>  True, if <FILE> exists and has suid bit set.
# -r <FILE>  True, if <FILE> exists and is readable.
# -w <FILE>  True, if <FILE> exists and is writable.
# -x <FILE>  True, if <FILE> exists and is executable.
# -s <FILE>  True, if <FILE> exists and has size bigger than 0 (not empty).
# -t <fd>  True, if file descriptor <fd> is open and refers to a terminal.
# <FILE1> -nt <FILE2>  True, if <FILE1> is newer than <FILE2> (mtime).
# <FILE1> -ot <FILE2>  True, if <FILE1> is older than <FILE2> (mtime).
# <FILE1> -ef <FILE2>  True, if <FILE1> and <FILE2> refer to the same device and inode numbers.

cheats.txt  view on Meta::CPAN

}

# Process killing example:
perl -E '$pid = fork; if (!$pid){ say "[$$] child", sleep 1 while 1 } else {  say "[$$] parent"; waitpid $pid, 0; say "[$$] parent end" }'
perl -E '$pid = fork; if (!$pid){ say "[$$] child", sleep 1 while 0; say "start"; system qq(google-chrome --headless --virtual-time-budget=15000 --window-size=200,200 --screenshot=$ENV{HOME}/Downloads/my.png log); say "wait"; sleep 10 } else {  say "...
#
perl -E 'for ( shift ) { say kill 0, $_; sleep 1; say kill -9, $_; sleep 1; say kill 0, $_ }' 3022126


#############################################################
## Perl Functions - getpwnam, getgrent, getgrnam, getgrgid
#############################################################

# UID in scalar context, all fields in list
perl -lE '$a=getpwnam("<USER>"); say $a'
perl -lE 'say for getpwnam("<USER>")'

# Group name entry
perl -lE 'say getgrent'

# Get name
perl -lE 'say for getgrnam("systems")'

# Group ID
perl -lE 'say for getgrgid("systems")'

# Get password file entry for a username (check if they exist)
perl -le 'print for getpwnam "<USER>"'


#############################################################
## Perl Functions - local
#############################################################

# Can use local actually with a lexical/my variable.

cheats.txt  view on Meta::CPAN

-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
-T deadline      deadline microseconds (default = "Clear")
-U uid           effective user ID for FBS  (default = current user)



( run in 0.844 second using v1.01-cache-2.11-cpan-5735350b133 )