From 8b9f202a77c1bc8d3b0ea50cadbb00d9916e7683 Mon Sep 17 00:00:00 2001 From: Hassan Afify Date: Fri, 7 Feb 2020 23:42:21 +0300 Subject: [PATCH] [feat] bashrc, record_screen, create_c_proj modified: .bashrc modified: .scripts/create_c_proj.sh modified: .scripts/record_screen.sh modified: .surf/styles/github.css modified: .vimrc --- .bashrc | 4 -- .scripts/create_c_proj.sh | 162 ++++++++++++---------------------------------- .scripts/record_screen.sh | 4 +- .surf/styles/github.css | 2 +- .vimrc | 7 +- 5 files changed, 49 insertions(+), 130 deletions(-) diff --git a/.bashrc b/.bashrc index 1aa4d3e..5c39173 100644 --- a/.bashrc +++ b/.bashrc @@ -9,10 +9,6 @@ alias cp='cp -ir' alias rm='rm -i' alias mkdir='mkdir -p' alias xc='xclip -sel clip' -alias f='~/.scripts/find.sh' -alias g='~/.scripts/gpg.sh' -alias fw='~/.scripts/find_word.sh' -alias fr='~/.scripts/find_replace_word.sh' alias fonts="fc-list | sed 's/^.*: //' | sort" if [[ $(uname) == "OpenBSD" ]]; then diff --git a/.scripts/create_c_proj.sh b/.scripts/create_c_proj.sh index 791c1dd..f756e8e 100755 --- a/.scripts/create_c_proj.sh +++ b/.scripts/create_c_proj.sh @@ -14,21 +14,16 @@ git remote add github git@github.com:Afify/$proj.git > /dev/null # Create License #============================================================================== -echo "MIT License - -Copyright (c) $year Hassan Afify - -Permission is hereby granted, free of charge, to any person obtaining a copy +echo -e "MIT License\n\nCopyright (c) $year Hassan Afify +\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all +\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +\nTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER @@ -38,92 +33,37 @@ SOFTWARE." > ./LICENSE # Create Makefile #============================================================================== -echo "# $Proj -# See LICENSE file for copyright and license details. - -include config.mk - -SRC = $proj.c -OBJ = \${SRC:.c=.o} - -all: options $proj - -options: - @echo $proj build options: - @echo \"CFLAGS = \$(STCFLAGS)\" - @echo \"LDFLAGS = \$(STLDFLAGS)\" - @echo \"CC = \$(CC)\" - -config.h: - cp config.def.h config.h - -.c.o: - \$(CC) \$(STCFLAGS) -c \$< - -$proj.o: config.h - -\$(OBJ): config.h config.mk - -$proj: \$(OBJ) - \$(CC) -o \$@ \$(OBJ) \$(STLDFLAGS) - -clean: - rm -f \$(OBJ) $proj - -install: $proj - mkdir -p \$(DESTDIR)\$(PREFIX)/bin - cp -f $proj \$(DESTDIR)\$(PREFIX)/bin - chmod 755 \$(DESTDIR)\$(PREFIX)/bin/$proj +echo -e "# $Proj\n# See LICENSE file for copyright and license details. +\ninclude config.mk\n\nSRC = $proj.c\nOBJ = \${SRC:.c=.o}\n\nall: options $proj +\noptions:\n @echo $proj build options:\n @echo \"CFLAGS = \$(STCFLAGS)\" + @echo \"LDFLAGS = \$(STLDFLAGS)\"\n @echo \"CC = \$(CC)\"\n\nconfig.h: + cp config.def.h config.h\n\n.c.o:\n \$(CC) \$(STCFLAGS) -c \$<\n\n$proj.o: config.h +\n\$(OBJ): config.h config.mk\n\n$proj: \$(OBJ)\n \$(CC) -o \$@ \$(OBJ) \$(STLDFLAGS) +\nclean:\n rm -f \$(OBJ) $proj\n\ninstall: $proj\n mkdir -p \$(DESTDIR)\$(PREFIX)/bin + cp -f $proj \$(DESTDIR)\$(PREFIX)/bin\n chmod 755 \$(DESTDIR)\$(PREFIX)/bin/$proj mkdir -p \$(DESTDIR)\$(MANPREFIX)/man1 sed \"s/VERSION/\$(VERSION)/g\" < $proj.1 > \$(DESTDIR)\$(MANPREFIX)/man1/$proj.1 - chmod 644 \$(DESTDIR)\$(MANPREFIX)/man1/$proj.1 - -uninstall: - rm -f \$(DESTDIR)\$(PREFIX)/bin/$proj - rm -f \$(DESTDIR)\$(MANPREFIX)/man1/proj.1 - -.PHONY: all clean install uninstall"> ./Makefile + chmod 644 \$(DESTDIR)\$(MANPREFIX)/man1/$proj.1\n\nuninstall: + rm -f \$(DESTDIR)\$(PREFIX)/bin/$proj\n rm -f \$(DESTDIR)\$(MANPREFIX)/man1/$proj.1 +\n.PHONY: all clean install uninstall"> ./Makefile # Create config.mk #============================================================================== -echo "# $proj version -VERSION = 0.1 - -# Customize below to fit your system - -# paths -PREFIX = /usr/local -MANPREFIX = \$(PREFIX)/share/man - -#includes and libs -STD = -std=c99 -WARN = -pedantic -Wall -Wno-deprecated-declarations -Os -# WARN = -bench -Wall -Werror -Wunusupported -Wwrite-strings -LIBS = -lm - -# flags +echo -e "# $proj version\nVERSION = 0.1\n\n# Customize below to fit your system +\n# paths\nPREFIX = /usr/local\nMANPREFIX = \$(PREFIX)/share/man\n\n#includes and libs +STD = -std=c99\nWARN = -pedantic -Wall -Wno-deprecated-declarations -Os +# WARN = -bench -Wall -Werror -Wunusupported -Wwrite-strings\nLIBS = -lm\n\n# flags STCFLAGS = \$(STD) \$(WARN) -DVERSION=\\\"\${VERSION}\\\" -D_POSIX_C_SOURCE=200809L -STLDFLAGS= \$(LIBS) \$(LDFLAGS) - -# compiler and linker -CC = cc -# CC = tcc"> ./config.mk +STLDFLAGS= \$(LIBS) \$(LDFLAGS)\n\n# compiler and linker\nCC = cc\n# CC = tcc"> ./config.mk # Create gitignore #============================================================================== -echo "$proj -*.db -*.txt -*.log -.o" > ./.gitignore +echo -e "$proj\n*.db\n*.txt\n*.log\n*.o\n.gitignore" > ./.gitignore # Create Readme #============================================================================== -echo "$Proj -==== -$proj is a simple {description} - -Installation +echo -e "$Proj\n====\n$proj is a simple {description} +\nInstallation ------------ \`\`\`sh $ git clone https://github.com/Afify/$proj.git @@ -131,40 +71,33 @@ $ cd $proj/ $ make $ sudo make install \`\`\` - -Run +\nRun --- \`\`\`sh \$ $proj \`\`\` - -Options +\nOptions ------- \`\`\`sh \$ $proj [-vah] \$ man $proj \`\`\` - -Configuration +\nConfiguration ------------- The configuration of $proj is done by creating a custom config.h and (re)compiling the source code. - -Philosophy, Contribution & Code Style +\nPhilosophy, Contribution & Code Style ------------------------------------- - [Contribution]. -- [Philosophy]. -- [Code Style]. - -Ask Questions +- [Philosophy]. +- [Code Style]. +\nAsk Questions ------------- You are welcome to submit questions and bug reports as Github Issues. - -Copyright and License +\nCopyright and License --------------------- $Proj is provided under the MIT license. - -[Contribution]: +\n[Contribution]: [Philosophy]: [Code Style]: " > ./README.md @@ -193,33 +126,20 @@ prints usage help. $proj is customized by creating a custom config.h and (re)compiling the source code. This keeps it fast, secure and simple. .SH AUTHORS -https://github.com/Afify +hassan@afify.dev .SH ISSUES https://github.com/Afify/$proj/issues"> ./$proj.1 # Create config.def #============================================================================== -echo "/* See LICENSE file for copyright and license details.*/ - -#ifndef CONFIG_H -#define CONFIG_H - - - -#endif /* CONFIG_H */"> ./config.def.h +echo -e "/* See LICENSE file for copyright and license details.*/\n +#ifndef CONFIG_H\n#define CONFIG_H\n\n\n\n#endif /* CONFIG_H */"> ./config.def.h # Create c file #============================================================================== -echo "/* See LICENSE file for copyright and license details. */ - -/* macros */ -/* typedef */ -/* function declarations */ -/* function implementations */ - -int -main(void) -{ - - return 0; -}"> ./$proj.c +echo -e "/* See LICENSE file for copyright and license details. */\n +#include \n#include \"config.h\"\n +/* macros */\n/* typedef */\n/* function declarations */\nstatic void usage(void); +\n/* function implementations */\nstatic void\nusage(void)\n{ +(void)fputs("usage: $proj [-v] init \n", stderr);\n exit(EXIT_SUCCESS);\n } +\nint\nmain(void)\n//main(int argc, char *argv[])\n{\n\n return 0;\n}"> ./$proj.c diff --git a/.scripts/record_screen.sh b/.scripts/record_screen.sh index c9c8c35..36ca44b 100755 --- a/.scripts/record_screen.sh +++ b/.scripts/record_screen.sh @@ -2,12 +2,12 @@ save_at="$HOME/captured" time_date=$(date +'%Y_%m_%d_%H_%M_%S') -# monitor_size="1920x1080" monitor_size="1056x1080" frate="25" +hide_mouse="-draw_mouse 0" encoding="libx264 -preset ultrafast" +# monitor_size="1920x1080" # encoding="ffvhuff" -# hide_mouse="-draw_mouse 0" is_running=$(pgrep ffmpeg | wc -l ) if [[ $is_running -eq 0 ]]; then diff --git a/.surf/styles/github.css b/.surf/styles/github.css index 0002a7b..628cb2b 100644 --- a/.surf/styles/github.css +++ b/.surf/styles/github.css @@ -279,5 +279,5 @@ body .blob-code-inner{color: #777777 !important;} body .traffic-graph,.graph-canvas,.traffic-graph-stats {background:#000 !important;} ul.Box.mb-3{background:#000 !important;color:#777 !important;} summary.btn,.btn-sm,.btn-dange{color:red !important;} -a.menu-item{background:#000 !important;color:#777 !important;} +a.menu-item,.copyable-terminal, .UnderlineNav{background:#000 !important;color:#777 !important;} a.btn,.btn-sm,.btn-primary{background:#28a745 !important; color:#fff !important} diff --git a/.vimrc b/.vimrc index 32addc0..3eb0e7f 100644 --- a/.vimrc +++ b/.vimrc @@ -114,7 +114,7 @@ nnoremap J J nnoremap K K " Search -nnoremap f :set hlsearch/^[a-z].*(.*)$ +nnoremap f :set hlsearch/^[a-z*].*(.*)$ nnoremap o :set hlsearch!/\%80v.\+/ nnoremap s :set hlsearch! nnoremap * *zz @@ -137,6 +137,7 @@ nnoremap Z :set foldmethod=syntaxzR " Syntastic nnoremap a :SyntasticCheck +nnoremap A :SyntasticToggleMode nnoremap n :lnext " Custom functions @@ -145,6 +146,8 @@ nnoremap c :call Clean_file() nnoremap r :set rightleft nnoremap R :set norightleft +nnoremap g :GitGutterSignsToggle + " surround word nnoremap ' i"ea" nnoremap " i"A" @@ -158,7 +161,7 @@ noremap ; : "============================================================================== set laststatus=2 set statusline=\ %F%#StatusLine_g#\ %m%#StatusLine_r#\ %r%*%= -set statusline+=%y\ %{&encoding}\ %{&fileformat} +set statusline+=%y\ %{&encoding}\ %{&fileformat}\ %c " Warnings set statusline+=%#StatusLine_o# -- 2.11.4.GIT