mirror of
https://github.com/autistic-symposium/shell-whiz-toolkit.git
synced 2025-05-13 04:02:18 -04:00
add some stuff from RC machine config
This commit is contained in:
parent
7095235fe8
commit
54e3254e41
44 changed files with 23 additions and 8 deletions
|
@ -1 +0,0 @@
|
|||
clear;while :;do echo $LINES $COLUMNS $(($RANDOM%$COLUMNS));sleep 0.1;done|gawk '{a[$3]=0;for(x in a) {o=a[x];a[x]=a[x]+1;printf "\033[%s;%sH ",o,x;printf "\033[%s;%sH*\033[0;0H",a[x],x;}}'
|
|
@ -1,3 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
echo -e "\e[1;40m" ; clear ; while :; do echo $LINES $COLUMNS $(( $RANDOM % $COLUMNS)) $(( $RANDOM % 72 )) ;sleep 0.05; done|gawk '{ letters="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#$%^&*()"; c=$4; letter=substr(letters,c,1);a[$3]=0;for (x in a) {o=a[x];a[x]=a[x]+1; printf "\033[%s;%sH\033[2;32m%s",o,x,letter; printf "\033[%s;%sH\033[1;37m%s\033[0;0H",a[x],x,letter;if (a[x] >= $1) { a[x]=0; } }}'
|
|
@ -1 +0,0 @@
|
|||
clear;x=$(($COLUMNS/2));y=$(($LINES/2));c=0;n=1;a=90;while :;do bgc=$(($c%232 + 16));case "$a" in 0)xd=0;yd=-1;n=$(($n+1));; 90)xd=1;yd=0;; 180)xd=0;yd=1;n=$(($n+1));; 270)xd=-1;yd=0 ;; *) break ;; esac; for ((i=0;i < $n;i++));do if [[ $x -ge $COLUMNS || $x -le 0 || $y -ge $LINES || $y -le 0 ]]; then x=$(($COLUMNS/2));y=$(($LINES/2));n=1;a=0; continue ; fi ; printf "\033[%s;%sH\033[48;5;%sm \033[0m" $y $x $bgc ; x=$(( $x + $xd )); y=$(( $y + $yd )); done ; c=$(( $c + 1 )); a=$(( $(( $a + 90 )) % 360 )) ; sleep 0.001; done
|
|
@ -1,6 +0,0 @@
|
|||
#!/bin/bash
|
||||
input_variable = 'test'
|
||||
read -p "Commit message?" input_variable
|
||||
git add -A
|
||||
git commit -m "$input_variable"
|
||||
git push origin master
|
|
@ -1,4 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
|
||||
ssh-add ~/.ssh/git/git_rsa
|
|
@ -1,53 +0,0 @@
|
|||
Data Manipulation
|
||||
-----------------
|
||||
|
||||
|
||||
Print elements in the column 3 that has the word "good" in the other columns
|
||||
$ awk '/good/ { print $3 }' inventory
|
||||
|
||||
Syntax:
|
||||
$ awk -f {PROGRAM FILE} FILENAME
|
||||
|
||||
awk program is:
|
||||
|
||||
PATTERN{
|
||||
ACTION 1
|
||||
ACTION 2
|
||||
ACTION 3
|
||||
}
|
||||
|
||||
|
||||
. (Dot) Match any character
|
||||
* Match zero or more character
|
||||
^ Match beginning of line
|
||||
$ Match end of line
|
||||
\ Escape character following
|
||||
[ ] List
|
||||
{ } Match range of instance
|
||||
+ Match one more preceding
|
||||
? Match zero or one preceding
|
||||
| Separate choices to match
|
||||
|
||||
|
||||
|
||||
IF CONDITION
|
||||
------------
|
||||
|
||||
if (condition)
|
||||
{
|
||||
Statement 1
|
||||
Statement 2
|
||||
Statement N
|
||||
if condition is TRUE
|
||||
}
|
||||
else
|
||||
{
|
||||
Statement 1
|
||||
Statement 2
|
||||
Statement N
|
||||
if condition is FALSE
|
||||
}
|
||||
|
||||
|
||||
FOR LOOP
|
||||
--------
|
|
@ -1,41 +0,0 @@
|
|||
For files with many columns:
|
||||
===========================
|
||||
|
||||
$ cut -f2 NAMEFILE --> display the second column
|
||||
$ cut -f1 NAMEFILE --> display first column
|
||||
$ paste FILE1 FILE2 --> join the columns together of two files
|
||||
$ join FILE1 FILES2 --> join separate files but only if there is common field in both files with identical values
|
||||
|
||||
|
||||
Changing the contend of files:
|
||||
==============================
|
||||
|
||||
CHARACTERS:
|
||||
----------
|
||||
|
||||
$ tr "h2" "3x" < FILENAME --> changes all h to 3 and all 2 to x
|
||||
|
||||
|
||||
WORDS:
|
||||
------
|
||||
$ sed expression file
|
||||
$ sed '/tea/s//milk/g' FILENAME
|
||||
|
||||
/tea/ --> find tea word
|
||||
s//milk/ --> replace (substitute) the word milk for tea
|
||||
g --> make the changes globally
|
||||
|
||||
|
||||
DUPLICATES:
|
||||
-----------
|
||||
|
||||
Print LINES that are unique.
|
||||
$ uniq FILENAME
|
||||
|
||||
Duplicate lines must be next to next to each other, so it's better to sort first:
|
||||
$ sort FILENAME | uniq
|
||||
|
||||
|
||||
Ex
|
||||
--
|
||||
$ ex FILENAME --> start the editor
|
|
@ -1,21 +0,0 @@
|
|||
# awk -f FILEAWK FILELIST
|
||||
|
||||
BEGIN{
|
||||
}
|
||||
|
||||
#
|
||||
# main logic is here
|
||||
#
|
||||
{
|
||||
sfile = $1
|
||||
dfile = $2
|
||||
cpcmd = "cp " $1 " " $2
|
||||
printf "Coping %s to %s\n",sfile,dfile
|
||||
system(cpcmd)
|
||||
}
|
||||
|
||||
#
|
||||
# End action, if any, e.g. clean ups
|
||||
#
|
||||
END{
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
# awk -f for_loop.awk
|
||||
|
||||
BEGIN {
|
||||
printf "To test for loop\n"
|
||||
printf "Press CTRL + C to stop\n"
|
||||
}
|
||||
{
|
||||
for(i=0;i<NF;i++)
|
||||
{
|
||||
printf "Welcome %s, %d times.\n" ,ENVIRON["USER"], i
|
||||
}
|
||||
}
|
|
@ -1,8 +0,0 @@
|
|||
|
||||
# awk -f math1
|
||||
{
|
||||
no1 = $1
|
||||
no2 = $2
|
||||
ans = $1 + $2
|
||||
print no1 " + " no2 " = " ans
|
||||
}
|
|
@ -1,30 +0,0 @@
|
|||
# awk -f math2
|
||||
|
||||
BEGIN {
|
||||
myprompt = "(To Stop press CTRL+D) > "
|
||||
printf "Welcome to MyAddtion calculation awk program v0.1\n"
|
||||
printf "%s" ,myprompt
|
||||
}
|
||||
|
||||
{
|
||||
no1 = $1
|
||||
op = $2
|
||||
no2 = $3
|
||||
ans = 0
|
||||
|
||||
if ( op == "+" )
|
||||
{
|
||||
ans = $1 + $3
|
||||
printf "%d %c %d = %d\n" ,no1,op,no2,ans
|
||||
printf "%s" ,myprompt
|
||||
}
|
||||
else
|
||||
{
|
||||
printf "Opps!Error I only know how to add.\nSyntax: number1 + number2\n"
|
||||
printf "%s" ,myprompt
|
||||
}
|
||||
}
|
||||
|
||||
END {
|
||||
printf "\nGoodbye, %s\n !" , ENVIRON["USER"]
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue