├── vimb ├── queue ├── search ├── cookies.db ├── open-download-pdf └── closed ├── _config.yml ├── gitstats ├── domains.dat ├── commits_by_year.dat ├── commits_by_year_month.dat ├── arrow-up.gif ├── domains.png ├── sortable.js ├── arrow-down.gif ├── arrow-none.gif ├── day_of_week.dat ├── day_of_week.png ├── gitstats.cache ├── hour_of_day.png ├── files_by_date.png ├── lines_of_code.png ├── month_of_year.png ├── commits_by_year.png ├── commits_by_author.png ├── files_by_date.dat ├── commits_by_year_month.png ├── commits_by_author.dat ├── lines_of_code_by_author.png ├── month_of_year.dat ├── lines_of_code.dat ├── lines_of_code_by_author.dat ├── hour_of_day.dat ├── hour_of_day.plot ├── day_of_week.plot ├── month_of_year.plot ├── commits_by_year.plot ├── domains.plot ├── lines_of_code.plot ├── files_by_date.plot ├── commits_by_year_month.plot ├── commits_by_author.plot ├── lines_of_code_by_author.plot ├── tags.html ├── lines.html └── index.html ├── .mutt ├── Archives │ └── .notmuch │ │ └── xapian │ │ ├── flintlock │ │ ├── iamglass │ │ ├── postlist.glass │ │ └── termlist.glass ├── macros └── mailcap ├── show_wifi_networks ├── public_ip.sh ├── link_quality_wifi ├── deploy ├── detail_wifi_connection_state ├── cpu_fan_sensor.sh ├── mp4_to_mp3.sh ├── sign_multiple_rpm_with_single_step ├── uptime ├── modified_files.sh ├── show_wifi_device_property ├── get_local_ip ├── i3-scripts ├── pgp.sh ├── user.sh ├── hostname.sh ├── public-ip.sh ├── kernel_feed.sh ├── process_hog.sh ├── batt_warn ├── mpv_stat ├── mem_use.sh ├── song_name_display_mpv_loop ├── conky-i3bar ├── essid.sh ├── mail.sh ├── cmus.sh ├── servpros ├── process.sh ├── vpn.sh ├── clock ├── uptime.sh ├── battery.sh ├── dhcp.sh ├── date_time.sh ├── song_name_display ├── util.sh ├── rss.sh ├── update.sh ├── calendar.sh ├── diskio.sh ├── cpu_temp.sh ├── wea.sh └── batt.sh ├── find_hard_link.sh ├── git_broken_commit.sh ├── git_diff_wrapper ├── show_msh_at_term ├── README.md ├── find_gpg_pubkey_for_rpm ├── git-com-vrfy ├── .vifm ├── .vifmrc.un~ ├── scripts │ ├── .imgc.un~ │ ├── .imgt.un~ │ ├── imgc │ ├── README │ └── imgt ├── vim │ ├── ftdetect │ │ ├── vifm-rename.vim │ │ └── vifm.vim │ ├── ftplugin │ │ ├── vifm-edit.vim │ │ └── vifm-cmdedit.vim │ ├── autoload │ │ └── vifm │ │ │ └── edit.vim │ └── doc │ │ └── tags └── colors │ ├── dmilith-root.vifm │ ├── dmilith-user.vifm │ ├── reicheltd-light.vifm │ ├── juef-zenburn.vifm │ ├── istib-solarized-dark.vifm │ ├── astrell-root.vifm │ └── astrell-user.vifm ├── capture_net_traffic.sh ├── ff_database_clear.sh ├── list_sv_commit_user_date ├── xfs_stat ├── .vim ├── spell │ ├── en.utf-8.sug │ ├── en.utf-8.add.spl │ └── en.utf-8.add ├── pack │ └── customization │ │ └── opt │ │ └── ctrlp.vim-1.79 │ │ └── .gitignore ├── bash-support │ ├── README.bashsupport │ ├── codesnippets │ │ ├── create-tempfile │ │ ├── timestamp │ │ ├── check-for-unsigned-integer │ │ ├── debugging │ │ │ ├── _debug_print_pos_param │ │ │ ├── _debug_assert │ │ │ ├── _debug_function.noindent │ │ │ ├── _debug_timestamp.noindent │ │ │ └── _debug_PS4 │ │ ├── check-for-signed-integer │ │ ├── basename+pathname │ │ ├── check-number-of-command-line-arguments │ │ ├── use-file-descriptor-write │ │ ├── use-file-descriptor-read │ │ ├── free-software-comment │ │ ├── create-tempfile-with-trap │ │ ├── _trap_EXIT │ │ ├── _trap_ERR │ │ ├── _trap_RETURN │ │ ├── _trap_DEBUG │ │ ├── create-tempfile-in-secure-manner │ │ ├── usage-and-command-line-arguments.noindent │ │ └── well-behaved-script │ ├── rc │ │ ├── customization.bashrc │ │ └── sample_template_file │ └── templates │ │ ├── set.templates │ │ ├── specialparams.templates │ │ ├── shelloptions.templates │ │ └── builtins.templates ├── autoload │ └── bash-support │ │ ├── codesnippets │ │ ├── create-tempfile │ │ ├── timestamp │ │ ├── check-for-unsigned-integer │ │ ├── debugging │ │ │ ├── _debug_print_pos_param │ │ │ ├── _debug_assert │ │ │ ├── _debug_function.noindent │ │ │ ├── _debug_timestamp.noindent │ │ │ └── _debug_PS4 │ │ ├── check-for-signed-integer │ │ ├── basename+pathname │ │ ├── check-number-of-command-line-arguments │ │ ├── use-file-descriptor-write │ │ ├── use-file-descriptor-read │ │ ├── free-software-comment │ │ ├── create-tempfile-with-trap │ │ ├── _trap_EXIT │ │ ├── _trap_ERR │ │ ├── _trap_RETURN │ │ ├── _trap_DEBUG │ │ ├── create-tempfile-in-secure-manner │ │ ├── usage-and-command-line-arguments.noindent │ │ └── well-behaved-script │ │ ├── README.bashsupport │ │ ├── rc │ │ ├── customization.bashrc │ │ └── sample_template_file │ │ └── templates │ │ ├── set.templates │ │ ├── specialparams.templates │ │ ├── shelloptions.templates │ │ └── builtins.templates ├── bundle │ ├── .vundle │ │ └── script-names.vim-scripts.org.json │ └── grep-operator.vim ├── .netrwhist └── colors │ ├── default.vim │ └── pablo.vim ├── mp4TOmp3Conv.sh ├── vimwiki ├── .vimrc.gpg.wiki ├── Muttrc.gpg.wiki ├── bashrc.gpg.wiki ├── screenrc.gpg.wiki ├── gitconfigs.gpg.wiki ├── home_bashrc.gpg.wiki ├── .Sed_Oneliner.wiki.swp ├── Home_Router_Info.gpg.wiki ├── bash_browse_dev_tcp.wiki ├── twitter_backup_code.gpg.wiki ├── boot_from_grub_rescue_prompt.gpg.wiki ├── make-linux-fast-boot-parameter.wiki ├── set_capability.wiki ├── boot_from_grub_prompt.asc.wiki ├── gpg-backup-restore-keys.wiki ├── Home_Router_Info.wiki ├── userContent.css_firefox.wiki ├── userChrome.css_firefox.wiki ├── moving_from_one_kernel_version_to_another.wiki ├── AWS_Tutorial.wiki ├── Pictures.wiki ├── debian_package_inspection_method.wiki ├── wpa_cli_procedure.wiki ├── Videos.wiki ├── important_files.wiki ├── Music.wiki └── pristime_gentoo_amd64_system_build_steps.wiki ├── kernel_module_list.sh ├── manual_view_in_pdf ├── find_init ├── git-com ├── git-log ├── showlog ├── check_ssl_conn ├── top_ten_mem_hog.sh ├── top10_largest_file_open.sh ├── get_rid_space_from_filename ├── pv_vg_mapping.sh ├── random_hostname_with_ip_create.sh ├── HN_scripts ├── hn_urls ├── hn_url_content ├── remove_urls ├── extract_url_by_awk ├── hn_show └── hn_hlines ├── tripwire_report ├── find_inode_of_filesystem ├── key_send ├── most_freq_command_from_history ├── multi_file_ftp ├── pdfnote ├── ff_cpu_lim.sh ├── gtk_dialog_button_fix.sh ├── lwn_urls ├── htmlnote ├── firefox_log_cleanup ├── learn_spam.sh ├── single_repo_status ├── bulk_rename.sh ├── firefox_http_log_capture.sh ├── get_freeswap.sh ├── check_docker_image_tags ├── home_vol ├── get_freemem ├── backup-exclusions.txt ├── git_commiter_info.sh ├── big_pkg_list.sh ├── gen_selfsign_cert ├── mysql_slow_query ├── files_find_by_date ├── trailing_spaces_removed ├── recent_files ├── remotehost_file_open_with_vim ├── check_kernel_version_in_nixos.sh ├── user_activity ├── cyradm_in_expect.sh ├── files_cretd_accesd_specific_date.sh ├── config_list ├── find_executables.sh ├── gitcompu ├── org-capture ├── gpg-backup-restore-keys ├── random_file_creation.sh ├── remove_old_header_image.sh ├── screencast ├── lwn_headlines ├── youtube_video_to_mp3_conv.sh ├── irssi_autorejoin.sh ├── log_inof_of_specific_drive.sh ├── uninstall-swiftfox.sh.sh ├── youtube-dl_update ├── fix_gpg_agent_IPC_error ├── tripwire.sh ├── open-download-pdf ├── missing_command_check ├── suse_old_kernel_remove ├── nagios_downtime_cli ├── ffmpeg_noise_reduction ├── ffmpeg_static_text_on_video ├── filter_hostile_ip_from_log.pl ├── rdiff-backup.sh ├── nmap_ping ├── spinner.sh ├── git_project_creation.sh ├── clean_old_kernel_stuff ├── httpd_restart.sh ├── disk_usage_monitor.sh ├── firmware_update.sh ├── root_uid_change ├── httpd_apache_restart_segfault ├── unmount_disk ├── daemon-status ├── process_info.py ├── user_Add.sh ├── sys.py ├── getopts.sh ├── download_progress ├── notmuch_database_upgrade.sh ├── ssh-everywhere.sh ├── kubernetes-install.sh ├── measure_website_response ├── csr.py ├── install_flash_player.sh ├── install_flash_player.sh.sh ├── git_clone_download ├── latest_chromium.sh ├── which_git_commit_last_touched_the_file ├── get_latest_chromium.sh ├── rename_mysql_root_usr ├── check_uid_pass.py ├── screenrc ├── notify_config_file_updates ├── ff_database_optimize.sh ├── firefox_in_ram ├── decoding_url.sh ├── Gentoo_Linux_Update ├── Slackware_Update_Script ├── file_tar_menu.py ├── encrypt_log.sh ├── memory_leak_dectection.sh ├── atop_log_clear.sh ├── wireless_info.sh ├── decrypt_log.sh ├── netconnect ├── system_service_status.sh ├── pull_down_dotfiles.sh ├── kernel_remove_on_deb_system.sh ├── busybox-rootfs ├── search_permission.py ├── mount_disks ├── userChrome.css ├── delete_file_by_inode.sh ├── archive ├── mail_compose_send_by_emacs.sh ├── extract_archive ├── setup-sftp-user ├── ffmpeg_cut ├── check_lvm.py ├── tools ├── firefox_key_combinations ├── linux_wikis_search ├── check_top_process.sh └── github_repo_creation /vimb/queue: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /vimb/search: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-hacker -------------------------------------------------------------------------------- /gitstats/domains.dat: -------------------------------------------------------------------------------- 1 | gmail.com 1 6 2 | -------------------------------------------------------------------------------- /.mutt/Archives/.notmuch/xapian/flintlock: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /gitstats/commits_by_year.dat: -------------------------------------------------------------------------------- 1 | 2016 6 2 | -------------------------------------------------------------------------------- /show_wifi_networks: -------------------------------------------------------------------------------- 1 | nmcli dev wifi 2 | 3 | -------------------------------------------------------------------------------- /public_ip.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | curl ifconfig.me 4 | -------------------------------------------------------------------------------- /gitstats/commits_by_year_month.dat: -------------------------------------------------------------------------------- 1 | 2016-09 4 2 | 2016-11 2 3 | -------------------------------------------------------------------------------- /link_quality_wifi: -------------------------------------------------------------------------------- 1 | iwconfig wlan0 | grep -i --color quality 2 | -------------------------------------------------------------------------------- /deploy: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | git commit -a && git push origin master 3 | -------------------------------------------------------------------------------- /detail_wifi_connection_state: -------------------------------------------------------------------------------- 1 | nmcli connection show "gnu_linux" 2 | -------------------------------------------------------------------------------- /cpu_fan_sensor.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | watch -n 1 -d sensors 4 | 5 | -------------------------------------------------------------------------------- /mp4_to_mp3.sh: -------------------------------------------------------------------------------- 1 | for f in *;do flac -cd $f |lame -b 128 - $f.mp3;done 2 | -------------------------------------------------------------------------------- /sign_multiple_rpm_with_single_step: -------------------------------------------------------------------------------- 1 | rpm --resign `find . -name *.rpm` 2 | -------------------------------------------------------------------------------- /uptime: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | uptime | gawk '{print $2"="$3 $4}' | tr -d , 3 | -------------------------------------------------------------------------------- /modified_files.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | find / -mtime -1 -ls | head -n 20 4 | -------------------------------------------------------------------------------- /show_wifi_device_property: -------------------------------------------------------------------------------- 1 | nmcli -f GENERAL,WIFI-PROPERTIES dev show wlan0 2 | -------------------------------------------------------------------------------- /get_local_ip: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ip a | grep inet | grep en | gawk '{print $2}' 3 | -------------------------------------------------------------------------------- /i3-scripts/pgp.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | echo ": B23A9DB7114B2915" 4 | 5 | -------------------------------------------------------------------------------- /find_hard_link.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | find / -links +2 -type f -exec ls -li {} \; 4 | -------------------------------------------------------------------------------- /git_broken_commit.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | git fsck --no-dangling --connectivity-only 4 | -------------------------------------------------------------------------------- /git_diff_wrapper: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | dfi=$(command -v vimdiff) 4 | 5 | $dfi "$1" "$2" -------------------------------------------------------------------------------- /show_msh_at_term: -------------------------------------------------------------------------------- 1 | echo "DISPLAY=$DISPLAY xmessage -cente 'msg'" | at "NOW + 1 min" 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # AdminScripts 2 | Collection of scripts use for infrastructure maintenance 3 | -------------------------------------------------------------------------------- /find_gpg_pubkey_for_rpm: -------------------------------------------------------------------------------- 1 | rpm -qa gpg-pubkey\* --qf "%{version}-%{release} %{summary}\n" 2 | -------------------------------------------------------------------------------- /git-com-vrfy: -------------------------------------------------------------------------------- 1 | git verify-commit --verbose `git log -1 | grep commit | gawk '{ print $2}'` 2 | -------------------------------------------------------------------------------- /vimb/cookies.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unixbhaskar/AdminScripts/HEAD/vimb/cookies.db -------------------------------------------------------------------------------- /.mutt/macros: -------------------------------------------------------------------------------- 1 | 2 | pager \cb 'urlview' 'Follow links with urlview' 3 | 4 | -------------------------------------------------------------------------------- /.vifm/.vifmrc.un~: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unixbhaskar/AdminScripts/HEAD/.vifm/.vifmrc.un~ -------------------------------------------------------------------------------- /capture_net_traffic.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | tcpdump -i enp5s0 -s 0 -A tcp port http -vvv 4 | 5 | -------------------------------------------------------------------------------- /ff_database_clear.sh: -------------------------------------------------------------------------------- 1 | for %a in \(*.sqlite\) do \(/usr/local/bin/sqlite3-3.6.17.bin %a vacuum\) 2 | -------------------------------------------------------------------------------- /i3-scripts/user.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | usr=`whoami` 4 | echo "$usr" 5 | -------------------------------------------------------------------------------- /list_sv_commit_user_date: -------------------------------------------------------------------------------- 1 | svn log -r{2011-08-01}:HEAD|awk '$14 ~/line/ {print $3}'|sort|uniq -c 2 | -------------------------------------------------------------------------------- /gitstats/arrow-up.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unixbhaskar/AdminScripts/HEAD/gitstats/arrow-up.gif -------------------------------------------------------------------------------- /gitstats/domains.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unixbhaskar/AdminScripts/HEAD/gitstats/domains.png -------------------------------------------------------------------------------- /gitstats/sortable.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unixbhaskar/AdminScripts/HEAD/gitstats/sortable.js -------------------------------------------------------------------------------- /xfs_stat: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | printf "XFS stats... \n\n" 4 | 5 | sudo cat /proc/fs/xfs/stat -------------------------------------------------------------------------------- /.vifm/scripts/.imgc.un~: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unixbhaskar/AdminScripts/HEAD/.vifm/scripts/.imgc.un~ -------------------------------------------------------------------------------- /.vifm/scripts/.imgt.un~: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unixbhaskar/AdminScripts/HEAD/.vifm/scripts/.imgt.un~ -------------------------------------------------------------------------------- /.vifm/vim/ftdetect/vifm-rename.vim: -------------------------------------------------------------------------------- 1 | autocmd BufRead,BufNewFile vifm.rename* :set filetype=vifm-rename 2 | -------------------------------------------------------------------------------- /.vim/spell/en.utf-8.sug: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unixbhaskar/AdminScripts/HEAD/.vim/spell/en.utf-8.sug -------------------------------------------------------------------------------- /gitstats/arrow-down.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unixbhaskar/AdminScripts/HEAD/gitstats/arrow-down.gif -------------------------------------------------------------------------------- /gitstats/arrow-none.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unixbhaskar/AdminScripts/HEAD/gitstats/arrow-none.gif -------------------------------------------------------------------------------- /gitstats/day_of_week.dat: -------------------------------------------------------------------------------- 1 | 1 Mon 1 2 | 2 Tue 3 3 | 3 Wed 0 4 | 4 Thu 1 5 | 5 Fri 0 6 | 6 Sat 1 7 | 7 Sun 0 8 | -------------------------------------------------------------------------------- /gitstats/day_of_week.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unixbhaskar/AdminScripts/HEAD/gitstats/day_of_week.png -------------------------------------------------------------------------------- /gitstats/gitstats.cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unixbhaskar/AdminScripts/HEAD/gitstats/gitstats.cache -------------------------------------------------------------------------------- /gitstats/hour_of_day.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unixbhaskar/AdminScripts/HEAD/gitstats/hour_of_day.png -------------------------------------------------------------------------------- /i3-scripts/hostname.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | machine_os=$(uname -n) 4 | 5 | echo $machine_os 6 | -------------------------------------------------------------------------------- /mp4TOmp3Conv.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | for i in *.mp4 3 | do 4 | ffmpeg -i "$i" -ab 128k "${i%mp4}mp3" 5 | done 6 | -------------------------------------------------------------------------------- /vimwiki/.vimrc.gpg.wiki: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unixbhaskar/AdminScripts/HEAD/vimwiki/.vimrc.gpg.wiki -------------------------------------------------------------------------------- /vimwiki/Muttrc.gpg.wiki: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unixbhaskar/AdminScripts/HEAD/vimwiki/Muttrc.gpg.wiki -------------------------------------------------------------------------------- /vimwiki/bashrc.gpg.wiki: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unixbhaskar/AdminScripts/HEAD/vimwiki/bashrc.gpg.wiki -------------------------------------------------------------------------------- /gitstats/files_by_date.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unixbhaskar/AdminScripts/HEAD/gitstats/files_by_date.png -------------------------------------------------------------------------------- /gitstats/lines_of_code.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unixbhaskar/AdminScripts/HEAD/gitstats/lines_of_code.png -------------------------------------------------------------------------------- /gitstats/month_of_year.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unixbhaskar/AdminScripts/HEAD/gitstats/month_of_year.png -------------------------------------------------------------------------------- /kernel_module_list.sh: -------------------------------------------------------------------------------- 1 | awk '{print $1}' "/proc/modules" | xargs modinfo | awk '/^(filename|desc|depends)/' 2 | -------------------------------------------------------------------------------- /vimwiki/screenrc.gpg.wiki: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unixbhaskar/AdminScripts/HEAD/vimwiki/screenrc.gpg.wiki -------------------------------------------------------------------------------- /.vim/spell/en.utf-8.add.spl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unixbhaskar/AdminScripts/HEAD/.vim/spell/en.utf-8.add.spl -------------------------------------------------------------------------------- /gitstats/commits_by_year.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unixbhaskar/AdminScripts/HEAD/gitstats/commits_by_year.png -------------------------------------------------------------------------------- /i3-scripts/public-ip.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | PubIP=$(wget http://ipinfo.io/ip -qO -) 4 | echo $PubIP 5 | 6 | -------------------------------------------------------------------------------- /manual_view_in_pdf: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | man -k . | dmenu -l 30 | gawk '{print $1}' | xargs -r man -Tpdf | zathura - & -------------------------------------------------------------------------------- /vimwiki/gitconfigs.gpg.wiki: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unixbhaskar/AdminScripts/HEAD/vimwiki/gitconfigs.gpg.wiki -------------------------------------------------------------------------------- /vimwiki/home_bashrc.gpg.wiki: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unixbhaskar/AdminScripts/HEAD/vimwiki/home_bashrc.gpg.wiki -------------------------------------------------------------------------------- /.vim/pack/customization/opt/ctrlp.vim-1.79/.gitignore: -------------------------------------------------------------------------------- 1 | *.markdown 2 | *.zip 3 | note.txt 4 | tags 5 | .hg* 6 | tmp/* 7 | -------------------------------------------------------------------------------- /gitstats/commits_by_author.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unixbhaskar/AdminScripts/HEAD/gitstats/commits_by_author.png -------------------------------------------------------------------------------- /gitstats/files_by_date.dat: -------------------------------------------------------------------------------- 1 | 2016-09-13 1 2 | 2016-09-13 108 3 | 2016-09-15 109 4 | 2016-11-12 110 5 | 2016-11-14 111 6 | -------------------------------------------------------------------------------- /vimwiki/.Sed_Oneliner.wiki.swp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unixbhaskar/AdminScripts/HEAD/vimwiki/.Sed_Oneliner.wiki.swp -------------------------------------------------------------------------------- /gitstats/commits_by_year_month.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unixbhaskar/AdminScripts/HEAD/gitstats/commits_by_year_month.png -------------------------------------------------------------------------------- /vimwiki/Home_Router_Info.gpg.wiki: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unixbhaskar/AdminScripts/HEAD/vimwiki/Home_Router_Info.gpg.wiki -------------------------------------------------------------------------------- /.vim/bash-support/README.bashsupport: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unixbhaskar/AdminScripts/HEAD/.vim/bash-support/README.bashsupport -------------------------------------------------------------------------------- /.vim/bash-support/codesnippets/create-tempfile: -------------------------------------------------------------------------------- 1 | TMPFILE=$( mktemp /tmp/example.XXXXXXXXXX ) || exit 1 2 | 3 | rm --force $TMPFILE 4 | -------------------------------------------------------------------------------- /find_init: -------------------------------------------------------------------------------- 1 | strings /sbin/init | 2 | awk 'match($0, /(systemd|sysvinit)/) { print toupper(substr($0, RSTART, RLENGTH));exit; }' 3 | -------------------------------------------------------------------------------- /git-com: -------------------------------------------------------------------------------- 1 | git add `git status | grep modified | grep md | gawk '{print $2}'` && git commit -a -S -m && git-com-vrfy && git logline 2 | -------------------------------------------------------------------------------- /git-log: -------------------------------------------------------------------------------- 1 | log --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit 2 | -------------------------------------------------------------------------------- /gitstats/commits_by_author.dat: -------------------------------------------------------------------------------- 1 | 1473742198 1 2 | 1473742936 2 3 | 1473743201 3 4 | 1473923988 4 5 | 1478962559 5 6 | 1479108521 6 7 | -------------------------------------------------------------------------------- /gitstats/lines_of_code_by_author.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unixbhaskar/AdminScripts/HEAD/gitstats/lines_of_code_by_author.png -------------------------------------------------------------------------------- /showlog: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | while IFS=: read user _; do 4 | last "$user" | grep pts | head -n 1 5 | done /dev/tcp/www.google.com/80 3 | netstat -anpt | grep 80 | grep bash 4 | cat <&3 5 | 6 | -------------------------------------------------------------------------------- /vimwiki/twitter_backup_code.gpg.wiki: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unixbhaskar/AdminScripts/HEAD/vimwiki/twitter_backup_code.gpg.wiki -------------------------------------------------------------------------------- /.mutt/Archives/.notmuch/xapian/iamglass: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unixbhaskar/AdminScripts/HEAD/.mutt/Archives/.notmuch/xapian/iamglass -------------------------------------------------------------------------------- /.vim/bash-support/codesnippets/timestamp: -------------------------------------------------------------------------------- 1 | 2 | timestamp=$(date +"%Y%m%d-%H%M%S") # generate timestamp : YYYYMMDD-hhmmss 3 | 4 | -------------------------------------------------------------------------------- /check_ssl_conn: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | url=$1 3 | port="443" 4 | printf "Checking .....\n\n\n" 5 | 6 | openssl s_client -connect $url:$port 7 | -------------------------------------------------------------------------------- /gitstats/month_of_year.dat: -------------------------------------------------------------------------------- 1 | 1 0 2 | 2 0 3 | 3 0 4 | 4 0 5 | 5 0 6 | 6 0 7 | 7 0 8 | 8 0 9 | 9 4 10 | 10 0 11 | 11 2 12 | 12 0 13 | -------------------------------------------------------------------------------- /i3-scripts/kernel_feed.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ~/.config/i3/feed.sh | tr -d "< />" | sed 's/title//g' | grep -v "^Latest" | dmenu -l 10 3 | -------------------------------------------------------------------------------- /top_ten_mem_hog.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ps aux | awk '{if ((NR > 1)&&($5!=0)) print $1, $2, $3, $5, $11}' | sort -k4nr | head -n 10 4 | -------------------------------------------------------------------------------- /.vim/autoload/bash-support/codesnippets/create-tempfile: -------------------------------------------------------------------------------- 1 | TMPFILE=$( mktemp /tmp/example.XXXXXXXXXX ) || exit 1 2 | 3 | rm --force $TMPFILE 4 | -------------------------------------------------------------------------------- /.vim/bash-support/codesnippets/check-for-unsigned-integer: -------------------------------------------------------------------------------- 1 | if [[ $number =~ ^[0-9]+$ ]] ; then 2 | echo -e "match found : integer\n" 3 | fi 4 | -------------------------------------------------------------------------------- /gitstats/lines_of_code.dat: -------------------------------------------------------------------------------- 1 | 1473742198 2 2 | 1473742936 2 3 | 1473743201 6202 4 | 1473923988 6243 5 | 1478962559 6257 6 | 1479108521 6258 7 | -------------------------------------------------------------------------------- /top10_largest_file_open.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | lsof / | awk '{ if($7 > 1048576) print $7/1048576 "MB" " " $9 " " $1 }' | sort -n -u | tail 4 | -------------------------------------------------------------------------------- /.vim/autoload/bash-support/codesnippets/timestamp: -------------------------------------------------------------------------------- 1 | 2 | timestamp=$(date +"%Y%m%d-%H%M%S") # generate timestamp : YYYYMMDD-hhmmss 3 | 4 | -------------------------------------------------------------------------------- /get_rid_space_from_filename: -------------------------------------------------------------------------------- 1 | find . -depth -name '* *' | while IFS= read -r f ; do mv -i "$f" "$(dirname "$f")/$(basename "$f"|tr ' ' _)" ; done 2 | -------------------------------------------------------------------------------- /pv_vg_mapping.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | #get it from stackoverflow, a note to myself 3 | 4 | /sbin/pvdisplay -C --separator ' | ' -o pv_name,vg_name 5 | -------------------------------------------------------------------------------- /.mutt/Archives/.notmuch/xapian/postlist.glass: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unixbhaskar/AdminScripts/HEAD/.mutt/Archives/.notmuch/xapian/postlist.glass -------------------------------------------------------------------------------- /.mutt/Archives/.notmuch/xapian/termlist.glass: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unixbhaskar/AdminScripts/HEAD/.mutt/Archives/.notmuch/xapian/termlist.glass -------------------------------------------------------------------------------- /.vifm/vim/ftdetect/vifm.vim: -------------------------------------------------------------------------------- 1 | autocmd BufRead,BufNewFile vifmrc :set filetype=vifm 2 | autocmd BufRead,BufNewFile *vifm/colors/* :set filetype=vifm 3 | -------------------------------------------------------------------------------- /.vim/autoload/bash-support/README.bashsupport: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unixbhaskar/AdminScripts/HEAD/.vim/autoload/bash-support/README.bashsupport -------------------------------------------------------------------------------- /.vim/autoload/bash-support/codesnippets/check-for-unsigned-integer: -------------------------------------------------------------------------------- 1 | if [[ $number =~ ^[0-9]+$ ]] ; then 2 | echo -e "match found : integer\n" 3 | fi 4 | -------------------------------------------------------------------------------- /.vim/bash-support/codesnippets/debugging/_debug_print_pos_param: -------------------------------------------------------------------------------- 1 | # print the positional parameters 2 | printf "'%b'\n" "$0" "$@" | nl -v0 -s': ' 3 | 4 | -------------------------------------------------------------------------------- /gitstats/lines_of_code_by_author.dat: -------------------------------------------------------------------------------- 1 | 1473742198 2 2 | 1473742936 3 3 | 1473743201 6203 4 | 1473923988 6244 5 | 1478962559 6258 6 | 1479108521 6259 7 | -------------------------------------------------------------------------------- /random_hostname_with_ip_create.sh: -------------------------------------------------------------------------------- 1 | P=1; 2 | for i in $(seq -w 200); do echo "192.168.99.$P n$i"; P=$(expr $P + 1); 3 | done >>/home/bhaskar/hosts 4 | -------------------------------------------------------------------------------- /vimwiki/boot_from_grub_rescue_prompt.gpg.wiki: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unixbhaskar/AdminScripts/HEAD/vimwiki/boot_from_grub_rescue_prompt.gpg.wiki -------------------------------------------------------------------------------- /.vim/bash-support/codesnippets/check-for-signed-integer: -------------------------------------------------------------------------------- 1 | if [[ $number =~ ^[+-]?[0-9]+$ ]] ; then 2 | echo -e "match found : (signed) integer\n" 3 | fi 4 | -------------------------------------------------------------------------------- /.vim/autoload/bash-support/codesnippets/debugging/_debug_print_pos_param: -------------------------------------------------------------------------------- 1 | # print the positional parameters 2 | printf "'%b'\n" "$0" "$@" | nl -v0 -s': ' 3 | 4 | -------------------------------------------------------------------------------- /.vim/autoload/bash-support/codesnippets/check-for-signed-integer: -------------------------------------------------------------------------------- 1 | if [[ $number =~ ^[+-]?[0-9]+$ ]] ; then 2 | echo -e "match found : (signed) integer\n" 3 | fi 4 | -------------------------------------------------------------------------------- /HN_scripts/hn_urls: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | extract_url_by_awk ~/.hn_headlines.output | tr -d ">" > ~/hnurls 4 | cat ~/hnurls | dmenu -l 10 | xargs -I {} setsid -f vimb {} -------------------------------------------------------------------------------- /tripwire_report: -------------------------------------------------------------------------------- 1 | #/usr/bin/env bash 2 | 3 | last_tw_report=$(ls -t /var/lib/tripwire/report/* | head -1) 4 | 5 | tripwire --update -r $last_tw_report 6 | 7 | 8 | -------------------------------------------------------------------------------- /i3-scripts/process_hog.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | pid=$(ps aux | sort -k 4 -r | head -n2 | gawk '{ print $2 , $11 }' | tr -d "PID" | tr -d "COMMAND") 4 | 5 | echo "MemHog:" $pid -------------------------------------------------------------------------------- /find_inode_of_filesystem: -------------------------------------------------------------------------------- 1 | #find . -xdev -type d -exec /bin/echo -n {} \; -exec sh -c "ls {} | wc -l" \; 2 | 3 | find . -xdev -type d -exec /bin/echo -n {} \; -exec sh -c "ls -i {}" \; 4 | 5 | -------------------------------------------------------------------------------- /.vim/bash-support/codesnippets/basename+pathname: -------------------------------------------------------------------------------- 1 | basename=${pathname##*/} 2 | dirname=${pathname%/*} 3 | filename=${basename%%.*} 4 | lastextension=${basename##*.} 5 | allextensions=${basename#*.} 6 | -------------------------------------------------------------------------------- /key_send: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | servers="x-hkp://pool.sks-keyservers.net wwwkeys.ch.pgp.net" 3 | for server in $servers; do 4 | gpg2 --keyserver $server --send-key "your_pgp_or_gpg_key_here" 5 | done -------------------------------------------------------------------------------- /most_freq_command_from_history: -------------------------------------------------------------------------------- 1 | 2 | history|awk '{print $2}'|sort|uniq -c|sort -rn|head -30|awk '!max{max=$1;}{r="";i=s=100*$1/max;while(i-->0)r=r"#";printf "%50s %5d %s %s",$2,$1,r,"\n";}' 3 | 4 | -------------------------------------------------------------------------------- /multi_file_ftp: -------------------------------------------------------------------------------- 1 | # lftp ftp_host 2 | > user ftp_user ftp_pass 3 | > mirror source target (download entire directory tree) 4 | > mirror -R source target (reverse mirror; upload entire directory tree) 5 | -------------------------------------------------------------------------------- /HN_scripts/hn_url_content: -------------------------------------------------------------------------------- 1 | vim -c "%s#'##g" /home/bhaskar/.hn_headlines.output -c wq 2 | gawk -v x="$(cat "/home/bhaskar/.hn_headlines.output")" '{print} /declare/{print x }' ~/bin/hn_show > ~/.hn_headlines -------------------------------------------------------------------------------- /pdfnote: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | NOTES=/home/bhaskar/Notes/pdfs/ 4 | 5 | find $NOTES -iname "*.pdf" -type f -newermt $(date '+%F') -ls | gawk '{ print $11}' | sort -f -i -r | head -1 | xargs -I {} zathura {} -------------------------------------------------------------------------------- /vimwiki/make-linux-fast-boot-parameter.wiki: -------------------------------------------------------------------------------- 1 | 2 | noibrs noibpb nopti nospectre_v2 nospectre_v1 l1tf=off nospec_store_bypass_disable no_stf_barrier mds=off tsx=on tsx_async_abort=off mitigations=off 3 | 4 | -------------------------------------------------------------------------------- /.vim/autoload/bash-support/codesnippets/basename+pathname: -------------------------------------------------------------------------------- 1 | basename=${pathname##*/} 2 | dirname=${pathname%/*} 3 | filename=${basename%%.*} 4 | lastextension=${basename##*.} 5 | allextensions=${basename#*.} 6 | -------------------------------------------------------------------------------- /ff_cpu_lim.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if `ps -ef | grep firefox` 4 | echo "firefox is running." 5 | then 6 | `/usr/local/bin/cpulimit -e firefox -l 40`& 7 | echo "limiting the cpu usage by 40%" 8 | 9 | fi -------------------------------------------------------------------------------- /gtk_dialog_button_fix.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | gsettings set org.gnome.settings-daemon.plugins.xsettings overrides "{'Gtk/DialogsUseHeader': <0>, 'Gtk/ShellShowsAppMenu'ose:menu,maximize'>}"nLayout': <'cl 4 | 5 | -------------------------------------------------------------------------------- /lwn_urls: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | curl --silent https://lwn.net/headlines/newrss | grep "link" | tr -d "<>" | sed 's:link$::g' | sed 's:^.*\(link\)::g' | sed 's:/rss/$::g' | dmenu -l 10 | xargs -I {} setsid -f vimb {} -------------------------------------------------------------------------------- /HN_scripts/remove_urls: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | filename=$1 4 | 5 | if [[ $1 == "" ]];then 6 | echo you need to provide the filename. 7 | exit 1 8 | fi 9 | 10 | 11 | sed -e 's!http[s]\?://\S*!!g' < $filename -------------------------------------------------------------------------------- /htmlnote: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | NOTES=/home/bhaskar/Notes/html/ 4 | 5 | find $NOTES -iname "*.html" -type f -newermt $(date '+%F') -ls | gawk '{ print $11}' | sort -f -i | head -1 | xargs -I {} firefox {} >/dev/null 2>&1 -------------------------------------------------------------------------------- /firefox_log_cleanup: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | run_lvl=$(runlevel | gawk '{ print $2 }') 3 | if [[ $run_lvl -eq 6 ]]; then 4 | printf "Cleaning firefox log file...\n" 5 | rm -f /data/firefox_log/firefox.log-main.* 6 | fi 7 | -------------------------------------------------------------------------------- /learn_spam.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | DOMAIN=slightlysauced.com 4 | USERNAME=contact 5 | 6 | sa-learn --spam /home/vmail/${DOMAIN}/${USERNAME}/Maildir/.spam/cur/* && rm -f /home/vmail/${DOMAIN}/${USERNAME}/Maildir/.spam/cur/* 7 | -------------------------------------------------------------------------------- /single_repo_status: -------------------------------------------------------------------------------- 1 | find $(pwd) -name ".git" 2> /dev/null | sed 's/\/.git/\//g' | awk '{print "-------------------------\n\033[1;32mGit Repo:\033[0m " $1; system("git --git-dir="$1".git --work-tree="$1" status")}' | grep "ahead" -------------------------------------------------------------------------------- /HN_scripts/extract_url_by_awk: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | filename=$1 4 | 5 | if [[ $1 == "" ]];then 6 | echo you need to provide the filename. 7 | exit 1 8 | fi 9 | 10 | 11 | sed -ne 's/.*\(http[^"]*\).*/\1/p' < $filename -------------------------------------------------------------------------------- /bulk_rename.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | for f in $1 # put file extension here such as *.txt,..... 4 | 5 | do 6 | 7 | cp -v $f{,.orig}; # here we move the old extension to new one i.e .txt to .sh etc 8 | 9 | done ; 10 | -------------------------------------------------------------------------------- /firefox_http_log_capture.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | export MOZ_LOG=timestamp,rotate:200,nsHttp:5,nsSocketTransport:5,nsStreamPump:5,nsHostResolver:5 4 | export MOZ_LOG_FILE=/tmp/log.txt-$(date) 5 | cd /path/to/firefox 6 | ./firefox 7 | -------------------------------------------------------------------------------- /get_freeswap.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | free -m | grep Swap | awk '{print $4}' 3 | -------------------------------------------------------------------------------- /check_docker_image_tags: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | curl -s -S "https://registry.hub.docker.com/v2/repositories/library/ubuntu/tags/" | jq '."results"[]["name"]' |sort 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /home_vol: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | df -h /home | gawk '{print $6"="$4}' 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.vim/spell/en.utf-8.add: -------------------------------------------------------------------------------- 1 | Debian 2 | package 3 | basically 4 | archive 5 | compressed 6 | tarfiles 7 | corresponding 8 | compression 9 | maintainer 10 | scripts 11 | various 12 | phases 13 | arguments 14 | dpkg 15 | configuration 16 | -------------------------------------------------------------------------------- /get_freemem: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | free -m | grep Mem | gawk '{ print $1"Avilable:"$4}' 3 | -------------------------------------------------------------------------------- /backup-exclusions.txt: -------------------------------------------------------------------------------- 1 | /usr/local/games 2 | /tmp/'*' 3 | /var/tmp/'*' 4 | /mnt 5 | /mnt/'*' 6 | /proc 7 | /proc/'*' 8 | /sys 9 | /usr/bin 10 | /bin 11 | /sbin 12 | /usr/lib 13 | /lib 14 | /usr/sbin 15 | /usr/share/doc 16 | /var/cache 17 | 18 | -------------------------------------------------------------------------------- /gitstats/hour_of_day.dat: -------------------------------------------------------------------------------- 1 | 1 0 2 | 2 0 3 | 3 0 4 | 4 0 5 | 5 0 6 | 6 0 7 | 7 0 8 | 8 0 9 | 9 0 10 | 10 0 11 | 11 3 12 | 12 0 13 | 13 2 14 | 14 0 15 | 15 0 16 | 16 0 17 | 17 0 18 | 18 0 19 | 19 0 20 | 20 0 21 | 21 1 22 | 22 0 23 | 23 0 24 | 24 0 25 | -------------------------------------------------------------------------------- /vimwiki/set_capability.wiki: -------------------------------------------------------------------------------- 1 | 2 | setcap -r /tmp/foobar 3 | # setcap cap_net_admin=p /tmp/foobar 4 | $ getfattr -d -m security.capability /tmp/foobar -e hex 5 | # file : /tmp/foobar 6 | security.capability=0x0000000200002000000000000000000000000000 7 | -------------------------------------------------------------------------------- /.vim/bundle/.vundle/script-names.vim-scripts.org.json: -------------------------------------------------------------------------------- 1 | 2 | 301 Moved Permanently 3 | 4 |

301 Moved Permanently

5 |
nginx
6 | 7 | 8 | -------------------------------------------------------------------------------- /git_commiter_info.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #This will show the git committer name along with other info 4 | 5 | git for-each-ref --sort=committerdate --format='%(refname:short) * %(authorname) * %(committerdate:relative)' refs/remotes/ | column -t -s '*'. 6 | -------------------------------------------------------------------------------- /i3-scripts/batt_warn: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | BATTINFO=$(acpi -b) 4 | if [[ $(echo $BATTINFO | grep Discharging) && $(echo $BATTINFO | cut -f 5 -d " ") < 00:15:00 ]] ; then 5 | DISPLAY=:0.0 /usr/bin/notify-send "low battery" "$BATTINFO" 6 | fi 7 | 8 | -------------------------------------------------------------------------------- /big_pkg_list.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | printf " Checking big installed packages. ...\n\n" 4 | 5 | dpkg-query --show --showformat='${Package;-50}\t${Installed-Size}\n' | sort -k 2 -n | grep -v deinstall | awk '{printf "%.3f MB \t %s\n", $2/(1024), $1}' 6 | 7 | exit 0 8 | -------------------------------------------------------------------------------- /gen_selfsign_cert: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | OPENSSL=$(which openssl) 4 | 5 | printf "Generating self signed certificate ..... \n\n\n" 6 | 7 | 8 | $OPENSSL req -x509 -sha256 -nodes -days 365 -newkey rsa:2048 -keyout privateKey.key -out certificate.crt 9 | 10 | 11 | -------------------------------------------------------------------------------- /mysql_slow_query: -------------------------------------------------------------------------------- 1 | [mysqld] 2 | log_slow_queries=/var/log/mysqld.slow.log 3 | long_query_time=2 4 | 5 | #Once queries get logged, you can get the top 10 queries sorted by number of occurrences in the log via: 6 | 7 | mysqldumpslow -s c -t 10 /var/log/mysqld.slow.log 8 | -------------------------------------------------------------------------------- /files_find_by_date: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | file_by_date() 4 | { 5 | LOCATION="${1:-.}"; 6 | echo $LOCATION 7 | find ${LOCATION} -type f -print0 | xargs -0 stat -c "%y %n" | sort | sed 's/.\([0-9]\)\{9,\} +0[1-2]00/\t/' | sed 's/ /\t/g' 8 | } 9 | 10 | file_by_date 11 | -------------------------------------------------------------------------------- /trailing_spaces_removed: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | filename=$1 4 | filename2=$2 5 | awkpat=$(command -v gawk) 6 | 7 | if [[ $# -eq 0 ]];then 8 | echo "You need to specify the file name" 9 | exit 1 10 | else 11 | 12 | $awkapt '{gsub(/[ \t]*$/, "");print}' $filename 13 | fi -------------------------------------------------------------------------------- /recent_files: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | dir=$1 4 | days=$2 5 | 6 | if [[ $1 == "" ]] || [[ $2 == "" ]];then 7 | echo You are suppose to provide directory to search and number of days 8 | exit 1 9 | fi 10 | 11 | find $dir -type f -regex ".*\.\(md\|txt\|sh\)" -mtime $days -exec vim "{}" \+ -------------------------------------------------------------------------------- /remotehost_file_open_with_vim: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | remote_user_hostname=$1 #usr@host 4 | filename=$2 5 | 6 | if test $# -ne 2 ;then 7 | printf "You need to pass usr@host and the file to edit. \n\n" 8 | exit 1 9 | fi 10 | 11 | vim scp://$remote_user_hostname//$filename 12 | -------------------------------------------------------------------------------- /HN_scripts/hn_show: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | declare -A hn_show_headlines 4 | 5 | 6 | title=$(printf '%s\n' "${!hn_show_headlines[@]}" | dmenu -l 10 -p "HN_Headlines: ") 7 | 8 | if [ "$title" ]; then 9 | url=$(printf '%s\n' "${hn_show_headlines["${title}"]}" ) 10 | $BROWSER $url 11 | fi 12 | -------------------------------------------------------------------------------- /i3-scripts/mpv_stat: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | mpv_pid=$(pgrep mpv) 4 | 5 | playing=$( ps -ef | grep mpv | sort -r | gawk '{ print $10 }') 6 | 7 | songs=$(basename $playing) 8 | 9 | if [[ $mpv_pid != "" ]];then 10 | 11 | echo "$songs" 12 | else 13 | echo " Not playing" 14 | 15 | fi 16 | -------------------------------------------------------------------------------- /HN_scripts/hn_hlines: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | /home/bhaskar/bin/hn_headlines 3 | 4 | cat $HOME/.hn_headlines.output | hn_url_content 5 | 6 | vim -c "4,13 normal Ihn_show_headlines[" -c "%s/ #\"#g" -c "%s/ : $mem\n" 9 | #echo "Mem:$mem" 10 | -------------------------------------------------------------------------------- /user_activity: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | username="$1" 4 | DIR="$2" 5 | 6 | if test $# -ne 2; then 7 | printf "Please provide the name of the user and specific dir for activity. \n 8 | Usage : ./user_activity \"username\" /etc \n\n" 9 | exit 1 10 | fi 11 | 12 | lsof -u $username -a +D $DIR 13 | 14 | -------------------------------------------------------------------------------- /.vim/bash-support/codesnippets/check-number-of-command-line-arguments: -------------------------------------------------------------------------------- 1 | #----------------------------------------------------------------------- 2 | # Check number of command line arguments 3 | #----------------------------------------------------------------------- 4 | [ $# -lt 1 ] && { echo -e "\n\tUsage: ${0##/*/} File\n"; exit 1; } 5 | 6 | -------------------------------------------------------------------------------- /.vim/.netrwhist: -------------------------------------------------------------------------------- 1 | let g:netrw_dirhistmax =10 2 | let g:netrw_dirhist_cnt =5 3 | let g:netrw_dirhist_1='/home/bhaskar/.config/i3/i3blocks' 4 | let g:netrw_dirhist_2='/home/bhaskar/git-linux/AdminScripts/.git/gitweb' 5 | let g:netrw_dirhist_3='/home/bhaskar/my_cert' 6 | let g:netrw_dirhist_4='/etc/bash/bashrc.d' 7 | let g:netrw_dirhist_5='/home/bhaskar' 8 | -------------------------------------------------------------------------------- /.vim/autoload/bash-support/codesnippets/check-number-of-command-line-arguments: -------------------------------------------------------------------------------- 1 | #----------------------------------------------------------------------- 2 | # Check number of command line arguments 3 | #----------------------------------------------------------------------- 4 | [ $# -lt 1 ] && { echo -e "\n\tUsage: ${0##/*/} File\n"; exit 1; } 5 | 6 | -------------------------------------------------------------------------------- /cyradm_in_expect.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/expect -f 2 | 3 | # execute command 4 | spawn -noecho cyradm -u cyrus localhost 5 | 6 | # log in 7 | log_user 0 8 | expect "*assword: " {send "secret\r"} 9 | 10 | # make mailbox 11 | expect "*» " {send "cm user.[lindex $argv 0] \n"} 12 | log_user 1 13 | 14 | # log out 15 | expect "*» " {log_user 0; send "exit\n"} 16 | expect eof -------------------------------------------------------------------------------- /files_cretd_accesd_specific_date.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | echo "Name the directory ,you want to search:" 3 | echo 4 | read directory 5 | 6 | echo "Please enter the date manually(in this format YYYY-mon-date):" 7 | echo 8 | read DATE 9 | 10 | echo "....okay searching...please wait...." 11 | echo 12 | 13 | 14 | find ${directory} -type f -newermt ${DATE} -ls 15 | -------------------------------------------------------------------------------- /vimwiki/boot_from_grub_prompt.asc.wiki: -------------------------------------------------------------------------------- 1 | 2 | grub rescue> set prefix=(hd0,1)/boot/grub 3 | grub rescue> set root=(hd0,1) 4 | grub rescue> insmod normal 5 | grub rescue> normal 6 | grub rescue> insmod linux 7 | grub rescue> linux /boot/vmlinuz-3.13.0-29-generic root=/dev/sda1 8 | grub rescue> initrd /boot/initrd.img-3.13.0-29-generic 9 | grub rescue> boot 10 | -------------------------------------------------------------------------------- /config_list: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | declare -a dotfiles=( .vimrc .bashrc .muttrc .ithreeconfig .ithreeblocksconfig 4 | .gitconfig .emacs .profile .vimb_config .newsboat_config) 5 | 6 | choice=$( printf '%s\n' "${dotfiles[@]}" | dmenu -i -l 20 -p "Edit Config:") 7 | 8 | if [ "$choice" ]; then 9 | cfg=$(printf '%s\n' "${choice}" | xargs -I {} st -e vim {}) 10 | fi 11 | -------------------------------------------------------------------------------- /find_executables.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | IFS=: 4 | 5 | for dir in $PATH 6 | 7 | do 8 | 9 | echo "$dir:" 10 | 11 | for myfile in $dir/* 12 | 13 | do 14 | 15 | if [ -x $myfile ] 16 | 17 | then 18 | 19 | echo " $myfile" 20 | 21 | fi 22 | 23 | done 24 | 25 | done 26 | -------------------------------------------------------------------------------- /gitcompu: -------------------------------------------------------------------------------- 1 | git add `git status | grep modified | grep md | gawk '{print $2}'` && git commit -a -S -s && git-com-vrfy && git logline -1 --stat && git push origin master && git for-each-ref --sort=committerdate --format='%(refname:short) * %(authorname) * %(committerdate:relative)' refs/remotes/ | column -t -s '*'. && firefox --new-tab $(git config --get remote.origin.url) 2 | -------------------------------------------------------------------------------- /gitstats/lines_of_code.plot: -------------------------------------------------------------------------------- 1 | set terminal png transparent size 640,240 2 | set size 1.0,1.0 3 | 4 | set output 'lines_of_code.png' 5 | unset key 6 | set yrange [0:] 7 | set xdata time 8 | set timefmt "%s" 9 | set format x "%Y-%m-%d" 10 | set grid y 11 | set ylabel "Lines" 12 | set xtics rotate 13 | set bmargin 6 14 | plot 'lines_of_code.dat' using 1:2 w lines 15 | -------------------------------------------------------------------------------- /org-capture: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -vx 3 | if [[ -z "$1" ]]; then 4 | printf "Enter URL: "; 5 | url=$( echo | dmenu -p "Enter URL:" ) 6 | else 7 | url="$1" 8 | fi 9 | 10 | #query="${query// /+}" 11 | #echo "$query" 12 | 13 | if [[ "$url" == "" ]];then 14 | exit 1 15 | else 16 | 17 | $(command -v emacsclient) -n "org-protocol:///capture?url=$url" 18 | fi 19 | -------------------------------------------------------------------------------- /.vifm/scripts/imgc: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | W3MIMGDISPLAY="/usr/bin//w3mimgdisplay" 4 | FONTH=15 # Size of one terminal row 5 | FONTW=7 # Size of one terminal column 6 | 7 | X=$1 8 | Y=$2 9 | COLUMNS=$3 10 | LINES=$4 11 | 12 | x=$((FONTW * X)) 13 | y=$((FONTH * Y)) 14 | 15 | erase="6;$x;$y;$(( FONTW*COLUMNS ));$(( FONTH*LINES ))\n3;" 16 | echo -e "$erase" | $W3MIMGDISPLAY 17 | -------------------------------------------------------------------------------- /.vifm/vim/ftplugin/vifm-edit.vim: -------------------------------------------------------------------------------- 1 | " vifm command-line editing buffer filetype plugin 2 | " Maintainer: xaizek 3 | " Last Change: August 18, 2013 4 | 5 | if exists("b:did_ftplugin") 6 | finish 7 | endif 8 | 9 | let b:did_ftplugin = 1 10 | 11 | call vifm#edit#Init() 12 | 13 | " vim: set tabstop=2 softtabstop=2 shiftwidth=2 noexpandtab cinoptions-=(0 : 14 | -------------------------------------------------------------------------------- /gpg-backup-restore-keys: -------------------------------------------------------------------------------- 1 | #generate base64-encoded armored backups 2 | 3 | 4 | gpg2 --armor --export > pgp-public-keys.asc 5 | gpg2 --armor --export-secret-keys > pgp-private-keys.asc 6 | gpg2 --export-ownertrust > pgp-ownertrust.asc 7 | 8 | #To restore it 9 | 10 | gpg2 --import pgp-public-keys.asc 11 | gpg2 --import pgp-private-keys.asc 12 | gpg2 --import-ownertrust pgp-ownertrust.asc -------------------------------------------------------------------------------- /.vim/bash-support/codesnippets/use-file-descriptor-write: -------------------------------------------------------------------------------- 1 | 2 | outfilename="" # output filename 3 | 4 | exec 4>"$outfilename" 5 | if [ $? -ne 0 ] ; then 6 | echo -e "Could not link file descriptor with file '$outfilename'\n" 7 | exit 1 8 | fi 9 | 10 | echo -e "text" >&4 11 | 12 | exec 4>&- # close file descriptor 13 | 14 | -------------------------------------------------------------------------------- /gitstats/files_by_date.plot: -------------------------------------------------------------------------------- 1 | set terminal png transparent size 640,240 2 | set size 1.0,1.0 3 | 4 | set output 'files_by_date.png' 5 | unset key 6 | set yrange [0:] 7 | set xdata time 8 | set timefmt "%Y-%m-%d" 9 | set format x "%Y-%m-%d" 10 | set grid y 11 | set ylabel "Files" 12 | set xtics rotate 13 | set ytics autofreq 14 | set bmargin 6 15 | plot 'files_by_date.dat' using 1:2 w steps 16 | -------------------------------------------------------------------------------- /.vim/autoload/bash-support/codesnippets/use-file-descriptor-write: -------------------------------------------------------------------------------- 1 | 2 | outfilename="" # output filename 3 | 4 | exec 4>"$outfilename" 5 | if [ $? -ne 0 ] ; then 6 | echo -e "Could not link file descriptor with file '$outfilename'\n" 7 | exit 1 8 | fi 9 | 10 | echo -e "text" >&4 11 | 12 | exec 4>&- # close file descriptor 13 | 14 | -------------------------------------------------------------------------------- /.vifm/scripts/README: -------------------------------------------------------------------------------- 1 | This directory is dedicated for user-supplied scripts/executables. 2 | vifm modifies its PATH environment variable to let user run those 3 | scripts without specifying full path. All subdirectories are added 4 | as well. File in a subdirectory overrules file with the same name 5 | in parent directories. Restart might be needed to recognize files 6 | in newly created or renamed subdirectories. -------------------------------------------------------------------------------- /gitstats/commits_by_year_month.plot: -------------------------------------------------------------------------------- 1 | set terminal png transparent size 640,240 2 | set size 1.0,1.0 3 | 4 | set output 'commits_by_year_month.png' 5 | unset key 6 | set yrange [0:] 7 | set xdata time 8 | set timefmt "%Y-%m" 9 | set format x "%Y-%m" 10 | set xtics rotate 11 | set bmargin 5 12 | set grid y 13 | set ylabel "Commits" 14 | plot 'commits_by_year_month.dat' using 1:2:(0.5) w boxes fs solid 15 | -------------------------------------------------------------------------------- /vimwiki/gpg-backup-restore-keys.wiki: -------------------------------------------------------------------------------- 1 | 2 | #generate base64-encoded armored backups 3 | 4 | 5 | gpg2 --armor --export > pgp-public-keys.asc 6 | gpg2 --armor --export-secret-keys > pgp-private-keys.asc 7 | gpg2 --export-ownertrust > pgp-ownertrust.asc 8 | 9 | #To restore it 10 | 11 | gpg2 --import pgp-public-keys.asc 12 | gpg2 --import pgp-private-keys.asc 13 | gpg2 --import-ownertrust pgp-ownertrust.asc -------------------------------------------------------------------------------- /random_file_creation.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | DIR=$1 4 | 5 | if [ !-d $DIR ] ; then 6 | 7 | echo "Want to create the dir ? please pass the name here :" 8 | read dirname 9 | 10 | mkdir -p $dirname 11 | 12 | /usr/bin/namei $dirname 13 | 14 | exit 1; 15 | 16 | fi 17 | 18 | cd $dirname 19 | 20 | for n in $(seq 1 52); do touch $dirname/$n;done 21 | 22 | echo $? 23 | 24 | ls -al $dirname | wc -l 25 | 26 | -------------------------------------------------------------------------------- /remove_old_header_image.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | printf "Enlisting and removing stale stuff from the system to aquire space ...\n\n\n" 4 | 5 | 6 | dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d' | tee stale 7 | 8 | for i in `cat stale` 9 | do echo $i 10 | sleep 3 11 | apt-get purge $i 12 | done 13 | 14 | exit 0 15 | 16 | -------------------------------------------------------------------------------- /screencast: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | #name=$1 3 | # 4 | #if [[ $name == "" ]];then 5 | # echo you are suppose to provide the video name. 6 | # exit 1 7 | #fi 8 | 9 | #ffmpeg -f x11grab -r 25 -i :0 -vcodec libx264 -ac 2 -acodec libmp3lame screencast_$(date +'%F_%T').mkv 10 | ffmpeg -f alsa -ac 2 -i pulse -f x11grab -r 25 -i :0 -vcodec libx264 -acodec pcm_s16le ~/Videos/screencast_$(date +'%F_%T').mkv 11 | 12 | -------------------------------------------------------------------------------- /lwn_headlines: -------------------------------------------------------------------------------- 1 | #/bin/bash 2 | file=/home/bhaskar/headline.lwn 3 | 4 | >$file 5 | 6 | curl --silent https://lwn.net/headlines/newrss | xmlstarlet select -N it="http://purl.org/rss/1.0/" -N dc="http://purl.org/dc/elements/1.1/" --text --noblanks --template --match "//rdf:RDF/it:item[position() <= 10]" -v it:title -o '<===>' -v dc:date -o '\\n' | tr -d "'" | xargs echo -e > $file 7 | 8 | cat $file | dmenu -l 10 | lwn_urls -------------------------------------------------------------------------------- /youtube_video_to_mp3_conv.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | youtube_url=$1 4 | 5 | youtube-dl --extract-audio --audio-format mp3 -l $youtube_url 6 | 7 | #function youtube_url { 8 | # If no arguments, print usage statement & exit from function 9 | # [[ -n "$1" ]] || ( echo "Usage: youtube_video_to_mp3_conv.sh youtube_url "; exit 0 ; ) 10 | # Else, continue and print the arguments 11 | # echo "youtube_url=$1" 12 | #} 13 | -------------------------------------------------------------------------------- /.vim/bash-support/codesnippets/use-file-descriptor-read: -------------------------------------------------------------------------------- 1 | 2 | infilename="" # input filename 3 | 4 | exec 3<"$infilename" 5 | if [ $? -ne 0 ] ; then 6 | echo -e "Could not link file descriptor with file '$infilename'\n" 7 | exit 1 8 | fi 9 | 10 | while read line <&3 ; do 11 | echo -e "$line" 12 | done 13 | 14 | exec 3<&- # close file descriptor 15 | 16 | -------------------------------------------------------------------------------- /irssi_autorejoin.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | pushd ~ 4 | mkdir -p ~/.irssi/scripts/autorun 5 | pushd ~/.irssi/scripts 6 | 7 | wget http://scripts.irssi.org/scripts/autorejoin.pl 8 | chmod +x autorejoin.pl 9 | pushd ~/.irssi/scripts/autorun 10 | ln -snf ../autorejoin.pl . 11 | popd 12 | 13 | popd 14 | popd 15 | 16 | echo "Now run /script load autorejoin in your irssi session, and it will autorun when you next start." 17 | -------------------------------------------------------------------------------- /log_inof_of_specific_drive.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | partition="/dev/sda1 /dev/sda3 /dev/sda4 /dev/sda5" 4 | 5 | free_space=`df -h | grep $partition | cut -b 41-50` 6 | echo $free_space 7 | 8 | if [ "$free_space" <= 5000 ] 9 | then 10 | message="WARNING: Only $free_space blocks left on $partition"; 11 | logger -p local0.crit $message 12 | # echo $message | mail -s "Partition problem" root@bhaskar-laptop 13 | fi 14 | -------------------------------------------------------------------------------- /uninstall-swiftfox.sh.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # This script uninstalls Swiftfox that was installed using the installer 4 | 5 | echo " " 6 | echo "Uninstalling Swiftfox..." 7 | echo " " 8 | sudo rm -rf /opt/swiftfox 9 | sudo rm /usr/bin/swiftfox 10 | sudo rm ~/Desktop/Swiftfox.desktop 11 | sudo rm /usr/share/applications/Swiftfox.desktop 12 | 13 | echo " " 14 | echo "Swiftfox has been uninstalled" 15 | echo " " 16 | exit -------------------------------------------------------------------------------- /.vim/autoload/bash-support/codesnippets/use-file-descriptor-read: -------------------------------------------------------------------------------- 1 | 2 | infilename="" # input filename 3 | 4 | exec 3<"$infilename" 5 | if [ $? -ne 0 ] ; then 6 | echo -e "Could not link file descriptor with file '$infilename'\n" 7 | exit 1 8 | fi 9 | 10 | while read line <&3 ; do 11 | echo -e "$line" 12 | done 13 | 14 | exec 3<&- # close file descriptor 15 | 16 | -------------------------------------------------------------------------------- /youtube-dl_update: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo "Getting the latest of it....hang on..." 4 | echo 5 | 6 | curl -L https://yt-dl.org/downloads/latest/youtube-dl -o $HOME/bin/youtube-dl 7 | 8 | chmod a+rx $HOME/bin/youtube-dl 9 | 10 | echo "Verifying the signature...." 11 | echo 12 | 13 | wget https://yt-dl.org/downloads/latest/youtube-dl.sig -O youtube-dl.sig 14 | gpg2 --verify youtube-dl.sig $HOME/bin/youtube-dl 15 | rm youtube-dl.sig -------------------------------------------------------------------------------- /fix_gpg_agent_IPC_error: -------------------------------------------------------------------------------- 1 | If you get this error: 2 | 3 | gpg: can't connect to the agent: IPC connect call failed 4 | gpg: can't connect to the agent: IPC connect call failed 5 | 6 | 7 | Then , please run : 8 | 9 | printf '%%Assuan%%\nsocket=/dev/shm/S.gpg-agent\n' > ~/.gnupg/S.gpg-agent 10 | 11 | and also do export GPG_TTY=$(tty) 12 | 13 | Read the explanation here : https://michaelheap.com/gpg-cant-connect-to-the-agent-ipc-connect-call-failed/ 14 | -------------------------------------------------------------------------------- /gitstats/commits_by_author.plot: -------------------------------------------------------------------------------- 1 | set terminal png transparent size 640,240 2 | set size 1.0,1.0 3 | 4 | set terminal png transparent size 640,480 5 | set output 'commits_by_author.png' 6 | set key left top 7 | set yrange [0:] 8 | set xdata time 9 | set timefmt "%s" 10 | set format x "%Y-%m-%d" 11 | set grid y 12 | set ylabel "Commits" 13 | set xtics rotate 14 | set bmargin 6 15 | plot 'commits_by_author.dat' using 1:2 title "Bhaskar Chowdhury" w lines 16 | -------------------------------------------------------------------------------- /tripwire.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | #This is script which helps to monitor file system provided Tripwire is installed in the system. 3 | HOST_NAME=`uname -n` 4 | if [[ ! -e /var/lib/tripwire/${HOST_NAME}.twd ]] ; then 5 | echo "**** Error: Tripwire database for ${HOST_NAME} not \ 6 | found. ****" 7 | echo "**** Run "/etc/tripwire/twinstall.sh" and/or "tripwire\ 8 | ---init". ****" 9 | else 10 | test -f /etc/tripwire/tw.cfg && /usr/sbin/tripwire ---check 11 | fi 12 | -------------------------------------------------------------------------------- /vimwiki/Home_Router_Info.wiki: -------------------------------------------------------------------------------- 1 | 2 | Wireless Mac Address : D4:6E:0E:E6:8A:CE 3 | IP :192.168.0.1 4 | Subnet : 255.255.255.0 5 | 6 | Mode: 11bgn mixed 7 | 8 | WAN: 9 | 10 | MAC Address: D4:6E:0E:E6:8A:CF 11 | 12 | IP Address: 10.13.71.251(Static IP) 13 | 14 | Subnet Mask: 255.255.255.128 15 | 16 | Default Gateway:10.13.71.129 17 | 18 | DNS Server: 10.13.71.129 8.8.8.8 19 | 20 | WPS (Wifi protected setup) 21 | 22 | Current PIN: 36929818 23 | 24 | 25 | -------------------------------------------------------------------------------- /.vim/bash-support/rc/customization.bashrc: -------------------------------------------------------------------------------- 1 | #----------------------------------------------------------------------- 2 | # set Bash prompts 3 | # PS4 shows the function name when execution is inside a function and 4 | # the xtrace option is set. 5 | #----------------------------------------------------------------------- 6 | export PS2='continue> ' 7 | export PS3='choose: ' 8 | export PS4='|${BASH_SOURCE} ${LINENO}${FUNCNAME[0]:+ ${FUNCNAME[0]}()}| ' 9 | 10 | -------------------------------------------------------------------------------- /open-download-pdf: -------------------------------------------------------------------------------- 1 | #!/bin/bash -xv 2 | 3 | #URL=$VIMB_URI 4 | #URL="$@" 5 | latest_file=$(find $HOME/Downloads/ -iname "*.pdf" -type f -newermt $(date '+%F') -ls | gawk '{ print $11}' | sort -f -i -r | head -1) 6 | 7 | # XXX 8 | #logger "$URL : $VIMB_TITLE" 9 | #exit 10 | $(command -v zathura) "$latest_file" >/dev/null 2>&1 11 | 12 | #if [ -n "$URL" ] ; then 13 | #URL=${URL//*\//} 14 | #exec xdg-open "$HOME/Downloads/$URL" >/dev/null 2>&1 15 | #fi 16 | -------------------------------------------------------------------------------- /vimb/open-download-pdf: -------------------------------------------------------------------------------- 1 | #!/bin/bash -xv 2 | 3 | #URL=$VIMB_URI 4 | #URL="$@" 5 | latest_file=$(find $HOME/Downloads/ -iname "*.pdf" -type f -newermt $(date '+%F') -ls | gawk '{ print $11}' | sort -f -i -r | head -1) 6 | 7 | # XXX 8 | #logger "$URL : $VIMB_TITLE" 9 | #exit 10 | $(command -v zathura) "$latest_file" >/dev/null 2>&1 11 | 12 | #if [ -n "$URL" ] ; then 13 | #URL=${URL//*\//} 14 | #exec xdg-open "$HOME/Downloads/$URL" >/dev/null 2>&1 15 | #fi -------------------------------------------------------------------------------- /vimwiki/userContent.css_firefox.wiki: -------------------------------------------------------------------------------- 1 | 2 | @-moz-document url-prefix(about:home) { 3 | 4 | body {background: #424246 !important;} 5 | 6 | 7 | } 8 | 9 | @-moz-document url(about:newtab) { 10 | body { 11 | background-color: #000000 !important; 12 | background-image: url("/home/bhaskar/cover_small.jpg") !important; 13 | background-repeat: no-repeat !important; 14 | background-position: center !important; 15 | } 16 | } 17 | 18 | -------------------------------------------------------------------------------- /.vim/autoload/bash-support/rc/customization.bashrc: -------------------------------------------------------------------------------- 1 | #----------------------------------------------------------------------- 2 | # set Bash prompts 3 | # PS4 shows the function name when execution is inside a function and 4 | # the xtrace option is set. 5 | #----------------------------------------------------------------------- 6 | export PS2='continue> ' 7 | export PS3='choose: ' 8 | export PS4='|${BASH_SOURCE} ${LINENO}${FUNCNAME[0]:+ ${FUNCNAME[0]}()}| ' 9 | 10 | -------------------------------------------------------------------------------- /gitstats/lines_of_code_by_author.plot: -------------------------------------------------------------------------------- 1 | set terminal png transparent size 640,240 2 | set size 1.0,1.0 3 | 4 | set terminal png transparent size 640,480 5 | set output 'lines_of_code_by_author.png' 6 | set key left top 7 | set yrange [0:] 8 | set xdata time 9 | set timefmt "%s" 10 | set format x "%Y-%m-%d" 11 | set grid y 12 | set ylabel "Lines" 13 | set xtics rotate 14 | set bmargin 6 15 | plot 'lines_of_code_by_author.dat' using 1:2 title "Bhaskar Chowdhury" w lines 16 | -------------------------------------------------------------------------------- /vimb/closed: -------------------------------------------------------------------------------- 1 | https://www.lkml.org/ 2 | https://www.partitionwizard.com/partitionmanager/uefi-boot-usb.html 3 | http://www.slackware.com/getslack/ 4 | https://www.reddit.com/ 5 | https://www.linkedin.com/feed/ 6 | https://slackware.nl/slackware-live/latest/ 7 | https://wiki.gentoo.org/wiki/Chroot 8 | https://www.youtube.com/watch?v=KyZ5a1r8m6E 9 | https://superuser.com/questions/196857/how-to-install-libmp3lame-for-ffmpeg 10 | https://packages.gentoo.org/useflags/sndfile 11 | -------------------------------------------------------------------------------- /i3-scripts/song_name_display_mpv_loop: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | mpv_pid=$(pgrep mpv) 4 | 5 | playing=$( ps -ef | grep mpv | sort -r | gawk '{ print $11 }' | grep -v mpv) 6 | 7 | songs=$(basename $playing) 8 | songs2=${songs%.*} 9 | time_total_loop=$(mp3info -p "%m:%02s\n" "$HOME/Music/$playing") 10 | 11 | if [[ $mpv_pid != "" ]];then 12 | 13 | #echo "$songs2" 14 | echo -e "  $songs2 $time_total_loop\n" 15 | fi 16 | -------------------------------------------------------------------------------- /missing_command_check: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | my_needed_commands="$1" 4 | 5 | missing_counter=0 6 | for needed_command in $my_needed_commands; do 7 | if ! hash "$needed_command" >/dev/null 2>&1; then 8 | printf "Command not found in PATH: %s\n" "$needed_command" >&2 9 | ((missing_counter++)) 10 | fi 11 | done 12 | 13 | if ((missing_counter > 0)); then 14 | printf "Minimum %d commands are missing in PATH, aborting\n" "$missing_counter" >&2 15 | exit 1 16 | fi -------------------------------------------------------------------------------- /suse_old_kernel_remove: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | printf " Removing the old/stale kernels from the system....\n\n\n\n" 4 | 5 | zypper se -si kernel 6 | 7 | echo "" 8 | echo "" 9 | echo -n "Provide the kernel version to remove : " 10 | read kernel_remove 11 | 12 | printf " Removing the version $kernel_remove ...\n\n\n\n" 13 | 14 | zypper rm kernel-default-$kernel_remove kernel-default-devel-$kernel_remove kernel-devel-$kernel_remove 15 | 16 | 17 | 18 | exit 0 19 | 20 | 21 | -------------------------------------------------------------------------------- /nagios_downtime_cli: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | hosturl=$1 4 | nagiosurl=$2 5 | 6 | sudo /usr/bin/curl --data "cmd_typ=56" --data "cmd_mod=2" --data "host=${hosturl}" --data-urlencode "service=check_redis_keys" --data-urlencode "testing" --data "trigger=0" --data-urlencode "start_time=09-01-2011 08:00:00" --data-urlencode "end_time=09-01-2011 09:00:00" --data "fixed=1" --data "hours=1" --data "minutes=0" --data btnSubmit=Commit "http://${nagiosurl}/nagios/cgi-bin/cmd.cgi" -u nagios:nagios 7 | -------------------------------------------------------------------------------- /ffmpeg_noise_reduction: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | video_file=$1 4 | 5 | 6 | if [[ $# -ne 1 ]];then 7 | echo You are suppose to provide the source video file. 8 | exit 1 9 | fi 10 | 11 | ffmpeg -i "$video_file" -af "highpass=200,lowpass=3000,afftdn" -c:v copy myvideo_clean.mkv 12 | 13 | 14 | if test $? -eq 0;then 15 | notify-send "Done,clearing the backgrund noise on video" 16 | mv -v "myvideo_clean.mkv" "$video_file" 17 | else 18 | notify-send "Failed..check manually" 19 | fi 20 | -------------------------------------------------------------------------------- /ffmpeg_static_text_on_video: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | video_file=$1 4 | text_content=$2 5 | 6 | if [[ $# -ne 2 ]];then 7 | echo You are suppose to provide the source video file and text to display. 8 | exit 1 9 | fi 10 | 11 | ffmpeg -i "$video_file" -vf drawtext="fontfile=/home/bhaskar/.fonts/ttf/DejaVuSansMono.ttf: text='${text_content}':x=(w-text_w)/2:y=(h-text_h)/2 : fontcolor=yellow: fontsize=80: enable='between(t,00,1*60)'" modified.mkv 12 | 13 | mv -v "modified.mkv" "$video_file" 14 | -------------------------------------------------------------------------------- /.vifm/vim/ftplugin/vifm-cmdedit.vim: -------------------------------------------------------------------------------- 1 | " vifm command-line editing buffer filetype plugin 2 | " Maintainer: xaizek 3 | " Last Change: August 18, 2013 4 | 5 | if exists("b:did_ftplugin") 6 | finish 7 | endif 8 | 9 | let b:did_ftplugin = 1 10 | 11 | " Behave as vifm script file 12 | runtime! ftplugin/vifm.vim 13 | 14 | " Use vifm script highlighting 15 | set syntax=vifm 16 | 17 | call vifm#edit#Init() 18 | 19 | " vim: set tabstop=2 softtabstop=2 shiftwidth=2 noexpandtab cinoptions-=(0 : 20 | -------------------------------------------------------------------------------- /.vim/bash-support/codesnippets/free-software-comment: -------------------------------------------------------------------------------- 1 | # 2 | #========================================================================== 3 | # This program is free software; you can redistribute it and/or modify 4 | # it under the terms of the GNU General Public License as published by 5 | # the Free Software Foundation; either version 2 of the License, or 6 | # (at your option) any later version. 7 | #========================================================================== 8 | # 9 | -------------------------------------------------------------------------------- /filter_hostile_ip_from_log.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl -w 2 | # 3 | my %outside=(); 4 | open LOG," ) { 5 | ($ext)=/outside:(\S+)\//; 6 | if ( ! exists $outside{$ext} ) { 7 | $outside{$ext}=1; # add to hash 8 | } else { 9 | $outside{$ext}++; # increment connection counter 10 | } 11 | } 12 | # look through list of hostile IP addresses to see if any have been seen in log 13 | while ( ) { 14 | chomp; 15 | if ( exists $outside{$_} ) { 16 | print "FOUND: $_ $outside{$_} time(s)\n"; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /i3-scripts/conky-i3bar: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Send the header so that i3bar knows we want to use JSON: 4 | echo '{"version":1}' 5 | 6 | # Begin the endless array. 7 | echo '[' 8 | 9 | # We send an empty first array of blocks to make the loop simpler: 10 | echo '[],' 11 | 12 | # Now send blocks with information forever: 13 | # use this if i3-status bar produces parsing error 14 | #if [ ! -f /tmp/conky-i3bar ]; then 15 | # #sleep 16 16 | # touch /tmp/conky-i3bar 17 | #fi 18 | 19 | exec conky -c $HOME/.conkyrc 20 | -------------------------------------------------------------------------------- /rdiff-backup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh -e 2 | # Use default shell (may be dash rather than bash on modern systems) 3 | # Exit immediately on error 4 | 5 | BACKUP_USER=backup 6 | BACKUP_HOST=jump 7 | BACKUP_DIR=/mnt/backups/host/ 8 | 9 | # Commands should be silent except for error messages 10 | # Run with -v5 for debugging only 11 | /usr/bin/rdiff-backup \ 12 | --exclude-globbing-filelist='/root/backup-exclusions.txt' \ 13 | / \ 14 | ${BACKUP_USER}@${BACKUP_HOST}::${BACKUP_DIR} \ 15 | 2>&1 | grep -v 'does not match source$' 16 | -------------------------------------------------------------------------------- /.vifm/vim/autoload/vifm/edit.vim: -------------------------------------------------------------------------------- 1 | " common functions for vifm command-line editing buffer filetype plugins 2 | " Maintainer: xaizek 3 | " Last Change: August 18, 2013 4 | 5 | " Prepare buffer 6 | function! vifm#edit#Init() 7 | " Mappings for quick leaving the buffer (behavior similar to Command line 8 | " buffer in Vim) 9 | nnoremap :copy 0 \| wq 10 | imap 11 | 12 | " Start buffer editing in insert mode 13 | startinsert 14 | endfunction 15 | -------------------------------------------------------------------------------- /.vim/autoload/bash-support/codesnippets/free-software-comment: -------------------------------------------------------------------------------- 1 | # 2 | #========================================================================== 3 | # This program is free software; you can redistribute it and/or modify 4 | # it under the terms of the GNU General Public License as published by 5 | # the Free Software Foundation; either version 2 of the License, or 6 | # (at your option) any later version. 7 | #========================================================================== 8 | # 9 | -------------------------------------------------------------------------------- /nmap_ping: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | NMAP="/usr/bin/nmap -sP" 3 | TMP=/var/tmp/nmap_ping.$$ 4 | CHECK="Nmap Ping" 5 | 6 | results_exit() 7 | { 8 | rm -f $TMP 9 | echo "$CHECK: ${2}" 10 | return $1 11 | } 12 | 13 | $NMAP $1 > $TMP || results_exit 255 "Could not execute $NMAP" 14 | 15 | grep "Host seems down" $TMP 16 | [ $? -eq 0 ] && results_exit 2 "CRITICAL" 17 | 18 | grep "Host is up" $TMP 19 | [ $? -eq 0 ] && results_exit 0 "Ok" 20 | 21 | results_exit 3 "Unknown" 22 | 23 | -------------------------------------------------------------------------------- /spinner.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | spinner() 4 | { 5 | local pid=$1 6 | local delay=0.175 7 | local spinstr='|/-\' 8 | local infotext=$2 9 | while [ "$(ps a | awk '{print $1}' | grep $pid)" ]; do 10 | local temp=${spinstr#?} 11 | printf " %s %c " "$infotext" "$spinstr" 12 | local spinstr=$temp${spinstr%"$temp"} 13 | sleep $delay 14 | printf "\b\b\b" 15 | for i in $(seq 1 ${#infotext}); do 16 | printf "\b" 17 | done 18 | done 19 | printf " \b\b\b\b" 20 | } 21 | #($@ 2>/dev/null) & 22 | #("$@") & 23 | #spinner "$!" "Checking..." 24 | -------------------------------------------------------------------------------- /.vifm/vim/doc/tags: -------------------------------------------------------------------------------- 1 | g:vifm_exec_args vifm-plugin.txt /*g:vifm_exec_args* 2 | g:vifm_term vifm-plugin.txt /*g:vifm_term* 3 | vifm-:DiffVifm vifm-plugin.txt /*vifm-:DiffVifm* 4 | vifm-:EditVifm vifm-plugin.txt /*vifm-:EditVifm* 5 | vifm-:SplitVifm vifm-plugin.txt /*vifm-:SplitVifm* 6 | vifm-:TabVifm vifm-plugin.txt /*vifm-:TabVifm* 7 | vifm-:VsplitVifm vifm-plugin.txt /*vifm-:VsplitVifm* 8 | vifm-a vifm-plugin.txt /*vifm-a* 9 | vifm-K vifm-plugin.txt /*vifm-K* 10 | vifm-plugin.txt vifm-plugin.txt /*vifm-plugin.txt* 11 | -------------------------------------------------------------------------------- /i3-scripts/essid.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | SSID_NAME=$(iwgetid -r) 4 | 5 | # You can put any urgent name so the block will give warning 6 | # if a network with this name is used, like public wifi or alike. 7 | # You can separate multiple values with \| 8 | URGENT_VALUE="" 9 | 10 | if [[ "${SSID_NAME}" != "" ]]; then 11 | echo "${SSID_NAME}" 12 | #echo "${SSID_NAME}" 13 | echo "" 14 | 15 | if [[ "${URGENT_VALUE}" != "" ]] && [[ $(echo "${SSID_NAME}" | grep -we "${URGENT_VALUE}") != "" ]]; then 16 | exit 33 17 | fi 18 | fi 19 | -------------------------------------------------------------------------------- /.vim/bundle/grep-operator.vim: -------------------------------------------------------------------------------- 1 | nnoremap g :set operatorfunc=GrepOperatorg@ 2 | vnoremap g :call GrepOperator(visualmode()) 3 | 4 | function! s:GrepOperator(type) 5 | let saved_unnamed_register = @@ 6 | 7 | if a:type ==# 'V' 8 | normal! `y 9 | elseif a:type ==# 'char' 10 | normal! `[h`]y 11 | else 12 | return 13 | endif 14 | 15 | silent execute "grep! -R " . shellescape(@@) . " ." 16 | copen 17 | 18 | let @@ = saved_unnamed_register 19 | endfunction -------------------------------------------------------------------------------- /git_project_creation.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # This script will crate git project in specified location,only need to pass the name of the porject. 3 | 4 | 5 | if [ $# -ne 1 ] ; then 6 | echo "Usage : $0 " 7 | exit 2 8 | fi 9 | 10 | ProjectName=$1 11 | 12 | basedir="/home/$USER/git-linux/" 13 | 14 | mkdir -p $basedir/${ProjectName} 15 | 16 | chown -R $USER:$USER $basedir/${ProjectName} 17 | 18 | cd $basedir/${ProjectName} 19 | git init --bare && git init 20 | 21 | git add . && git commit -s -m "intial commit" 22 | exit 0 23 | -------------------------------------------------------------------------------- /clean_old_kernel_stuff: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | printf "Cleaning the old cruft related to kernel in the system .....\n" 4 | 5 | sel=$(find /boot/ -maxdepth 1 -type f | fzf --multi --prompt "Select the files:") 6 | 7 | 8 | for files in "${sel[0]}";do 9 | sudo rm -f $(echo $files) 10 | done 11 | 12 | printf "\n Alright, clean the moduels directory too...\n" 13 | 14 | mod=$(find /lib/modules/ -maxdepth 1 -type d | fzf --multi --prompt "Select the directories:") 15 | 16 | for dir in "${mod[0]}";do 17 | sudo rm -rf "$(echo $dir)" 18 | done 19 | -------------------------------------------------------------------------------- /httpd_restart.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | httpdpidfile=/run/httpd/httpd.pid 4 | TO_MAIL="unixbhaskar@gmail.com" 5 | 6 | if [ -f "${httpdpidfile}" ]; then 7 | old_count=`cat /run/httpd/httpd.pid` 8 | else 9 | old_count='0' 10 | fi 11 | 12 | new_count=$(ps -ef | grep httpd | wc -l ) 13 | 14 | #echo $new_count > $sfile 15 | 16 | if [ "${new_count}" -ne "0" ] && [ "${old_count}" -ne "${new_count}" ]; then 17 | service httpd restart 18 | echo $? 19 | echo "apache fault detected , httpd restarted" | mail -s "httpd restarted" $TO_MAIL 20 | fi 21 | 22 | exit 0 23 | -------------------------------------------------------------------------------- /vimwiki/userChrome.css_firefox.wiki: -------------------------------------------------------------------------------- 1 | 2 | #TabsToolbar { visibility: collapse !important; } 3 | 4 | browser vbox#appcontent tabbrowser, #content, #tabbrowser-tabpanels, 5 | browser[type=content-primary],browser[type=content] > html { 6 | background: #1D1B19 !important 7 | } 8 | 9 | 10 | @namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); /* only needed once */ 11 | 12 | #content browser { 13 | margin-right: -14px !important; 14 | overflow-y: hidden; 15 | margin-bottom: -14px !important; 16 | overflow-x: scroll; 17 | } 18 | -------------------------------------------------------------------------------- /disk_usage_monitor.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | #This is for monitoring the disk usage on any machine with an assumtion of lvm too.. 3 | dt=`date +%D` 4 | 5 | df -h > /tmp/du$$ 6 | 7 | while read line 8 | do 9 | fields=`echo $line | awk '{print NF}'` 10 | case $fields in 11 | 1) echo -n "$dt $line ";; 12 | 5) echo -n "$dt " 13 | echo $line | awk '{print $4}';; 14 | 6) echo -n "$dt " 15 | echo $line | awk '{print $1,$5}';; 16 | esac 17 | done < /tmp/du$$ > disk_usage 18 | 19 | cat disk_usage | mail -s "disk usage" unixbhaskar@gmail.com 20 | 21 | rm /tmp/du$$ 22 | -------------------------------------------------------------------------------- /firmware_update.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | printf "Updating firmware of the system ...wait ... \n\n" 4 | 5 | fwupdmgr get-devices 6 | 7 | #This will display all devices detected by fwupd. 8 | 9 | fwupdmgr refresh 10 | 11 | #This will download the latest metadata from LVFS. 12 | 13 | fwupdmgr get-updates 14 | 15 | #If updates are available for any devices on the system, they'll be displayed. 16 | 17 | fwupdmgr update 18 | 19 | #To report the status of an update run: 20 | 21 | fwupdmgr report-history 22 | 23 | # To clear the local history of updates: 24 | 25 | # fwupdmgr clear-history 26 | -------------------------------------------------------------------------------- /root_uid_change: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | for id in `awk 'FS=":" {if(($3 == 0 && $1 != "root" )) print $1}' /etc/passwd` 4 | do 5 | cat << the_end >/dev/console 6 | 7 | +---------------------------------------------------------------- 8 | | 9 | | `date "+Detacted On Date :%D Time :%r"` 10 | | Break-in ALERT! Login ID `echo ${id}` has uid 0 11 | | 12 | +---------------------------------------------------------------- 13 | 14 | the_end 15 | done 16 | 17 | -------------------------------------------------------------------------------- /httpd_apache_restart_segfault: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | sfile=/tmp/.seg_fault 4 | TO_MAIL=user@domain.tld 5 | 6 | if [ -f "${sfile}" ]; then 7 | old_count=`cat /tmp/.seg_fault` 8 | else 9 | old_count=0 10 | fi 11 | 12 | new_count=`/bin/grep -c "Segmentation fault (11)" /var/log/httpd/error_log` 13 | echo $new_count > $sfile 14 | 15 | if [ "${new_count}" -ne "0" ] && [ "${old_count}" -ne "${new_count}" ]; then 16 | /sbin/service httpd restart 17 | echo "segmentation fault detected and httpd restarted" | mail -s "httpd restarted" $TO_MAIL 18 | fi 19 | 20 | exit 0 21 | -------------------------------------------------------------------------------- /i3-scripts/mail.sh: -------------------------------------------------------------------------------- 1 | USER="unixbhaskar@gmail.com" 2 | PASS="" 3 | 4 | COUNT=`curl -su $USER:$PASS https://mail.google.com/mail/feed/atom || echo "Not fetching mail"` 5 | COUNT=`echo "$COUNT" | grep -oPm1 "(?<=)[^<]+" ` 6 | echo -e ":$COUNT\n" 7 | #echo $COUNT 8 | if [ "$COUNT" != "0" ]; then 9 | if [ "$COUNT" = "1" ];then 10 | WORD="mail"; 11 | else 12 | WORD="mails"; 13 | fi 14 | fi 15 | 16 | #if [[ $COUNT -gt 10 ]];then 17 | 18 | # /usr/bin/notify-send --expire-time=5000 --urgency=normal "You have got mails" 19 | #fi 20 | 21 | -------------------------------------------------------------------------------- /unmount_disk: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # This is just for the information 4 | mounted_disk=$(df -h | grep nvme | gawk '{ print $1" " $6 }' | dmenu -p "Mounted partition,just press escapes:") 5 | 6 | # This is how the actual disk are 7 | disks=$(df -h | grep nvme | gawk '{ print $1 }') 8 | 9 | # Select the damn partition to unmount 10 | actual_disk_to_unmount=$(printf "%s${disks[0]}" | dmenu -i -p "Which One you want to unmount:") 11 | 12 | # This is actually prompting for sudo password to impact the unmount command 13 | SUDO_ASKPASS=/home/bhaskar/bin/dpass sudo -A umount $actual_disk_to_unmount && notify-send "Done!" 14 | -------------------------------------------------------------------------------- /.vim/bash-support/codesnippets/create-tempfile-with-trap: -------------------------------------------------------------------------------- 1 | 2 | #----------------------------------------------------------------------- 3 | # cleanup temporary file in case of a keyboard interrupt (SIGINT) 4 | # or a termination signal (SIGTERM) 5 | #----------------------------------------------------------------------- 6 | function cleanup_temp 7 | { 8 | [ -e $tmpfile ] && rm --force $tmpfile 9 | exit 0 10 | } 11 | 12 | trap cleanup_temp SIGHUP SIGINT SIGPIPE SIGTERM 13 | 14 | tmpfile=$(mktemp) || { echo "$0: creation of temporary file failed!"; exit 1; } 15 | 16 | # use tmpfile ... 17 | 18 | rm --force $tmpfile 19 | 20 | -------------------------------------------------------------------------------- /daemon-status: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # daemon status 3 | 4 | function chk_status(){ 5 | target=$1 6 | if [ $target != "functions" ] && [ $target != "functions.d" ] 7 | then 8 | if [ -f "/var/run/$target" ] 9 | then 10 | stat="\e[1;32m[RUNNING]" 11 | else 12 | stat="\e[1;31m[STOPPED]" 13 | fi 14 | 15 | printf "$stat \t\e[1;34m$target\e[0;0m\n" 16 | fi 17 | } 18 | 19 | daemons=$(ls //usr/lib/systemd/system/) 20 | if [[ $1 != "" ]] 21 | then 22 | chk_status $1 23 | else 24 | for d in $daemons 25 | do 26 | chk_status $d 27 | done | sort 28 | fi 29 | exit 0 30 | -------------------------------------------------------------------------------- /i3-scripts/cmus.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | INFO_CMUS=$(cmus-remote -Q 2>/dev/null) 4 | if [[ $? -eq 0 ]]; then 5 | INFO_TITLE=$(echo "${INFO_CMUS}" | sed -n -e 's/^.*title//p' | head -n 1) 6 | INFO_ALBUM=$(echo "${INFO_CMUS}" | sed -n -e 's/^.*album//p' | head -n 1) 7 | INFO_ARTIST=$(echo "${INFO_CMUS}" | sed -n -e 's/^.*artist//p' | head -n 1) 8 | else 9 | exit 10 | fi 11 | 12 | if [[ "${INFO_ARTIST}" ]] && [[ "${INFO_TITLE}" ]]; then 13 | OUT_TEXT="${INFO_ARTIST} - ${INFO_TITLE}" 14 | elif [[ "${INFO_TITLE}" ]]; then 15 | OUT_TEXT="${INFO_TITLE}" 16 | fi 17 | 18 | echo "${OUT_TEXT}" 19 | echo "${OUT_TEXT}" 20 | exit 21 | -------------------------------------------------------------------------------- /.vim/autoload/bash-support/codesnippets/create-tempfile-with-trap: -------------------------------------------------------------------------------- 1 | 2 | #----------------------------------------------------------------------- 3 | # cleanup temporary file in case of a keyboard interrupt (SIGINT) 4 | # or a termination signal (SIGTERM) 5 | #----------------------------------------------------------------------- 6 | function cleanup_temp 7 | { 8 | [ -e $tmpfile ] && rm --force $tmpfile 9 | exit 0 10 | } 11 | 12 | trap cleanup_temp SIGHUP SIGINT SIGPIPE SIGTERM 13 | 14 | tmpfile=$(mktemp) || { echo "$0: creation of temporary file failed!"; exit 1; } 15 | 16 | # use tmpfile ... 17 | 18 | rm --force $tmpfile 19 | 20 | -------------------------------------------------------------------------------- /process_info.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import commands, os, string 3 | 4 | program = raw_input("Enter the name of the program to check: ") 5 | 6 | try: 7 | #perform a ps command and assign results to a list 8 | output = commands.getoutput("ps -f|grep " + program) 9 | proginfo = string.split(output) 10 | 11 | #display results 12 | print "\n\ 13 | Full path:\t\t", proginfo[5], "\n\ 14 | Owner:\t\t\t", proginfo[0], "\n\ 15 | Process ID:\t\t", proginfo[1], "\n\ 16 | Parent process ID:\t", proginfo[2], "\n\ 17 | Time started:\t\t", proginfo[4] 18 | except: 19 | print "There was a problem with the program." 20 | -------------------------------------------------------------------------------- /.vim/bash-support/codesnippets/debugging/_debug_assert: -------------------------------------------------------------------------------- 1 | #=== FUNCTION ================================================================ 2 | # NAME: _assert 3 | # DESCRIPTION: Abort the script if assertion is false. 4 | # PARAMETERS: 1) expression used as test inside brackets 5 | # 2) optional information, e.g. $LINENO 6 | # RETURNS: 0 / 99 assertion is true / false 7 | #=============================================================================== 8 | function _assert () 9 | { 10 | if [ ! $1 ]; then 11 | echo "${0##*/}${2:+:$2}: assertion '$1' failed." 12 | exit 99 13 | fi 14 | return 0 15 | } 16 | 17 | -------------------------------------------------------------------------------- /.vim/autoload/bash-support/codesnippets/debugging/_debug_assert: -------------------------------------------------------------------------------- 1 | #=== FUNCTION ================================================================ 2 | # NAME: _assert 3 | # DESCRIPTION: Abort the script if assertion is false. 4 | # PARAMETERS: 1) expression used as test inside brackets 5 | # 2) optional information, e.g. $LINENO 6 | # RETURNS: 0 / 99 assertion is true / false 7 | #=============================================================================== 8 | function _assert () 9 | { 10 | if [ ! $1 ]; then 11 | echo "${0##*/}${2:+:$2}: assertion '$1' failed." 12 | exit 99 13 | fi 14 | return 0 15 | } 16 | 17 | -------------------------------------------------------------------------------- /user_Add.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Script to add a user to Linux system 3 | if [ $(id -u) -eq 0 ]; then 4 | read -p "Enter username : " username 5 | read -s -p "Enter password : " password 6 | egrep "^$username" /etc/passwd >/dev/null 7 | if [ $? -eq 0 ]; then 8 | echo "$username exists!" 9 | exit 1 10 | else 11 | pass=$(perl -e 'print crypt($ARGV[0], "password")' $password) 12 | useradd -m -p $pass $username 13 | [ $? -eq 0 ] && echo "User has been added to system!" || echo "Failed to add a user!" 14 | fi 15 | else 16 | echo "Only root may add a user to the system" 17 | exit 2 18 | fi 19 | 20 | -------------------------------------------------------------------------------- /.vim/colors/default.vim: -------------------------------------------------------------------------------- 1 | " Vim color file 2 | " Maintainer: Bram Moolenaar 3 | " Last Change: 2001 Jul 23 4 | 5 | " This is the default color scheme. It doesn't define the Normal 6 | " highlighting, it uses whatever the colors used to be. 7 | 8 | " Set 'background' back to the default. The value can't always be estimated 9 | " and is then guessed. 10 | hi clear Normal 11 | set bg& 12 | 13 | " Remove all existing highlighting and set the defaults. 14 | hi clear 15 | 16 | " Load the syntax highlighting defaults, if it's enabled. 17 | if exists("syntax_on") 18 | syntax reset 19 | endif 20 | 21 | let colors_name = "default" 22 | 23 | " vim: sw=2 24 | -------------------------------------------------------------------------------- /sys.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import subprocess 3 | 4 | #Note that Python is much more flexible with equal signs. There can be spaces around equal signs. 5 | MESSAGES = "pwd" 6 | SPACE = "df -h" 7 | KERNEL = "uname -a" 8 | MEMORY = "free -m" 9 | 10 | #Places variables into a list/array 11 | cmds = [MESSAGES, SPACE, KERNEL,MEMORY] 12 | 13 | #Iterates over list, running statements for each item in the list 14 | #Note, that whitespace is absolutely critical and that a consistent indent must be maintained for the code to work properly 15 | count=0 16 | for cmd in cmds: 17 | # count+=1 18 | # print "This is %s" % count 19 | subprocess.call(cmd, shell=True) 20 | -------------------------------------------------------------------------------- /i3-scripts/servpros: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # The service we want to check (according to systemctl) 4 | SERVICE=$BLOCK_NAME 5 | 6 | if [[ "$(systemctl is-active $SERVICE)" != "active" ]] 7 | then 8 | if [[ $BLOCK_BUTTON == '1' ]] 9 | then 10 | echo ''$SERVICE'' 11 | systemctl start $SERVICE 12 | else 13 | echo ''$SERVICE'' 14 | fi 15 | else 16 | if [[ $BLOCK_BUTTON == '1' ]] 17 | then 18 | echo ''$SERVICE'' 19 | systemctl stop $SERVICE 20 | else 21 | echo ''$SERVICE'' 22 | fi 23 | fi 24 | -------------------------------------------------------------------------------- /.vim/bash-support/rc/sample_template_file: -------------------------------------------------------------------------------- 1 | § ============================================================= 2 | § User Macros 3 | § ============================================================= 4 | 5 | SetMacro( 'AUTHOR', 'YOUR NAME' ) 6 | SetMacro( 'AUTHORREF', '' ) 7 | SetMacro( 'COMPANY', '' ) 8 | SetMacro( 'COPYRIGHT', 'Copyright (c) |YEAR|, |AUTHOR|' ) 9 | SetMacro( 'EMAIL', '' ) 10 | SetMacro( 'LICENSE', 'GNU General Public License' ) 11 | SetMacro( 'ORGANIZATION','' ) 12 | 13 | § ============================================================= 14 | § File Includes and Shortcuts 15 | § ============================================================= 16 | 17 | -------------------------------------------------------------------------------- /.vim/bash-support/codesnippets/_trap_EXIT: -------------------------------------------------------------------------------- 1 | #=== FUNCTION ================================================================ 2 | # NAME: _trap_EXIT 3 | # DESCRIPTION: Trap code for the pseudo-signal EXIT. Generates an message. 4 | # PARAMETERS: The current line number given by $LINENO . 5 | #=============================================================================== 6 | function _trap_EXIT () 7 | { 8 | echo -e "\nEXIT line ${1}: Script exited with status ${?}" 9 | } # ---------- end of function ---------- 10 | 11 | trap '_trap_EXIT $LINENO' EXIT # trap EXIT 12 | 13 | #trap - EXIT # reset the EXIT trap 14 | 15 | -------------------------------------------------------------------------------- /i3-scripts/process.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | #PROG="${BLOCK_INSTANCE:-firefox}" 4 | 5 | #PROG_REGEX="["$(echo "${PROG}" | cut -c 1)"]"$(echo "${PROG}" | cut -c 2-)" " 6 | #PROCESS=$(ps -eo pid,cmd | grep -w ${PROG_REGEX}) 7 | 8 | #if [[ "${PROCESS}" ]]; then 9 | # echo "pidof ${PROCESS}" 10 | # echo "pifof ${PROCESS}" 11 | # echo "" 12 | # else 13 | # echo "na" 14 | # echo "na" 15 | # echo "" 16 | # exit 33 17 | # fi 18 | 19 | proc_stat=$(top -bn1 | head -2 | grep running | gawk '{ print $2";"$5":"$4 }' | tr -d ',') 20 | 21 | echo -e "Process:$proc_stat\n" 22 | #echo "Process:${proc_stat}" 23 | -------------------------------------------------------------------------------- /i3-scripts/vpn.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | 4 | 5 | ##Check VPN status 6 | #GET_VPN=$(nmcli con show | grep tun0 | cut -d ' ' -f1) 7 | #GET_VPN=$([ -e /proc/sys/net/ipv4/conf/tun0]) 8 | GET_VPN=$( if [[ -e /proc/sys/net/ipv4/conf/tun0 ]];then 9 | echo "tun0" 10 | else 11 | echo "no vpn" 12 | 13 | fi 14 | ) 15 | 16 | ##Store status in STATUS 17 | if [[ $GET_VPN == *"tun0"* ]] 18 | then 19 | STATUS=ON 20 | else 21 | STATUS=OFF 22 | fi 23 | 24 | 25 | 26 | echo $STATUS 27 | echo $STATUS 28 | 29 | 30 | 31 | ##Colors 32 | if [[ "$STATUS" == "ON" ]] 33 | then 34 | echo "#00ff00" 35 | else 36 | echo "#ff0000" 37 | fi 38 | -------------------------------------------------------------------------------- /.vim/autoload/bash-support/rc/sample_template_file: -------------------------------------------------------------------------------- 1 | § ============================================================= 2 | § User Macros 3 | § ============================================================= 4 | 5 | SetMacro( 'AUTHOR', 'YOUR NAME' ) 6 | SetMacro( 'AUTHORREF', '' ) 7 | SetMacro( 'COMPANY', '' ) 8 | SetMacro( 'COPYRIGHT', 'Copyright (c) |YEAR|, |AUTHOR|' ) 9 | SetMacro( 'EMAIL', '' ) 10 | SetMacro( 'LICENSE', 'GNU General Public License' ) 11 | SetMacro( 'ORGANIZATION','' ) 12 | 13 | § ============================================================= 14 | § File Includes and Shortcuts 15 | § ============================================================= 16 | 17 | -------------------------------------------------------------------------------- /.vim/autoload/bash-support/codesnippets/_trap_EXIT: -------------------------------------------------------------------------------- 1 | #=== FUNCTION ================================================================ 2 | # NAME: _trap_EXIT 3 | # DESCRIPTION: Trap code for the pseudo-signal EXIT. Generates an message. 4 | # PARAMETERS: The current line number given by $LINENO . 5 | #=============================================================================== 6 | function _trap_EXIT () 7 | { 8 | echo -e "\nEXIT line ${1}: Script exited with status ${?}" 9 | } # ---------- end of function ---------- 10 | 11 | trap '_trap_EXIT $LINENO' EXIT # trap EXIT 12 | 13 | #trap - EXIT # reset the EXIT trap 14 | 15 | -------------------------------------------------------------------------------- /getopts.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # this script will take command line argument for anythign mentioned below in case statement plus a catch all opetion. 3 | echo -n " Enter the valid thing : " 4 | read options 5 | while getopts ":u:a:s:v" options; do 6 | case $options in 7 | u ) uname=$OPTARG;; # user name 8 | a ) attrs=$OPTARG;; # attributes 9 | s ) searchattr=$OPTARG;; # search attributes 10 | v ) att=ALL;; # verbose 11 | h ) echo $usage;; # spit out the thing how to use properly 12 | \? ) echo $usage # spit out the theing how to use properly 13 | exit 1;; 14 | * ) echo $usage # catch all thing 15 | exit 1;; 16 | esac 17 | done 18 | -------------------------------------------------------------------------------- /.vim/bash-support/codesnippets/debugging/_debug_function.noindent: -------------------------------------------------------------------------------- 1 | 2 | DEBUG=${DEBUG:-0} # 0 = no debug output, 1 = show debug output, 3 | # or enable debug with: DEBUG=1 script.sh 4 | 5 | #=== FUNCTION ================================================================ 6 | # NAME: _debug 7 | # DESCRIPTION: echo debug output controlled by a global variable 8 | # PARAMETERS: list, e.g.; "$LINENO: x=$x" 9 | # RETURNS: always 0 10 | #=============================================================================== 11 | _debug () 12 | { 13 | [ ${DEBUG} -ne 0 ] && echo -e "${@}" 14 | return 0 15 | } # ---------- end of function _debug ---------- 16 | -------------------------------------------------------------------------------- /download_progress: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #download_url=$1 4 | # grab_url=$(ps -ef | grep wget | head -1 | gawk ' { print $10 }') 5 | 6 | download_url=$( echo | dmenu -p "Give Download Url:" ) 7 | 8 | nourl() { 9 | if [[ "$down_url" == "" ]];then 10 | notify-send "It seems, you forgot to provide the URL .." 11 | exit 1 12 | fi 13 | } 14 | 15 | download() { 16 | 17 | wget $download_url 2>&1 | sed -u 's/.* \([0-9]\+%\)\ \+\([0-9.]\+.\) \(.*\)/\1\n# Downloading at \2\/s, ETA \3/' 18 | notify-send "Downloading this: $download_url" 19 | } 20 | 21 | main() { 22 | 23 | if [[ "$download_url" != "" ]];then 24 | 25 | download 26 | else 27 | nourl 28 | fi 29 | 30 | } 31 | 32 | main 33 | 34 | -------------------------------------------------------------------------------- /i3-scripts/clock: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | 4 | case $BLOCK_BUTTON in 5 | 1) notify-send "This Month" "$(cal --color=always) && notify-send "Schedules" "$(calcurse -D ~/.config/calcurse -d3)" ;; 6 | 2) setsid "$TERMINAL" -e calcurse -D ~/.config/calcurse & ;; 7 | 3) notify-send "Time/date module" "\- Left click to show upcoming schedule for the next three days via \`/usr/bin/calcurse \` and show the month via \`cal\` 8 | - Middle click opens calcurse if installed" ;; 9 | 6) "$TERMINAL" -e "$EDITOR" "$0" ;; 10 | esac 11 | 12 | printf '%s %s%s\n' "$(date '+%Y %b %d (%a)')" "$icon" "$(date '+%I:%M%p')" 13 | 14 | #for europeans, use this 15 | #printf '%s %s%s\n' "$(date '+%a %d/%m')" "$icon" "$(date '+%I:%M%p')" 16 | -------------------------------------------------------------------------------- /.vim/autoload/bash-support/codesnippets/debugging/_debug_function.noindent: -------------------------------------------------------------------------------- 1 | 2 | DEBUG=${DEBUG:-0} # 0 = no debug output, 1 = show debug output, 3 | # or enable debug with: DEBUG=1 script.sh 4 | 5 | #=== FUNCTION ================================================================ 6 | # NAME: _debug 7 | # DESCRIPTION: echo debug output controlled by a global variable 8 | # PARAMETERS: list, e.g.; "$LINENO: x=$x" 9 | # RETURNS: always 0 10 | #=============================================================================== 11 | _debug () 12 | { 13 | [ ${DEBUG} -ne 0 ] && echo -e "${@}" 14 | return 0 15 | } # ---------- end of function _debug ---------- 16 | -------------------------------------------------------------------------------- /notmuch_database_upgrade.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | notmuch=$(command -v notmuch) 4 | 5 | printf "\n Sit tight ...it might take some time .....\n" 6 | 7 | # Dumping the existing databse as back 8 | 9 | $notmuch dump --output=$HOME/database_dump.nm 10 | 11 | # Take backup of the existing folder as precaution 12 | 13 | mv -v ~/gmail-backup/.notmuch{,_$(date +'%F')} 14 | 15 | # Running it for initializing the entire mailbox 16 | 17 | $notmuch new 18 | 19 | # Tagging it 20 | 21 | $notmuch tag -inbox -unread '*' 22 | 23 | # Restore back the previous state including tags 24 | 25 | $notmuch restore --accumulate --input=$HOME/database_dump.nm 26 | 27 | printf "\n Done..now check the database and delete the backup.\n" -------------------------------------------------------------------------------- /vimwiki/moving_from_one_kernel_version_to_another.wiki: -------------------------------------------------------------------------------- 1 | 2 | # moving from 5.6 to 5.7 3 | 4 | $ cd ~/linux-5.6 # change to kernel source dir 5 | $ patch -p1 < ../patch-5.7 # apply the 5.7 patch 6 | $ cd .. 7 | $ mv linux-5.6 linux-5.7 # rename source dir 8 | 9 | # moving from 5.6.1 to 5.7 10 | 11 | $ cd ~/linux-5.6.1 # change to kernel source dir 12 | $ patch -p1 -R < ../patch-5.6.1 # revert the 5.6.1 patch 13 | # source dir is now 5.6 14 | $ patch -p1 < ../patch-5.7 # apply new 5.7 patch 15 | $ cd .. 16 | $ mv linux-5.6.1 linux-5.7 # rename source dir 17 | -------------------------------------------------------------------------------- /ssh-everywhere.sh: -------------------------------------------------------------------------------- 1 | #/bin/bash 2 | # ssh-everywhere.sh 3 | HOSTS="" 4 | for i in $HOSTS 5 | do 6 | tmux splitw "ssh $i" 7 | tmux select-layout tiled 8 | done 9 | tmux set-window-option synchronize-panes on 10 | 11 | #Now start the whole thing: 12 | 13 | tmux new 'exec sh ssh-everywhere.sh' 14 | 15 | #points to remember 16 | 17 | #Here is a list of a few basic tmux commands: 18 | 19 | # Ctrl+b " - split pane horizontally. 20 | # Ctrl+b % - split pane vertically. 21 | # Ctrl+b arrow key - switch pane. 22 | # Hold Ctrl+b, don't release it and hold one of the arrow keys - resize pane. 23 | # Ctrl+b c - (c)reate a new window. 24 | # Ctrl+b n - move to the (n)ext window. 25 | # Ctrl+b p - move to the (p)revious window. 26 | 27 | -------------------------------------------------------------------------------- /i3-scripts/uptime.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | #/usr/bin/i3status -c $HOME/.config/i3/i3status.conf | while : 4 | 5 | 6 | #do 7 | # read line 8 | #RAM=`free -kh | grep Mem | awk '{print $3}'` 9 | #TOTR=$(cat /proc/meminfo | grep MemT | sed 's/.*\://g' | sed 's/ *//g' | sed 's/kB//g') 10 | #TOT=$(octave --eval "$TOTR/1024^2" | sed 's/ans = *//g' | sed 's/$/G/g' ) 11 | 12 | # Put uptime 13 | uptime=$(uptime | gawk '{ print $3 $4 }' | sed 's/,.*//' ) 14 | #| sed 's/,.*//'` 15 | #hour=$(echo $uptime | sed 's/\:.*//g') 16 | #min=$(echo $uptime | sed 's/.*\://g') 17 | #UP="$hour h $min m" 18 | echo -e ":$uptime\n" 19 | 20 | #printf "%s\n" "UP:$uptime" 21 | #done 22 | 23 | -------------------------------------------------------------------------------- /.vim/bash-support/codesnippets/_trap_ERR: -------------------------------------------------------------------------------- 1 | #=== FUNCTION ================================================================ 2 | # NAME: _trap_ERROR 3 | # DESCRIPTION: Trap code for the pseudo-signal ERR (A command returning a 4 | # non-zero exit status). Generates an error message. 5 | # PARAMETERS: The current line number given by $LINENO . 6 | #=============================================================================== 7 | function _trap_ERROR () 8 | { 9 | echo -e "\nERROR line ${1}: Command exited with status ${?}" 10 | } # ---------- end of function _trap_ERROR ---------- 11 | 12 | trap '_trap_ERROR $LINENO' ERR # trap ERR 13 | 14 | #trap - ERR # reset the ERR trap 15 | 16 | -------------------------------------------------------------------------------- /.vim/bash-support/templates/set.templates: -------------------------------------------------------------------------------- 1 | § ============================================================= 2 | § Set 3 | § ============================================================= 4 | 5 | == LIST: set == list == 6 | 'allexport', 7 | 'braceexpand', 8 | 'emacs', 9 | 'errexit', 10 | 'errtrace', 11 | 'functrace', 12 | 'hashall', 13 | 'histexpand', 14 | 'history', 15 | 'ignoreeof', 16 | 'keyword', 17 | 'monitor', 18 | 'noclobber', 19 | 'noexec', 20 | 'noglob', 21 | 'notify', 22 | 'nounset', 23 | 'onecmd', 24 | 'physical', 25 | 'pipefail', 26 | 'posix', 27 | 'privileged', 28 | 'verbose', 29 | 'vi', 30 | 'xtrace', 31 | == ENDLIST == 32 | 33 | == Set == expandmenu, map:bse, sc:s == 34 | |PickList( 'set option', 'set' )| 35 | set -o |PICK| 36 | == ENDTEMPLATE == 37 | -------------------------------------------------------------------------------- /.vim/autoload/bash-support/codesnippets/_trap_ERR: -------------------------------------------------------------------------------- 1 | #=== FUNCTION ================================================================ 2 | # NAME: _trap_ERROR 3 | # DESCRIPTION: Trap code for the pseudo-signal ERR (A command returning a 4 | # non-zero exit status). Generates an error message. 5 | # PARAMETERS: The current line number given by $LINENO . 6 | #=============================================================================== 7 | function _trap_ERROR () 8 | { 9 | echo -e "\nERROR line ${1}: Command exited with status ${?}" 10 | } # ---------- end of function _trap_ERROR ---------- 11 | 12 | trap '_trap_ERROR $LINENO' ERR # trap ERR 13 | 14 | #trap - ERR # reset the ERR trap 15 | 16 | -------------------------------------------------------------------------------- /.vim/autoload/bash-support/templates/set.templates: -------------------------------------------------------------------------------- 1 | § ============================================================= 2 | § Set 3 | § ============================================================= 4 | 5 | == LIST: set == list == 6 | 'allexport', 7 | 'braceexpand', 8 | 'emacs', 9 | 'errexit', 10 | 'errtrace', 11 | 'functrace', 12 | 'hashall', 13 | 'histexpand', 14 | 'history', 15 | 'ignoreeof', 16 | 'keyword', 17 | 'monitor', 18 | 'noclobber', 19 | 'noexec', 20 | 'noglob', 21 | 'notify', 22 | 'nounset', 23 | 'onecmd', 24 | 'physical', 25 | 'pipefail', 26 | 'posix', 27 | 'privileged', 28 | 'verbose', 29 | 'vi', 30 | 'xtrace', 31 | == ENDLIST == 32 | 33 | == Set == expandmenu, map:bse, sc:s == 34 | |PickList( 'set option', 'set' )| 35 | set -o |PICK| 36 | == ENDTEMPLATE == 37 | -------------------------------------------------------------------------------- /kubernetes-install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright 2014 Google Inc. All rights reserved. 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | echo Install Kubernetes securely: 18 | echo curl -sS https://get.k8s.io | bash 19 | 20 | -------------------------------------------------------------------------------- /i3-scripts/battery.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | output="" 3 | for i in 1 0 4 | do 5 | LEVEL=$(cat /sys/class/power_supply/BAT$i/capacity) 6 | STATUS=$(cat /sys/class/power_supply/BAT$i/status | cut -c1-3) 7 | if [ "$STATUS" == "Unk" ]; then 8 | STATUS="" 9 | fi 10 | 11 | if [ "$STATUS" == "Charging" ];then 12 | echo "$LEVEL% $STATUS" 13 | fi 14 | 15 | if [ ${#output} -eq 0 ]; then 16 | output="$LEVEL% $STATUS" 17 | else 18 | output="$output | $LEVEL% $STATUS" 19 | fi 20 | done 21 | echo $output 22 | 23 | #BATTINFO=$(acpi -b) 24 | #warn=$(if [[ $(echo $BATTINFO | grep Discharging) && $(echo $BATTINFO | cut -f 5 -d " ") < 00:15:00 ]] ; then 25 | # DISPLAY=:0.0 /usr/bin/notify-send "low battery" "$BATTINFO" 26 | #fi 27 | #) 28 | #done 29 | #echo $output $warn 30 | -------------------------------------------------------------------------------- /i3-scripts/dhcp.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | #pidfile1="/var/run/dhc*.pid" 4 | pidfile2="/var/run/wicd/wicd.pid" 5 | syspath1="/proc/sys/net/ipv4/conf/wlp3s0" 6 | syspath2="/proc/sys/net/ipv4/conf/wlan0" 7 | GET_DHCP=$(if [[ -e $pidfile2 ]] || [[ -e $syspath1 ]] || [[ -e $syspath2 ]];then 8 | 9 | echo "ON" 10 | 11 | else 12 | 13 | echo "OFF" 14 | fi 15 | ) 16 | if [[ $GET_DHCP == *"ON"* ]] 17 | then 18 | STATUS="ON" 19 | else 20 | STATUS=OFF 21 | fi 22 | 23 | 24 | 25 | echo $STATUS 26 | echo $STATUS 27 | 28 | 29 | 30 | ##Colors 31 | if [[ "$STATUS" == "ON" ]] 32 | then 33 | echo "#00ff00" 34 | else 35 | echo "#ff0000" 36 | fi 37 | 38 | -------------------------------------------------------------------------------- /measure_website_response: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # This script appeared in IBM Linux Technical Library many moons ago,around 4 | # 2009-2010. I have modified it to suit my convenience. 5 | # Original one was written by either M.Tim.Jones or Ian Shield, 6 | # not sure who it was,because I can't remember it. 7 | 8 | # Quick and dirty way to measure website response. 9 | 10 | CURL=$(command -v curl) 11 | GAWK=$(command -v gawk) 12 | 13 | echo -n "Please pass the url you want to measure: " 14 | read -r url 15 | URL="$url" 16 | 17 | result=$($CURL -o /dev/null -s -w %{time_connect}:%{time_starttransfer}:%{time_total} $URL) 18 | echo " Time_Connect Time_startTransfer Time_total " 19 | echo $result | $GAWK -F: '{ print $1" "$2" "$3}' 20 | 21 | -------------------------------------------------------------------------------- /csr.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | import os 3 | import sys 4 | 5 | print "WARNING: For NameCheap, the 'common name' field must be the domain name you would like to activate." 6 | 7 | SSL_DIR = "/etc/ssl/" 8 | 9 | def usage(): 10 | app_name = sys.argv[0] 11 | print """%s usage: 12 | %s domain_name 13 | 14 | domain_name The domain name to generate a key and CSR for 15 | """ % (app_name, app_name) 16 | sys.exit(0) 17 | 18 | if len(sys.argv) < 2: 19 | usage() 20 | 21 | domain_name = sys.argv[1].strip() 22 | 23 | os.system("openssl genrsa -out " + SSL_DIR + domain_name + ".key 2048") 24 | os.system("openssl req -new -key " + SSL_DIR + domain_name + ".key -out " + SSL_DIR + domain_name + ".csr") 25 | os.system("cat " + SSL_DIR + domain_name + ".csr") 26 | 27 | print "\n\nCSR generation complete" 28 | -------------------------------------------------------------------------------- /install_flash_player.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # This script installs Adobe Flash Player to your user directory 4 | 5 | # Make sure the plugins directory exists 6 | mkdir ~/.mozilla/plugins 7 | 8 | # Download Flash Player from Adobe 9 | wget http://fpdownload.macromedia.com/get/flashplayer/current/install_flash_player_10_linux.tar.gz 10 | 11 | # Extract the tarball 12 | tar zxf install_flash_player_10_linux.tar.gz 13 | 14 | # Copy the plugin to the correct location 15 | cp install_flash_player_10_linux/libflashplayer.so ~/.mozilla/plugins/libflashplayer.so 16 | 17 | # Delete the tarball and extracted directory 18 | rm -rf install_flash_player_10_linux 19 | rm install_flash_player_10_linux.tar.gz 20 | 21 | # End of installation 22 | echo " " 23 | echo "Adobe Flash Player has been installed" 24 | echo " " 25 | 26 | exit 27 | -------------------------------------------------------------------------------- /install_flash_player.sh.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # This script installs Adobe Flash Player to your user directory 4 | 5 | # Make sure the plugins directory exists 6 | mkdir ~/.mozilla/plugins 7 | 8 | # Download Flash Player from Adobe 9 | wget http://fpdownload.macromedia.com/get/flashplayer/current/install_flash_player_10_linux.tar.gz 10 | 11 | # Extract the tarball 12 | tar zxf install_flash_player_10_linux.tar.gz 13 | 14 | # Copy the plugin to the correct location 15 | cp install_flash_player_10_linux/libflashplayer.so ~/.mozilla/plugins/libflashplayer.so 16 | 17 | # Delete the tarball and extracted directory 18 | rm -rf install_flash_player_10_linux 19 | rm install_flash_player_10_linux.tar.gz 20 | 21 | # End of installation 22 | echo " " 23 | echo "Adobe Flash Player has been installed" 24 | echo " " 25 | 26 | exit -------------------------------------------------------------------------------- /gitstats/tags.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | GitStats - AdminScripts 6 | 7 | 8 | 9 | 10 | 11 |

Tags

12 | 22 |
Total tags
0
NameDateCommitsAuthors
-------------------------------------------------------------------------------- /git_clone_download: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #download_url=$1 4 | # grab_url=$(ps -ef | grep (wget\|curl\|git) | head -1 | gawk ' { print $10 }') 5 | 6 | clone_url=$( echo | dmenu -p "Give Git Clone Url:" ) 7 | 8 | nourl() { 9 | if [[ "$clone_url" == "" ]];then 10 | notify-send "It seems, you forgot to provide the URL .." 11 | exit 1 12 | fi 13 | } 14 | 15 | cloning_git_repo() { 16 | cd $HOME/git-linux && git clone "$clone_url" 17 | # wget $download_url 2>&1 | sed -u 's/.* \([0-9]\+%\)\ \+\([0-9.]\+.\) \(.*\)/\1\n# Downloading at \2\/s, ETA \3/' 18 | notify-send "Cloning this: $clone_url" 19 | } 20 | 21 | cloning() { 22 | 23 | if [[ "$clone_url" != "" ]];then 24 | 25 | cloning_git_repo 26 | cd "$(basename $clone_url .git)" && bash - 27 | else 28 | nourl 29 | fi 30 | 31 | } 32 | 33 | cloning 34 | 35 | -------------------------------------------------------------------------------- /.vim/bash-support/codesnippets/_trap_RETURN: -------------------------------------------------------------------------------- 1 | #=== FUNCTION ================================================================ 2 | # NAME: _trap_RETURN 3 | # DESCRIPTION: Trap code for the pseudo-signal RETURN. Generates a message. 4 | # The RETURN trap is not inherited by functions. 5 | # Use 'set -o functrace' 6 | # PARAMETERS: The current line number given by $LINENO . 7 | # variable(s) to be tracked 8 | #=============================================================================== 9 | function _trap_RETURN () 10 | { 11 | echo -e "\nRETURN line ${1}: " 12 | } # ---------- end of functionn _trap_RETURN ---------- 13 | 14 | trap '_trap_RETURN $LINENO' RETURN # trap RETURN 15 | 16 | #trap - RETURN # reset the RETURN trap 17 | 18 | -------------------------------------------------------------------------------- /.vim/bash-support/codesnippets/debugging/_debug_timestamp.noindent: -------------------------------------------------------------------------------- 1 | 2 | DEBUG=${DEBUG:-0} # 0 = no debug output, 1 = show debug output, 3 | # or enable debug with: DEBUG=1 script.sh 4 | 5 | #=== FUNCTION ================================================================ 6 | # NAME: _debug_timestamp 7 | # DESCRIPTION: timestamp + optional information 8 | # timestamp: {seconds since 1970-01-01 00:00:00}.{nanoseconds} 9 | # PARAMETERS: identification, e.g. $LINENO (optional) 10 | # RETURNS: always 0 11 | #=============================================================================== 12 | _debug_timestamp () 13 | { 14 | [ ${DEBUG} -ne 0 ] && echo -e "[ $(date "+%s.%N") ]${@:+ -- ${@}}" 15 | return 0 16 | } # ---------- end of function _debug_timestamp ---------- 17 | -------------------------------------------------------------------------------- /i3-scripts/date_time.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash - 2 | #=============================================================================== 3 | # 4 | # FILE: date_time.sh 5 | # 6 | # USAGE: ./date_time.sh 7 | # 8 | # DESCRIPTION: 9 | # 10 | # OPTIONS: --- 11 | # REQUIREMENTS: --- 12 | # BUGS: --- 13 | # NOTES: --- 14 | # AUTHOR: YOUR NAME (), 15 | # ORGANIZATION: 16 | # CREATED: 08/29/2021 17:31 17 | # REVISION: --- 18 | #=============================================================================== 19 | 20 | set -o nounset # Treat unset variables as an error 21 | date_time=$(date '+%d %b %Y %H:%M %a') 22 | echo -e ":$date_time\n" 23 | 24 | cal=$(cal -1) 25 | 26 | case $BLOCK_BUTTON in 27 | 1) notify-send "$cal";; 28 | esac 29 | -------------------------------------------------------------------------------- /.vim/autoload/bash-support/codesnippets/_trap_RETURN: -------------------------------------------------------------------------------- 1 | #=== FUNCTION ================================================================ 2 | # NAME: _trap_RETURN 3 | # DESCRIPTION: Trap code for the pseudo-signal RETURN. Generates a message. 4 | # The RETURN trap is not inherited by functions. 5 | # Use 'set -o functrace' 6 | # PARAMETERS: The current line number given by $LINENO . 7 | # variable(s) to be tracked 8 | #=============================================================================== 9 | function _trap_RETURN () 10 | { 11 | echo -e "\nRETURN line ${1}: " 12 | } # ---------- end of functionn _trap_RETURN ---------- 13 | 14 | trap '_trap_RETURN $LINENO' RETURN # trap RETURN 15 | 16 | #trap - RETURN # reset the RETURN trap 17 | 18 | -------------------------------------------------------------------------------- /.vim/autoload/bash-support/codesnippets/debugging/_debug_timestamp.noindent: -------------------------------------------------------------------------------- 1 | 2 | DEBUG=${DEBUG:-0} # 0 = no debug output, 1 = show debug output, 3 | # or enable debug with: DEBUG=1 script.sh 4 | 5 | #=== FUNCTION ================================================================ 6 | # NAME: _debug_timestamp 7 | # DESCRIPTION: timestamp + optional information 8 | # timestamp: {seconds since 1970-01-01 00:00:00}.{nanoseconds} 9 | # PARAMETERS: identification, e.g. $LINENO (optional) 10 | # RETURNS: always 0 11 | #=============================================================================== 12 | _debug_timestamp () 13 | { 14 | [ ${DEBUG} -ne 0 ] && echo -e "[ $(date "+%s.%N") ]${@:+ -- ${@}}" 15 | return 0 16 | } # ---------- end of function _debug_timestamp ---------- 17 | -------------------------------------------------------------------------------- /latest_chromium.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | cd $(dirname $0) 4 | 5 | LASTCHANGE_URL="https://www.googleapis.com/download/storage/v1/b/chromium-browser-snapshots/o/Linux_x64%2FLAST_CHANGE?alt=media" 6 | 7 | REVISION=$(curl -s -S $LASTCHANGE_URL) 8 | 9 | echo "latest revision is $REVISION" 10 | 11 | if [ -d $REVISION ] ; then 12 | echo "already have latest version" 13 | exit 14 | fi 15 | 16 | ZIP_URL="https://www.googleapis.com/download/storage/v1/b/chromium-browser-snapshots/o/Linux_x64%2F$REVISION%2Fchrome-linux.zip?alt=media" 17 | 18 | ZIP_FILE="${REVISION}-chrome-linux.zip" 19 | 20 | echo "fetching $ZIP_URL" 21 | 22 | rm -rf $REVISION 23 | mkdir $REVISION 24 | pushd $REVISION 25 | curl -# $ZIP_URL > $ZIP_FILE 26 | echo "unzipping.." 27 | unzip $ZIP_FILE 28 | popd 29 | rm -f ./latest 30 | ln -s $REVISION/chrome-linux/chrome ~/latest_chromium 31 | 32 | 33 | -------------------------------------------------------------------------------- /which_git_commit_last_touched_the_file: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | 3 | my %attributions; 4 | my @files; 5 | 6 | open IN, "git ls-tree -r --full-name HEAD |" or die; 7 | while () { 8 | if (/^\S+\s+blob \S+\s+(\S+)$/) { 9 | push(@files, $1); 10 | $attributions{$1} = -1; 11 | } 12 | } 13 | close IN; 14 | 15 | my $remaining = $#files + 1; 16 | 17 | open IN, "git log -r --root --raw --no-abbrev --pretty=format:%h~%an~%ad~ |" or die; 18 | while () { 19 | if (/^([^:~]+)~(.*)~([^~]+)~$/) { 20 | ($commit, $author, $date) = ($1, $2, $3); 21 | } elsif (/^:\S+\s+1\S+\s+\S+\s+\S+\s+\S\s+(.*)$/) { 22 | if ($attributions{$1} == -1) { 23 | $attributions{$1} = "$author, $date ($commit)"; 24 | $remaining--; 25 | if ($remaining <= 0) { 26 | break; 27 | } 28 | } 29 | } 30 | } 31 | close IN; 32 | 33 | for $f (@files) { 34 | print "$f $attributions{$f}\n"; 35 | } -------------------------------------------------------------------------------- /get_latest_chromium.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | cd $(dirname $0) 4 | 5 | LASTCHANGE_URL="https://www.googleapis.com/download/storage/v1/b/chromium-browser-snapshots/o/Linux_x64%2FLAST_CHANGE?alt=media" 6 | 7 | REVISION=$(curl -s -S $LASTCHANGE_URL) 8 | 9 | echo "latest revision is $REVISION" 10 | 11 | if [ -d $REVISION ] ; then 12 | echo "already have latest version" 13 | exit 14 | fi 15 | 16 | ZIP_URL="https://www.googleapis.com/download/storage/v1/b/chromium-browser-snapshots/o/Linux_x64%2F$REVISION%2Fchrome-linux.zip?alt=media" 17 | 18 | ZIP_FILE="${REVISION}-chrome-linux.zip" 19 | 20 | echo "fetching $ZIP_URL" 21 | 22 | rm -rf $REVISION 23 | mkdir $REVISION 24 | pushd $REVISION 25 | curl -# $ZIP_URL > $ZIP_FILE 26 | echo "unzipping.." 27 | unzip $ZIP_FILE 28 | popd 29 | rm -f ./latest 30 | ln -s $REVISION/chrome-linux/chrome ~/latest_chromium 31 | 32 | 33 | -------------------------------------------------------------------------------- /rename_mysql_root_usr: -------------------------------------------------------------------------------- 1 | Set a password for the "root" user and then rename the user. 2 | 3 | Here's a security tip. Much like with UNIX, the first thing you should do with a clean MySQL install is set a password for the root user: 4 | 5 | $ mysqladmin -u root password NEWPASSWORD 6 | 7 | Even better, once you've set the password, change the name of the "root" user to something else. A hacker on a MySQL server will likely target the root, both for its superuser status and because it is a known user. By changing the name of the root user, you make it all the more difficult for hackers to succeed using a brute-force attack. Use the following series of commands to rename the "root" user: 8 | 9 | $ mysql -u root -p 10 | mysql> use mysql; 11 | mysql> update user set password=PASSWORD("NEWPASSWORD") where 12 | User=''; 13 | mysql> flush privileges; 14 | mysql> quit 15 | 16 | -------------------------------------------------------------------------------- /gitstats/lines.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | GitStats - AdminScripts 6 | 7 | 8 | 9 | 10 | 11 |

Lines

12 | 22 |
23 |
Total lines
6258
24 | 25 |

Lines of Code

26 | 27 | Lines of Code -------------------------------------------------------------------------------- /check_uid_pass.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import pwd 3 | 4 | #initialize counters 5 | erroruser = [] 6 | errorpass = [] 7 | 8 | #get password database 9 | passwd_db = pwd.getpwall() 10 | 11 | try: 12 | #check each user and password for validity 13 | for entry in passwd_db: 14 | username = entry[0] 15 | password = entry [1] 16 | if len(username) < 6: 17 | erroruser.append(username) 18 | if len(password) < 8: 19 | errorpass.append(username) 20 | 21 | #print results to screen 22 | print "The following users have an invalid userid (less than six characters):" 23 | for item in erroruser: 24 | print item 25 | print "\nThe following users have invalid password(less than eight characters):" 26 | for item in errorpass: 27 | print item 28 | except: 29 | print "There was a problem running the script." 30 | -------------------------------------------------------------------------------- /i3-scripts/song_name_display: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | 4 | not_playing_in_loop=$(ps -ef | grep mpv | grep -v grep | sort -r | gawk '{ print $10 }' | head -1) 5 | playing_in_loop=$(ps -ef | grep mpv | grep -v grep | sort -r | gawk '{ print $11 }') 6 | 7 | single_song=$(basename $not_playing_in_loop) 8 | single_song2=${single_song%.*} 9 | 10 | loop_song=$(basename $playing_in_loop) 11 | loop_song2=${loop_song%.*} 12 | 13 | 14 | time_total_single=$(mp3info -p "%m:%02s\n" "$HOME/Music/$not_playing_in_loop") 15 | time_total_loop=$(mp3info -p "%m:%02s\n" "$HOME/Music/$playing_in_loop") 16 | 17 | if [[ "$single_song" != "" ]];then 18 | 19 | echo -e " $single_song2 $time_total_single\n" 20 | 21 | elif [[ "$loop_song" != "" ]];then 22 | 23 | echo -e "  $loop_song2 $time_total_loop\n" 24 | 25 | fi 26 | -------------------------------------------------------------------------------- /screenrc: -------------------------------------------------------------------------------- 1 | # this is the global screenrc file. Handle with care. 2 | 3 | termcapinfo xterm* G0:is=\E[?4l\E>:ti@:te@ 4 | termcapinfo linux me=\E[m:AX 5 | #termcapinfo xterm* ti@:te@ 6 | startup_message off 7 | vbell off 8 | autodetach on 9 | altscreen on 10 | shelltitle "$ |bash" 11 | defscrollback 10000 12 | defutf8 on 13 | nonblock on 14 | backtick 1 60 60 $HOME/Adm_scripts/uptime 15 | backtick 2 18 18 $HOME/Adm_scripts/pgp.sh 16 | backtick 3 30 30 $HOME/Adm_scripts/root_volume 17 | backtick 4 25 25 $HOME/Adm_scripts/home_vol 18 | backtick 5 20 20 $HOME/Adm_scripts/data_volume 19 | backtick 6 19 19 $HOME/Adm_scripts/get_freemem 20 | hardstatus alwayslastline 21 | hardstatus string '%{gk}[ %{G}%H %{g}][%= %{wk}%?%-Lw%?%{=b kR}(%{W}%n*%f %t%?(%u)%?%{=b kR})%{= kw}%?%+Lw%?%?%= %{g}][%{Y}%l%{g}]%{=b C}[ %m/%d %c %D ]%{W}%= %{d}[%{=b G}%1`] [%{=b Y}%2`][%{=b B}%3`] [%{=b R}%4`] [%{=b M}%5`] [%{=b C}%6`]' 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /i3-scripts/util.sh: -------------------------------------------------------------------------------- 1 | ################################ 2 | # Calculates a given expression 3 | # 4 | # Dependencies: 5 | # - bc 6 | # 7 | # @param {String} 1: The expression to calculate 8 | # @return {Number}: The result of the expression 9 | ################################ 10 | calc() { 11 | echo "$1" | bc 12 | } 13 | 14 | ################################ 15 | # Counts lines in text, accounting for empty values 16 | # 17 | # @param {String} 1: The input text 18 | # @return {Number}: The number of lines 19 | ################################ 20 | numLines() { 21 | if [[ "$1" == "" ]]; then 22 | echo 0 23 | else 24 | echo "$1" | wc -l 25 | fi 26 | } 27 | 28 | cacheDir=".cache" 29 | cacheFile="$cacheDir/i3-blocks-contrib-${BLOCK_NAME}" 30 | 31 | if [[ -z $cacheDir ]]; then 32 | mkdir $cacheDir 33 | fi 34 | 35 | getCache() { 36 | cat $cacheFile || echo $1 37 | } 38 | 39 | setCache() { 40 | echo "$1" > $cacheFile 41 | } 42 | -------------------------------------------------------------------------------- /notify_config_file_updates: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | declare -a configfiles=(.bashrc .vimrc .muttrc .profile .gitconfig .ithreeconfig 4 | .ithreeblocksconfig) 5 | filechange=$(find $(cat configfiles) -type f -printf '%TY-%Tm-%Td %TT %p\n' | 6 | sort -r | head -1) 7 | 8 | #echo ${configfiles[@]} 9 | ##data_modification=$(stat -c "%y %n" ${configfiles[@]}) 10 | 11 | #echo "Data Modification of these files .. $data_modification" 12 | 13 | #while true; 14 | #do 15 | #ls .bashrc .muttrc .gitconfig .vimrc .profile > /dev/null 16 | 17 | /usr/bin/notify-send "Config file Updated!" "ConfigFile:$filechange" 18 | #done 19 | #while true;do echo ~/.vimrc | entr -p notify-send "Vimrc Updated!";done 20 | #while true;do echo ~/.gitconfig | entr -p notify-send "Gitconfig Updated!";done 21 | 22 | #while inotifywait -e modify --fromfile /home/bhaskar/configfiles; do 23 | #/usr/bin/ notify-send "Config file updated!" 24 | #done 25 | 26 | 27 | -------------------------------------------------------------------------------- /.vim/bash-support/codesnippets/_trap_DEBUG: -------------------------------------------------------------------------------- 1 | #=== FUNCTION ================================================================ 2 | # NAME: _trap_DEBUG 3 | # DESCRIPTION: Trap code for the pseudo-signal DEBUG. Generate a message. 4 | # The DEBUG trap is not inherited by functions. 5 | # Use 'set -o functrace' 6 | # PARAMETERS: 1) identification (e.g. line number $LINENO) 7 | # 2) variable name(s) to be tracked 8 | #=============================================================================== 9 | function _trap_DEBUG () 10 | { 11 | declare identification=$1; 12 | while [ ${#} -gt 1 ]; do 13 | shift 14 | echo -e "DEBUG [$identification] ${1} = '${!1}'" 15 | done 16 | } # ---------- end of function _trap_DEBUG ---------- 17 | 18 | trap '_trap_DEBUG $LINENO <-variable names->' DEBUG # trap DEBUG 19 | 20 | #trap - DEBUG # reset the DEBUG trap 21 | 22 | -------------------------------------------------------------------------------- /.vim/bash-support/codesnippets/debugging/_debug_PS4: -------------------------------------------------------------------------------- 1 | # PS4 : timestamp; the current time in 24-hour HH:MM:SS format 2 | PS4='+[\t] ' 3 | 4 | # PS4 : timestamp; 'seconds.nanoseconds' since 1970-01-01 00:00:00 UT 5 | PS4='+[$(date "+%s.%N")] ' 6 | 7 | # PS4 : position, line number, function name 8 | # The following line avoids error messages due to an unset FUNCNAME[0] : 9 | # set +o nounset # Treat unset variables as an error 10 | # 11 | PS4='+|${BASH_SOURCE##*/} ${LINENO}${FUNCNAME[0]:+ ${FUNCNAME[0]}}| ' 12 | 13 | # PS4 : position, line number, function name, subshell information 14 | # The following line avoids error messages due to an unset FUNCNAME[0] : 15 | # set +o nounset # Treat unset variables as an error 16 | # 17 | PS4='+(${BASH_SOURCE##*/}: ${LINENO}) : ${FUNCNAME[0]} - [level ${SHLVL}, ' 18 | PS4=$PS4'subshell ${BASH_SUBSHELL}, return code $?]\n ' 19 | 20 | # PS4 : default prompt 21 | PS4='+ ' 22 | 23 | -------------------------------------------------------------------------------- /.vim/autoload/bash-support/codesnippets/_trap_DEBUG: -------------------------------------------------------------------------------- 1 | #=== FUNCTION ================================================================ 2 | # NAME: _trap_DEBUG 3 | # DESCRIPTION: Trap code for the pseudo-signal DEBUG. Generate a message. 4 | # The DEBUG trap is not inherited by functions. 5 | # Use 'set -o functrace' 6 | # PARAMETERS: 1) identification (e.g. line number $LINENO) 7 | # 2) variable name(s) to be tracked 8 | #=============================================================================== 9 | function _trap_DEBUG () 10 | { 11 | declare identification=$1; 12 | while [ ${#} -gt 1 ]; do 13 | shift 14 | echo -e "DEBUG [$identification] ${1} = '${!1}'" 15 | done 16 | } # ---------- end of function _trap_DEBUG ---------- 17 | 18 | trap '_trap_DEBUG $LINENO <-variable names->' DEBUG # trap DEBUG 19 | 20 | #trap - DEBUG # reset the DEBUG trap 21 | 22 | -------------------------------------------------------------------------------- /.vim/autoload/bash-support/codesnippets/debugging/_debug_PS4: -------------------------------------------------------------------------------- 1 | # PS4 : timestamp; the current time in 24-hour HH:MM:SS format 2 | PS4='+[\t] ' 3 | 4 | # PS4 : timestamp; 'seconds.nanoseconds' since 1970-01-01 00:00:00 UT 5 | PS4='+[$(date "+%s.%N")] ' 6 | 7 | # PS4 : position, line number, function name 8 | # The following line avoids error messages due to an unset FUNCNAME[0] : 9 | # set +o nounset # Treat unset variables as an error 10 | # 11 | PS4='+|${BASH_SOURCE##*/} ${LINENO}${FUNCNAME[0]:+ ${FUNCNAME[0]}}| ' 12 | 13 | # PS4 : position, line number, function name, subshell information 14 | # The following line avoids error messages due to an unset FUNCNAME[0] : 15 | # set +o nounset # Treat unset variables as an error 16 | # 17 | PS4='+(${BASH_SOURCE##*/}: ${LINENO}) : ${FUNCNAME[0]} - [level ${SHLVL}, ' 18 | PS4=$PS4'subshell ${BASH_SUBSHELL}, return code $?]\n ' 19 | 20 | # PS4 : default prompt 21 | PS4='+ ' 22 | 23 | -------------------------------------------------------------------------------- /vimwiki/AWS_Tutorial.wiki: -------------------------------------------------------------------------------- 1 | 2 | 01 - Understanding AWS Certification and How to Get the Most from this Series.mp4 3 | 02 - AWS Design - Why use AWS and Global Best Practices.mp4 4 | 03 - AWS Elasticity - Principles of Elasticity.mp4 5 | 04 - AWS Elasticity - Understanding and Using Bootstrapping.mp4 6 | 05 - AWS Elasticity - Understanding and Implementing CloudFormation.mp4 7 | 06 - AWS Elasticity - Components of Auto Scaling.mp4 8 | 07 - AWS Storage - Elastic Block Store (EBS).mp4 9 | 08 - AWS Storage - S3 and CloudFront.mp4 10 | 09 - AWS Security - Understanding Shared Security.mp4 11 | 10 - AWS Security - Using the Virtual Private Cloud (VPC).mp4 12 | 11 - AWS Security - Working with IAM.mp4 13 | 12 - AWS Security - IAM Best Practices.mp4 14 | 13 - AWS Database - Database Tips.mp4 15 | 14 - AWS Cost - Optimizing AWS Expenses.mp4 16 | 15 - AWS Availability - Designing High Availability in AWS.mp4 17 | 16 - AWS Migration - Creating a Cloud Migration Strategy.mp4 18 | -------------------------------------------------------------------------------- /.vifm/scripts/imgt: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Based on script by z3bra -- 2014-01-21 4 | 5 | W3MIMGDISPLAY="/usr/bin/w3mimgdisplay" 6 | FONTH=15 # Size of one terminal row 7 | FONTW=7 # Size of one terminal column 8 | 9 | X=$1 10 | Y=$2 11 | COLUMNS=$3 12 | LINES=$4 13 | FILENAME=$5 14 | 15 | read width height <<< `echo "5;$FILENAME" | $W3MIMGDISPLAY` 16 | if [ -z "$width" -o -z "$height" ]; then 17 | echo 'Error: Failed to obtain image size.' 18 | exit 1 19 | fi 20 | 21 | x=$((FONTW * X)) 22 | y=$((FONTH * Y)) 23 | 24 | max_width=$((FONTW * COLUMNS)) 25 | max_height=$((FONTH * LINES)) 26 | 27 | if [ "$width" -gt "$max_width" ]; then 28 | height=$((height * max_width / width)) 29 | width=$max_width 30 | fi 31 | if [ "$height" -gt "$max_height" ]; then 32 | width=$((width * max_height / height)) 33 | height=$max_height 34 | fi 35 | 36 | w3m_command="0;1;$x;$y;$width;$height;;;;;$FILENAME\n4;\n3;" 37 | 38 | echo -e "$w3m_command" | $W3MIMGDISPLAY 39 | 40 | -------------------------------------------------------------------------------- /ff_database_optimize.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | profile_dir="$HOME/.mozilla/firefox/*" 3 | 4 | echo " Killing all running firefox instances for database clean up..." 5 | 6 | pkill firefox 7 | 8 | echo " ... Done" 9 | 10 | echo " getting into the profile dir ..." 11 | 12 | #cd $profile_dir 13 | 14 | #pwd 15 | for i in $profile_dir 16 | do 17 | echo " present size of the database is : " 18 | 19 | du -shc $profile_dir/*.sqlite 20 | 21 | echo " Now running the cleanup...." 22 | 23 | #find $HOME/.mozilla/ \( -name "*.sqlite" \) -exec sqlite3 {} "vacuum" \; 24 | 25 | /usr/bin/sqlite3 $i VACUUM 26 | 27 | echo " Now the size of the present database is :" 28 | 29 | du -shc $profile_dir/*.sqlite 30 | 31 | echo " Kindly start firefox now .....performance will be much improved" 32 | 33 | echo " Limiting firefox cpu usage by 50 percent .." 34 | 35 | # Install cpulimit in the system from here http://cpulimit.sourceforge.net/ 36 | 37 | /usr/bin/cpulimit -l 200 firefox 38 | 39 | done 40 | -------------------------------------------------------------------------------- /firefox_in_ram: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Change this to match your correct profile 4 | PROFILE="18q9dvrr.default-release" 5 | 6 | cd "${HOME}/.mozilla/firefox" || exit 1 7 | 8 | # if test -z "$(/bin/mount | grep -F "${HOME}/.mozilla/firefox/${PROFILE}" )" 9 | # then 10 | # # sh -c "sudo /bin/mount "${HOME}/.mozilla/firefox/${PROFILE}" tmpfs size=2G,user,exec,uid=1000,gid=1000" 11 | # sh -c "sudo /bin/mount -a" 12 | # fi 13 | 14 | if test -f "${PROFILE}/.unpacked" 15 | then 16 | rsync -av --delete --exclude .unpacked ./"$PROFILE"/ ./profile/ 17 | else 18 | notify-send "Firefox Profile started syncing to RAM ...wait.." 19 | rsync -av ./profile/ ./"$PROFILE"/ 20 | touch "${PROFILE}/.unpacked" 21 | fi 22 | 23 | if test "$(pgrep rsync)" == "" ; then 24 | 25 | notify-send "Sync Done! Clearing the startup cache..." 26 | 27 | find ~/.cache/mozilla/firefox/18q9dvrr.default-release/ -type d -name startupCache | xargs rm -rf 28 | fi 29 | 30 | exit -------------------------------------------------------------------------------- /decoding_url.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | use URI::Escape; 3 | use strict; 4 | 5 | # Declare some variables 6 | # 7 | my($space)="%20"; 8 | my($str,$result); 9 | # The cycle that reads 10 | # the standard input 11 | while(«»){ 12 | 13 | # The URL is split, so that you have the 14 | # actual PATH and the query string in two 15 | # different variables. If you have 16 | # http://www.site.com/cgi-bin/go.pl?query=this, 17 | # $path = "http://www.site.com/cgi-bin/go.pl" 18 | # $qstring = "query=this" 19 | my ($path, $qstring) = split(/\?/, $_, 2); 20 | 21 | # If there is no query string, the result string 22 | # will be the path... 23 | $result = $path; 24 | 25 | # ...BUT! If the query string is not empty, it needs 26 | # some processing so that the "+" becomes "%20"! 27 | if($qstring ne ""){ 28 | $qstring =~ s/\+/$space/ego; 29 | $result .= "?$qstring"; 30 | } 31 | 32 | # The string is finally unescaped... 33 | $str = uri_unescape($result); 34 | 35 | # ...and printed! 36 | print($str); 37 | } -------------------------------------------------------------------------------- /.vim/bash-support/templates/specialparams.templates: -------------------------------------------------------------------------------- 1 | § ============================================================= 2 | § Special Parameters 3 | § ============================================================= 4 | 5 | == LIST: SpecialParameters == hash == 6 | 'number of posit. param., ${#}' : '${#}', 7 | 'all posit. param. (quoted spaces), ${*}' : '${*}', 8 | 'all posit. param. (unquoted spaces), ${@}' : '${@}', 9 | 'number of posit. parameters, ${#@}' : '${#@}', 10 | 'return code of last command, ${?}' : '${?}', 11 | 'PID of this shell, ${$}' : '${$}', 12 | 'flags set, ${-}' : '${-}', 13 | 'last argument of prev. command, ${_}' : '${_}', 14 | 'PID of last background command, ${!}' : '${!}', 15 | == ENDLIST == 16 | 17 | == SpecParams == expandmenu, insert, sc:p, map:bsp == 18 | |PickList( 'Special Parameters', 'SpecialParameters' )| 19 | |PICK| 20 | == ENDTEMPLATE == 21 | 22 | -------------------------------------------------------------------------------- /.vim/autoload/bash-support/templates/specialparams.templates: -------------------------------------------------------------------------------- 1 | § ============================================================= 2 | § Special Parameters 3 | § ============================================================= 4 | 5 | == LIST: SpecialParameters == hash == 6 | 'number of posit. param., ${#}' : '${#}', 7 | 'all posit. param. (quoted spaces), ${*}' : '${*}', 8 | 'all posit. param. (unquoted spaces), ${@}' : '${@}', 9 | 'number of posit. parameters, ${#@}' : '${#@}', 10 | 'return code of last command, ${?}' : '${?}', 11 | 'PID of this shell, ${$}' : '${$}', 12 | 'flags set, ${-}' : '${-}', 13 | 'last argument of prev. command, ${_}' : '${_}', 14 | 'PID of last background command, ${!}' : '${!}', 15 | == ENDLIST == 16 | 17 | == SpecParams == expandmenu, insert, sc:p, map:bsp == 18 | |PickList( 'Special Parameters', 'SpecialParameters' )| 19 | |PICK| 20 | == ENDTEMPLATE == 21 | 22 | -------------------------------------------------------------------------------- /.vim/bash-support/codesnippets/create-tempfile-in-secure-manner: -------------------------------------------------------------------------------- 1 | 2 | TMPDIR=${TMPDIR:-/tmp} # defaults to /tmp if unset 3 | 4 | #------------------------------------------------------------------------------- 5 | # Creates a particular temporary directory inside $TMPDIR. 6 | #------------------------------------------------------------------------------- 7 | TEMPORARY_DIR=$(mktemp -d "$TMPDIR/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") || \ 8 | { echo "ERROR creating a temporary file"; exit 1; } 9 | 10 | #------------------------------------------------------------------------------- 11 | # When the program exits, it tries to remove the temporary folder. 12 | # This code is executed even if the process receives a signal 1,2,3 or 15. 13 | #------------------------------------------------------------------------------- 14 | trap '[ "$TEMPORARY_DIR" ] && rm --recursive --force "$TEMPORARY_DIR"' 0 15 | 16 | touch $TEMPORARY_DIR/tempfile # new tempfile inside folder 17 | 18 | -------------------------------------------------------------------------------- /Gentoo_Linux_Update: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #Syncing with remote repo 4 | eix-sync 5 | 6 | #Update the local repo 7 | eix-update 8 | 9 | #Actually update the system with fetched in packges 10 | emerge --verbose --update --deep --newuse --with-bdeps=y --keep-going @world 11 | 12 | if [[ $? -eq 0 ]];then 13 | notify-send "System has Updated successfully!" 14 | else 15 | notify-send "Nope, Update is having trouble, please fix" 16 | exit 1 17 | fi 18 | #Showing what are the packages merge in local system today 19 | genlop --list --date today 20 | 21 | #Clean the stale log of previous merge 22 | find /var/log/portage -maxdepth 1 -type f -ls -delete 23 | 24 | #Clean the distribution directory to gain disk space 25 | eclean-dist --deep 26 | 27 | # It is a custom to rip away the stale stuff from the system after world merge. 28 | emerge --ask --depclean 29 | 30 | #Check for security vulnerability by scanning local installed packages. 31 | glsa-check -f --verbose all && glsa-check -l --verbose all 32 | 33 | 34 | -------------------------------------------------------------------------------- /Slackware_Update_Script: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | source /home/bhaskar/colors.sh 3 | NOCOLOR="\033[0m" 4 | TM="/usr/bin/time -f" 5 | printf "${Bright}${Yellow}${Reverse}Updating and Upgrading the system,please wait${NOCOLOR} ....\n\n\n" 6 | 7 | printf "Hostname: %s\nDate : %s\nUptime :%s\n\n" "$(hostname -s)" "$(date)" "$(uptime)" 8 | 9 | printf "\n\n\n ${Bright}${Yellow}Checking the system capacity${NOCOLOR} ...\n\n" 10 | 11 | 12 | maxpoint="90" 13 | per=`df / | awk 'END{print $5}' | tr -d %` 14 | if [ "$per" -le "$maxpoint" ]; then 15 | 16 | printf "${Bright}${Green}Ok...looks good...procced${NOCOLOR}\n\n\n" 17 | 18 | elif [ "$per" -gt "$maxpoint" ]; then 19 | 20 | printf "${Bright}${Red}Not enough space...aborting!${NOCOLOR}" 21 | exit 1 22 | fi 23 | 24 | 25 | $TM "\t\n\n Elapsed time: %E \n\n" slackpkg update && slackpkg upgrade-all 26 | 27 | if [[ $? -eq 0 ]];then 28 | notify-send "Update and Upgrade process done!" 29 | else 30 | notify-send "Update process failed..pls check manually" 31 | fi 32 | -------------------------------------------------------------------------------- /.vim/autoload/bash-support/codesnippets/create-tempfile-in-secure-manner: -------------------------------------------------------------------------------- 1 | 2 | TMPDIR=${TMPDIR:-/tmp} # defaults to /tmp if unset 3 | 4 | #------------------------------------------------------------------------------- 5 | # Creates a particular temporary directory inside $TMPDIR. 6 | #------------------------------------------------------------------------------- 7 | TEMPORARY_DIR=$(mktemp -d "$TMPDIR/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") || \ 8 | { echo "ERROR creating a temporary file"; exit 1; } 9 | 10 | #------------------------------------------------------------------------------- 11 | # When the program exits, it tries to remove the temporary folder. 12 | # This code is executed even if the process receives a signal 1,2,3 or 15. 13 | #------------------------------------------------------------------------------- 14 | trap '[ "$TEMPORARY_DIR" ] && rm --recursive --force "$TEMPORARY_DIR"' 0 15 | 16 | touch $TEMPORARY_DIR/tempfile # new tempfile inside folder 17 | 18 | -------------------------------------------------------------------------------- /file_tar_menu.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import tarfile, sys 3 | 4 | try: 5 | #open tarfile 6 | tar = tarfile.open(sys.argv[1], "r:tar") 7 | 8 | #present menu and get selection 9 | selection = raw_input("Enter\n\ 10 | 1 to extract a file\n\ 11 | 2 to display information on a file in the archive\n\ 12 | 3 to list all the files in the archive\n\n") 13 | 14 | #perform actions based on selection above 15 | if selection == "1": 16 | filename = raw_input("enter the filename to extract: ") 17 | tar.extract(filename) 18 | elif selection == "2": 19 | filename = raw_input("enter the filename to inspect: ") 20 | for tarinfo in tar: 21 | if tarinfo.name == filename: 22 | print "\n\ 23 | Filename:\t\t", tarinfo.name, "\n\ 24 | Size:\t\t", tarinfo.size, bytes 25 | elif selection == "3": 26 | print tar.list(verbose=True) 27 | except: 28 | print "There was a problem running the program" 29 | -------------------------------------------------------------------------------- /vimwiki/Pictures.wiki: -------------------------------------------------------------------------------- 1 | 2 | 2016 3 | 2017 4 | Adhar.png 5 | B'day_treat 6 | Benzz_Park_Treat(2 Arvind's B'day) 7 | Camera 8 | Darjeeling 9 | desk.png 10 | digikam4.db 11 | DSCN0377.JPG 12 | Europe_Tour 13 | Europe_Tour4 14 | Europe_Tour.zip 15 | Euro_Tour2 16 | Euro_Tour3 17 | family_pics 18 | Gwahati-Shillong 19 | i3lock.png 20 | kernel.compile.png 21 | Kodaikanal 22 | LKM3_1024.png 23 | Mahabalipuram 24 | misc_pic 25 | Neel_Poita 26 | Neels_11th_Bday 27 | neomutt.png 28 | Pondicherry_Tour_Dec12 29 | puri 30 | recognition.db 31 | Screenshot_2019-06-04_14-46-27.png 32 | Screenshot_2019-06-12_07-40-51.png 33 | Screenshot from 2018-11-14 19-55-30.png 34 | Screenshot from 2018-11-29 16-24-41.png 35 | Screenshot from 2018-12-19 07-32-13.png 36 | Screenshot from 2019-01-04 17-30-28.png 37 | Screenshot from 2019-02-13 14-21-30.png 38 | Screenshots 39 | SG-KL 40 | SG_KL2 41 | SG-KL3 42 | Shillong_Tour 43 | Thailand 44 | thumbnails-digikam.db 45 | Webcam 46 | WhatsApp-Image-20160515.jpe 47 | WhatsApp-Image-20160515.jpg 48 | wikipedia.png 49 | -------------------------------------------------------------------------------- /encrypt_log.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | 3 | # Libraries... 4 | # 5 | use strict; # Be strict with coding 6 | use DBI(); # Use DBI drivers 7 | use Crypt::CBC; # Use encryption 8 | 9 | # Variables... 10 | # 11 | my($str); # Variable declaration 12 | my($cipher); # Another variable declaration 13 | 14 | # Create the cipher object 15 | # 16 | $cipher = Crypt::CBC-»new( {'key' =» 'my secret key', 17 | 'cipher' =» 'Blowfish', 18 | 'iv' =» 'DU#E*UF', 19 | 'regenerate_key' =» 0, 20 | 'padding' =» 'space', 21 | 'prepend_iv' =» 0 22 | }); 23 | 24 | # Connect to the database 25 | # 26 | my $dbh = DBI-»connect("DBI:mysql:database=apache;host=localhost", 27 | "root", ""); 28 | 29 | # Each log line is fetched and stored into $_... 30 | # 31 | while(«STDIN»){ 32 | $str= $cipher-»encrypt($_); # The read line is encrypted... 33 | 34 | # ...and stored onto the database 35 | $dbh-»do("INSERT INTO access_log VALUES ('0',".$dbh-»quote("$str").")"); 36 | } 37 | 38 | $dbh-»disconnect(); # Disconnect from the database 39 | 40 | exit(0); # End of the program -------------------------------------------------------------------------------- /memory_leak_dectection.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # track memory usage of sshd using pidstat and send report 3 | # http://www.linuxsysadminblog.com - MaxV 4 | 5 | export PID=/var/run/sshduse.pid 6 | export TIMESTAMP=`date +%Y%m%d_%H%M%S` 7 | export LOGDIR=/var/log/ 8 | export SSHD_LOG="${LOGDIR}sshd_memUsage_${TIMESTAMP}" 9 | export SSHD_PID=`cat /var/run/sshd.pid` 10 | export MAILTO=user@domain.com 11 | 12 | if [ ! -e ${PID} ]; then 13 | 14 | #create pid file 15 | echo $$ > ${PID} 16 | 17 | #log begin of script to /var/log/messages 18 | /usr/bin/logger "Starting SSHD Memory Usage Tracker" 19 | 20 | # pidstat portion, poll 12 times with 5 minutes apart 21 | /usr/bin/pidstat -r -p ${SSHD_PID} 300 12 >> ${SSHD_LOG} 22 | 23 | #e-mail report 24 | mail -s "SSHD memory usage ${TIMESTAMP}" ${MAILTO} < ${SSHD_LOG} 25 | 26 | #clean up pid file 27 | if [ -f ${PID} ]; then 28 | rm -rf ${PID} 29 | 30 | #log end of script to /var/log/messages 31 | /usr/bin/logger "Ending SSHD Memory Usage Tracker" 32 | fi 33 | exit 0 34 | else 35 | 36 | exit 0 37 | fi 38 | -------------------------------------------------------------------------------- /atop_log_clear.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | #=============================================================================== 3 | # 4 | # FILE: atop_log_clear.sh 5 | 6 | # USAGE: ./atop_log_clear.sh 7 | # 8 | # DESCRIPTION:Stop filling the disk by empty the file 9 | # 10 | # OPTIONS: --- 11 | # REQUIREMENTS: --- 12 | # BUGS: --- 13 | # NOTES: --- system maintenance 14 | # AUTHOR: Bhaskar Chowdhury (https://about.me/unixbhaskar), unixbhaskar@gmail.com 15 | # ORGANIZATION: Independent 16 | # CREATED: 05/14/2019 12:08 17 | # REVISION: --- 18 | #=============================================================================== 19 | 20 | set -o nounset # Treat unset variables as an error 21 | DIR=/var/cache/atop.d/ 22 | size=$(du -shc /var/cache/atop.d | gawk '{ print $1 }' | tr -d "M|G") 23 | 24 | if [[ "$size" != "100" ]]; then 25 | #echo "It's filing up the disk,so emptying out.." 26 | cd $DIR 27 | 28 | >atop.acct 29 | 30 | fi 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /i3-scripts/rss.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # WARNING: This has a LIMIT of 32 characters for now! 4 | # If your URL is longer you should use an URL shortener 5 | # Caused by https://github.com/vivien/i3blocks/blob/01a4f4a9ca1e3d0b3c95d1d62000ad8506bdff1a/include/block.h#L50 6 | # Example: https://goo.gl/ 7 | 8 | FEED_URL="${BLOCK_INSTANCE:-}" 9 | 10 | if [[ "${FEED_URL}" = "" ]]; then 11 | exit 12 | fi 13 | 14 | 15 | FEED_CONTENT=$(curl ${FEED_URL} -s -L ) 16 | FEED_TITLE=$(echo "${FEED_CONTENT}" | grep -v "xmlns:atom" | grep -o '.*' | head -n 1) | sed 17 | -i's/\(\|<\/title>\)//g' 18 | FEED_LINK=$(echo "${FEED_CONTENT}" | grep -v "xmlns:atom" | grep -o '<link>.*</link>' | head -n 1) | sed -i 19 | 's/\(<link>\|<\/link>\)//g' 20 | 21 | if [[ "${FEED_TITLE}" = *404* ]]; then 22 | echo "${FEED_URL}" 23 | echo "${FEED_URL}" 24 | echo "" 25 | exit 33 26 | fi 27 | 28 | if [[ "${BLOCK_BUTTON}" -eq 1 ]]; then 29 | xdg-open "${FEED_LINK}" 30 | fi 31 | 32 | echo "${FEED_TITLE}" 33 | echo "${FEED_TITLE}" 34 | echo "" 35 | -------------------------------------------------------------------------------- /wireless_info.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | wireless_dev=`ip a | grep w | gawk -F: ' { print $2 } '` 4 | 5 | echo " The wireless device information of this system `hostname`..." 6 | echo 7 | echo 8 | 9 | 10 | echo 11 | echo " Let;s find out about wireless card and driver of this system ..." 12 | echo 13 | 14 | lshw -C network | grep -B 1 -A 12 'Wireless interface' 15 | 16 | echo 17 | echo 18 | 19 | echo " Checking the quality of signal of the wireless device ....." 20 | echo 21 | 22 | iwconfig $wireless_dev | grep -i --color quality 23 | 24 | echo 25 | echo 26 | sleep 5 27 | 28 | echo " Show the wireless device properly of this system ...." 29 | echo 30 | echo 31 | 32 | nmcli -f GENERAL,WIFI-PROPERTIES dev show $wireless_dev 33 | 34 | echo 35 | echo 36 | echo 37 | 38 | sleep 5 39 | 40 | echo "Show me the wireless network avaialble around ...." 41 | echo 42 | echo 43 | 44 | nmcli dev wifi 45 | 46 | echo 47 | echo 48 | echo 49 | 50 | echo "Need to know the device info...." 51 | echo 52 | 53 | iw $wireless_dev info 54 | 55 | 56 | exit 0 57 | -------------------------------------------------------------------------------- /vimwiki/debian_package_inspection_method.wiki: -------------------------------------------------------------------------------- 1 | 2 | A Debian package is basically an ar archive containing two compressed tarfiles, control.tar.gz and data.tar.gz (possibly using 3 | a different compression method and corresponding extension). The second contains the complete filesystem tree of the package 4 | and the first the packaging meta-files. That's mostly a header with a general package description (called control) and the 5 | so-called package maintainer scripts which will be run at various phases of the install with certain arguments (as documented 6 | in the Debian Policy Manual). 7 | 8 | Besides the option of disassembling the archive manually, the dpkg-deb command can be used to access the contents. Assuming a 9 | package file named uselessd_1.52.11_amd64.deb, the command 10 | 11 | dpkg-deb --fsys-tarfile uselessd_1.52.11_amd64.deb | tar tvf - 12 | 13 | would enable examining the contents of the data archive and 14 | 15 | dpkg-deb -I uselessd_1.52.11_amd64.deb postinst 16 | 17 | would extract the postinstall configuration script to stdout. 18 | -------------------------------------------------------------------------------- /i3-scripts/update.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash - 2 | #=============================================================================== 3 | # 4 | # FILE: update.sh 5 | # 6 | # USAGE: ./update.sh 7 | # 8 | # DESCRIPTION: 9 | # 10 | # OPTIONS: --- 11 | # REQUIREMENTS: --- 12 | # BUGS: --- 13 | # NOTES: --- 14 | # AUTHOR: Bhaskar Chowdhury (https://about.me/unixbhaskar), unixbhaskar@gmail.com 15 | # ORGANIZATION: Independent 16 | # CREATED: 08/28/2019 12:23 17 | # REVISION: --- 18 | #=============================================================================== 19 | 20 | set -o nounset # Treat unset variables as an error 21 | # count how many updates we have got 22 | debups=$(/usr/lib/update-notifier/apt-check --human-readable | head -1 | awk '{print $1;}') 23 | 24 | # print the results 25 | if [[ "$debups" -eq "1" ]] 26 | then 27 | echo "There is 1 update" 28 | elif [[ "$debups" -gt "1" ]] 29 | then 30 | echo "There are $ups updates" 31 | else 32 | echo "Up to date" 33 | fi 34 | 35 | -------------------------------------------------------------------------------- /decrypt_log.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | 3 | # Libraries... 4 | # 5 | use strict; # Be strict with coding 6 | use DBI(); # Use DBI drivers 7 | use Crypt::CBC; # Use encryption 8 | 9 | # Variables... 10 | # 11 | my($str); # Variable declaration 12 | my($cipher); # Another variable declaration 13 | 14 | # Create the cipher object 15 | # 16 | $cipher = Crypt::CBC-»new( {'key' =» 'my secret key', 17 | 'cipher' =» 'Blowfish', 18 | 'iv' =» 'DU#E*UF', 19 | 'regenerate_key' =» 0, 20 | 'padding' =» 'space', 21 | 'prepend_iv' =» 0 22 | }); 23 | 24 | # Connect to the database 25 | # 26 | my $dbh = DBI-»connect("DBI:mysql:database=apache;host=localhost", 27 | "root", ""); 28 | 29 | # Prepare the SQL query 30 | # 31 | my $sth = $dbh-»prepare("SELECT * FROM access_log"); 32 | $sth-»execute(); 33 | 34 | # Main cycle to read the information 35 | # 36 | while (my $ref = $sth-»fetchrow_hashref()) { 37 | $str= $cipher-»decrypt($ref-»{'log_line'}); 38 | print($str); 39 | } 40 | $sth-»finish(); # End of row-fetching 41 | $dbh-»disconnect(); # Disconnect from the database 42 | 43 | exit(0); # End of the program -------------------------------------------------------------------------------- /netconnect: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [[ "$UID" = "0" ]] 4 | 5 | then 6 | 7 | echo " You have the super power to invoke this sript" 8 | else 9 | echo "Sorry, you don't have the power to run this script" 10 | fi 11 | 12 | 13 | 14 | echo 15 | echo 16 | echo " Let's check whether the usb modem is connected to system or not" 17 | echo 18 | echo 19 | 20 | /usr/bin/lsusb | gawk -F: ' { print $2"===>"$3 }' 21 | 22 | echo 23 | echo 24 | 25 | echo "probing the usb modem...loading driver too....." 26 | 27 | /sbin/modprobe usbserial idVendor=12d1, idProduct=1506 28 | 29 | echo 30 | echo 31 | 32 | echo "Connecting to ISP...." 33 | echo 34 | echo 35 | 36 | /usr/bin/wvdial Defaults >/var/log/wvdial& 37 | 38 | echo 39 | echo 40 | 41 | sleep 5 42 | 43 | echo "PID of of the WvDial..." 44 | 45 | ps -ef | grep wvdial 46 | 47 | echo 48 | echo 49 | 50 | sleep 3 51 | echo 52 | echo 53 | echo "Checking the connection...." 54 | 55 | /bin/ping -c 3 google.com 56 | 57 | echo 58 | echo 59 | 60 | echo " Looking for live stat....." 61 | echo 62 | echo 63 | 64 | /usr/bin/vnstat -i ppp0 -l 65 | -------------------------------------------------------------------------------- /i3-scripts/calendar.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | WIDTH=${WIDTH:-200} 4 | HEIGHT=${HEIGHT:-200} 5 | DATEFMT=${DATEFMT:-"+%a %d.%m.%Y %H:%M:%S"} 6 | SHORTFMT=${SHORTFMT:-"+%H:%M:%S"} 7 | 8 | OPTIND=1 9 | while getopts ":f:W:H:" opt; do 10 | case $opt in 11 | f) DATEFMT="$OPTARG" ;; 12 | W) WIDTH="$OPTARG" ;; 13 | H) HEIGHT="$OPTARG" ;; 14 | \?) 15 | echo "Invalid option: -$OPTARG" >&2 16 | exit 1 17 | ;; 18 | :) 19 | echo "Option -$OPTARG requires an argument." >&2 20 | exit 1 21 | ;; 22 | esac 23 | done 24 | 25 | case "$BLOCK_BUTTON" in 26 | 1|2|3) 27 | 28 | # the position of the upper left corner of the popup 29 | posX=$(($BLOCK_X - $WIDTH / 2)) 30 | posY=$(($BLOCK_Y - $HEIGHT)) 31 | 32 | i3-msg -q "exec yad --calendar \ 33 | --width=$WIDTH --height=$HEIGHT \ 34 | --undecorated --fixed \ 35 | --close-on-unfocus --no-buttons \ 36 | --posx=$posX --posy=$posY \ 37 | > /dev/null" 38 | esac 39 | echo "$LABEL$(date "$DATEFMT")" 40 | echo "$LABEL$(date "$SHORTFMT")" -------------------------------------------------------------------------------- /system_service_status.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -xv 2 | 3 | select options in "apache2" "named" "postfix" "vnstatd" "syslog-ng" "sysstat" "nagios" "sshd" "mysql" "clamd" "puppet" "ntpd" "puppetmaster" 4 | 5 | do 6 | 7 | echo "***********************" 8 | 9 | case $options in 10 | 11 | apache2 | httpd) /etc/init.d/apache2 status ;; 12 | 13 | named) /etc/init.d/named status;; 14 | 15 | postfix)/etc/init.d/postfix status;; 16 | 17 | sysstat)/etc/init.d/sysstat status;; 18 | 19 | syslog-ng)/etc/init.d/syslog-ng status;; 20 | 21 | vnstatd)/etc/init.d/vnstatd status;; 22 | 23 | nagios)/etc/init.d/nagios status;; 24 | 25 | sshd)/etc/init.d/sshd status;; 26 | 27 | mysql)/etc/init.d/mysql status;; 28 | 29 | clamd)/etc/init.d/clamd status;; 30 | 31 | puppet)/etc/init.d/puppet status;; 32 | 33 | puppetmaster)/etc/init.d/puppetmaster status;; 34 | 35 | ntpd)/etc/init.d/ntpd status;; 36 | 37 | *) echo "Nothing will be restarted" 38 | 39 | esac 40 | 41 | echo "***********************" 42 | 43 | break 44 | 45 | # If this break is not there then we wont get a shell prompt 46 | 47 | done 48 | -------------------------------------------------------------------------------- /vimwiki/wpa_cli_procedure.wiki: -------------------------------------------------------------------------------- 1 | 2 | user $wpa_cli 3 | 4 | wpa_cli v2.5 5 | Copyright (c) 2004-2015, Jouni Malinen <j@w1.fi> and contributors 6 | 7 | This software may be distributed under the terms of the BSD license. 8 | See README for more details. 9 | 10 | 11 | Selected interface 'wlan0' 12 | 13 | Interactive mode 14 | 15 | > scan 16 | OK 17 | > scan_results 18 | bssid / frequency / signal level / flags / ssid 19 | 01:23:45:67:89:ab 2437 0 [WPA-PSK-CCMP+TKIP][WPA2-PSK-CCMP+TKIP][ESS] hotel-free-wifi 20 | > add_network 21 | 0 22 | > set_network 0 ssid "hotel-free-wifi" 23 | OK 24 | > set_network 0 psk "password" 25 | OK 26 | > enable_network 0 27 | OK 28 | <3>CTRL-EVENT-SCAN-RESULTS 29 | <3>WPS-AP-AVAILABLE 30 | <3>Trying to associate with 01:23:45:67:89:ab (SSID='hotel-free-wifi' freq=2437 MHz) 31 | <3>Associated with 01:23:45:67:89:ab 32 | <3>WPA: Key negotiation completed with 01:23:45:67:89:ab [PTK=CCMP GTK=TKIP] 33 | <3>CTRL-EVENT-CONNECTED - Connection to 01:23:45:67:89:ab completed [id=0 id_str=] 34 | > save_config 35 | OK 36 | > quit 37 | 38 | -------------------------------------------------------------------------------- /pull_down_dotfiles.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash - 2 | #=============================================================================== 3 | # 4 | # FILE: pull_down_dotfiles.sh 5 | # 6 | # USAGE: ./pull_down_dotfiles.sh 7 | # 8 | # DESCRIPTION: Get my settings from GITHUB on a fresh installed Linux. 9 | # 10 | # OPTIONS: --- 11 | # REQUIREMENTS: git,working internet 12 | # BUGS: --- 13 | # NOTES: Should be run on HOME directory 14 | # AUTHOR: Bhaskar Chowdhury (https://about.me/unixbhaskar), unixbhaskar@gmail.com 15 | # ORGANIZATION: Independent 16 | # CREATED: 07/16/2022 18:15 17 | # REVISION: --- 18 | #=============================================================================== 19 | 20 | set -o nounset # Treat unset variables as an error 21 | 22 | 23 | pull_down_my_settings_from_github() { 24 | 25 | echo Getting the dotfiles from GitHub 26 | 27 | git clone --recurse-submodules --remote-submodules git@github.com:unixbhaskar/dotfiles.git 28 | cp -v dotfiles/* $HOME 29 | } 30 | pull_down_my_settings_from_github 31 | -------------------------------------------------------------------------------- /vimwiki/Videos.wiki: -------------------------------------------------------------------------------- 1 | 2 | 1. Bhor bhayi - Shweta Mohan f. Bennet & the band - Music Mojo - Kappa TV-qI8m0KwBATM.mp4 3 | 2. Bob_Dylan 4 | 3. Colours of Dusk - Shweta Mohan & Aalaap Raju (Cover of AR.Rahman's Manmohana)-iP-daFn9yAU.mp4 5 | 4. Ekdantaya Vakratundaya Gauri Tanaya by Shankar Mahadevan in Mumbai Youth Concert.mp4 6 | 5. EKTARATE BNEDHE DILE DOTARARI SUR Ramkumar Chattopadhyay Katha O Sur Ajana-DMFB6smVx84.mp4 7 | Europe_Tour 8 | Great Tap Number 1954 (Vera-Ellen & John Brascia)-T0ZWp0mi0dI.mp4 9 | Guwahati_Shillong_videos 10 | Linux_videos 11 | Mark_Knopfler 12 | Mon Mor Meghero Sanghi-OIag7YvN7KY.mp4 13 | Old Bengali Songs _ Best of Ramkumar Chatterjee _ Bengali Tappa.mp4 14 | Pink Floyd - Shine On You Crazy Diamond I - V (1975 Original Pressing) - Black Vinyl LP-7H9rCRuZ3K4.mp4 15 | Sakhi.mp3 16 | Sakhi re kaahe unplugged live thumri-yW38f8Vw_pA.mp4 17 | Sakhi Re Kahe - Hariharan (MTV Unplugged Season 5) Full HD(videoming).mp4 18 | Santana's 'Besos de Lejos” featuring Gloria Estefan-WzYuER32g8Q.mp4 19 | seineriver.mp4 20 | SG_KAL_Tour 21 | Sundori go dohai dohai in my own style-euwbvok0cP0.mp4 22 | Thailand_Tour 23 | -------------------------------------------------------------------------------- /kernel_remove_on_deb_system.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #This script can be improved leaps and bound,I did it for my convenience, a dirty way 4 | #Because I am aware of few things so I hardcoded it (bad thing),should be autometically discovered those 5 | 6 | printf " Finding out how many kernels installed in the system ...\n\n\n" 7 | 8 | 9 | num=`dpkg --list | grep linux-image | grep ii | wc -l` 10 | 11 | if [[ $num > 2 ]]; then 12 | 13 | printf "Time to strip off those older kernels \n\n\n" 14 | 15 | else 16 | printf " Looks alright to me :) \n\n\n" 17 | 18 | fi 19 | 20 | printf "Lets remove the stale kernels..... \n\n\n" 21 | 22 | # Damn, the number greping should be done in much better way , and the reverse one too...heck..in a hurry do all sort of nonsense.. 23 | echo -n "Protect the patch version: " 24 | read patch_version 25 | dpkg --get-selections | grep linux-image | grep 4.15 | sed s/install//g | uniq -u | grep -v $patch_version | tee kernel_holds 26 | 27 | for kernels in `cat kernel_holds` 28 | do 29 | echo $kenrels 30 | 31 | apt-get --purge remove $kernels -y 32 | done 33 | 34 | exit 0 35 | 36 | 37 | -------------------------------------------------------------------------------- /.vifm/colors/dmilith-root.vifm: -------------------------------------------------------------------------------- 1 | " vim: filetype=vifm : 2 | 3 | " Author: Daniel Dettlaff (a.k.a. dmilith) 4 | 5 | highlight Win cterm=none ctermfg=white ctermbg=black 6 | highlight Directory cterm=bold ctermfg=cyan ctermbg=black 7 | highlight Link cterm=bold ctermfg=yellow ctermbg=black 8 | highlight BrokenLink cterm=bold ctermfg=red ctermbg=none 9 | highlight Socket cterm=bold ctermfg=magenta ctermbg=black 10 | highlight Device cterm=bold ctermfg=red ctermbg=black 11 | highlight Fifo cterm=bold ctermfg=cyan ctermbg=none 12 | highlight Executable cterm=bold ctermfg=green ctermbg=black 13 | highlight Selected cterm=bold ctermfg=magenta ctermbg=black 14 | highlight CurrLine cterm=bold ctermfg=white ctermbg=30 15 | highlight TopLine cterm=bold ctermfg=white ctermbg=red 16 | highlight TopLineSel cterm=bold ctermfg=yellow ctermbg=red 17 | highlight StatusLine cterm=bold ctermfg=white ctermbg=red 18 | highlight WildMenu cterm=underline,reverse ctermfg=white ctermbg=black 19 | highlight CmdLine cterm=none ctermfg=white ctermbg=black 20 | highlight ErrorMsg cterm=none ctermfg=red ctermbg=black 21 | highlight Border cterm=none ctermfg=black ctermbg=red 22 | -------------------------------------------------------------------------------- /busybox-rootfs: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # This is create quick rootfs filesystem for kernel testing 4 | 5 | basepath=/home/bhaskar/git-linux/ 6 | 7 | cd $basepath || exit 1 8 | 9 | git clone --depth=1 https://github.com/mirror/busybox.git && cd "$(basename busybox .git)" 10 | # git clone git://busybox.net/busybox.git && cd "$(basename busybox .git)" 11 | 12 | make defconfig # if you need to add more specific option then run menuconfig 13 | 14 | # Checking out wheather the static is set or not , we don't need dynamic stuff 15 | 16 | grep CONFIG_STATIC .config 17 | 18 | echo Setting the static stuff 19 | echo 20 | 21 | # echo "CONFIG_STATIC=y" >> .config 22 | 23 | 24 | sed -i 's/# CONFIG_STATIC is not set/CONFIG_STATIC=y/' .config 25 | sed -i 's/CONFIG_TC=y/# CONFIG_TC is not set/' .config 26 | 27 | grep CONFIG_STATIC .config 28 | 29 | # Lets build it with the option set 30 | 31 | make -j$(nproc) 32 | 33 | # Install binaries in specific directory, so, it wont mess up system 34 | 35 | make CONFIG_PREFIX=$PWD/BUSYBOX install 36 | 37 | # Finding those damn installed binaries 38 | 39 | sh -c "find BUSYBOX -type d -exec ls -al {} \;" -------------------------------------------------------------------------------- /.vifm/colors/dmilith-user.vifm: -------------------------------------------------------------------------------- 1 | " vim: filetype=vifm : 2 | 3 | " Author: Daniel Dettlaff (a.k.a. dmilith) 4 | 5 | highlight Win cterm=none ctermfg=white ctermbg=black 6 | highlight Directory cterm=bold ctermfg=cyan ctermbg=black 7 | highlight Link cterm=bold ctermfg=yellow ctermbg=black 8 | highlight BrokenLink cterm=bold ctermfg=red ctermbg=none 9 | highlight Socket cterm=bold ctermfg=magenta ctermbg=black 10 | highlight Device cterm=bold ctermfg=red ctermbg=black 11 | highlight Fifo cterm=bold ctermfg=cyan ctermbg=none 12 | highlight Executable cterm=bold ctermfg=green ctermbg=black 13 | highlight Selected cterm=bold ctermfg=magenta ctermbg=black 14 | highlight CurrLine cterm=bold ctermfg=white ctermbg=30 15 | highlight TopLine cterm=bold ctermfg=white ctermbg=blue 16 | highlight TopLineSel cterm=bold ctermfg=yellow ctermbg=blue 17 | highlight StatusLine cterm=bold ctermfg=white ctermbg=blue 18 | highlight WildMenu cterm=underline,reverse ctermfg=white ctermbg=black 19 | highlight CmdLine cterm=none ctermfg=white ctermbg=black 20 | highlight ErrorMsg cterm=none ctermfg=red ctermbg=black 21 | highlight Border cterm=none ctermfg=black ctermbg=blue 22 | -------------------------------------------------------------------------------- /.vifm/colors/reicheltd-light.vifm: -------------------------------------------------------------------------------- 1 | " vim: filetype=vifm : 2 | 3 | " Author: Daniel R. (a.k.a. reicheltd) 4 | 5 | highlight Win cterm=none ctermfg=236 ctermbg=255 6 | highlight Directory cterm=bold ctermfg=21 ctermbg=255 7 | highlight Link cterm=bold ctermfg=39 ctermbg=default 8 | 9 | highlight BrokenLink cterm=bold ctermfg=red ctermbg=default 10 | highlight Socket cterm=bold ctermfg=magenta ctermbg=default 11 | highlight Device cterm=bold ctermfg=blue ctermbg=default 12 | 13 | highlight Fifo cterm=bold ctermfg=cyan ctermbg=default 14 | highlight Executable cterm=bold ctermfg=red ctermbg=default 15 | highlight Selected cterm=bold ctermfg=200 ctermbg=default 16 | 17 | highlight CurrLine cterm=bold ctermfg=255 ctermbg=27 18 | highlight TopLine cterm=none ctermfg=236 ctermbg=255 19 | highlight TopLineSel cterm=bold ctermfg=236 ctermbg=255 20 | 21 | highlight StatusLine cterm=bold ctermfg=236 ctermbg=255 22 | highlight WildMenu cterm=underline,reverse ctermfg=236 ctermbg=255 23 | highlight CmdLine cterm=none ctermfg=236 ctermbg=255 24 | 25 | highlight ErrorMsg cterm=none ctermfg=red ctermbg=236 26 | highlight Border cterm=none ctermfg=236 ctermbg=255 27 | -------------------------------------------------------------------------------- /.vim/colors/pablo.vim: -------------------------------------------------------------------------------- 1 | " local syntax file - set colors on a per-machine basis: 2 | " vim: tw=0 ts=4 sw=4 3 | " Vim color file 4 | " Maintainer: Ron Aaron <ron@ronware.org> 5 | " Last Change: 2003 May 02 6 | 7 | hi clear 8 | set background=dark 9 | if exists("syntax_on") 10 | syntax reset 11 | endif 12 | let g:colors_name = "pablo" 13 | 14 | highlight Comment ctermfg=8 guifg=#808080 15 | highlight Constant ctermfg=14 cterm=none guifg=#00ffff gui=none 16 | highlight Identifier ctermfg=6 guifg=#00c0c0 17 | highlight Statement ctermfg=3 cterm=bold guifg=#c0c000 gui=bold 18 | highlight PreProc ctermfg=10 guifg=#00ff00 19 | highlight Type ctermfg=2 guifg=#00c000 20 | highlight Special ctermfg=12 guifg=#0000ff 21 | highlight Error ctermbg=9 guibg=#ff0000 22 | highlight Todo ctermfg=4 ctermbg=3 guifg=#000080 guibg=#c0c000 23 | highlight Directory ctermfg=2 guifg=#00c000 24 | highlight StatusLine ctermfg=11 ctermbg=12 cterm=none guifg=#ffff00 guibg=#0000ff gui=none 25 | highlight Normal guifg=#ffffff guibg=#000000 26 | highlight Search ctermbg=3 guibg=#c0c000 27 | -------------------------------------------------------------------------------- /search_permission.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import stat, sys, os, string, commands 3 | 4 | #Getting search pattern from user and assigning it to a list 5 | 6 | try: 7 | #run a 'find' command and assign results to a variable 8 | pattern = raw_input("Enter the file pattern to search for:\n") 9 | commandString = "find " + pattern 10 | commandOutput = commands.getoutput(commandString) 11 | findResults = string.split(commandOutput, "\n") 12 | 13 | #output find results, along with permissions 14 | print "Files:" 15 | print commandOutput 16 | print "================================" 17 | for file in findResults: 18 | mode=stat.S_IMODE(os.lstat(file)[stat.ST_MODE]) 19 | print "\nPermissions for file ", file, ":" 20 | for level in "USR", "GRP", "OTH": 21 | for perm in "R", "W", "X": 22 | if mode & getattr(stat,"S_I"+perm+level): 23 | print level, " has ", perm, " permission" 24 | else: 25 | print level, " does NOT have ", perm, " permission" 26 | except: 27 | print "There was a problem - check the message above" 28 | 29 | -------------------------------------------------------------------------------- /.vim/bash-support/codesnippets/usage-and-command-line-arguments.noindent: -------------------------------------------------------------------------------- 1 | 2 | ScriptVersion="1.0" 3 | 4 | #=== FUNCTION ================================================================ 5 | # NAME: usage 6 | # DESCRIPTION: Display usage information. 7 | #=============================================================================== 8 | function usage () 9 | { 10 | cat <<- EOT 11 | 12 | Usage : ${0##/*/} [options] [--] 13 | 14 | Options: 15 | -h|help Display this message 16 | -v|version Display script version 17 | 18 | EOT 19 | } # ---------- end of function usage ---------- 20 | 21 | #----------------------------------------------------------------------- 22 | # Handle command line arguments 23 | #----------------------------------------------------------------------- 24 | 25 | while getopts ":hv" opt 26 | do 27 | case $opt in 28 | 29 | h|help ) usage; exit 0 ;; 30 | 31 | v|version ) echo "$0 -- Version $ScriptVersion"; exit 0 ;; 32 | 33 | \? ) echo -e "\n Option does not exist : $OPTARG\n" 34 | usage; exit 1 ;; 35 | 36 | esac # --- end of case --- 37 | done 38 | shift $(($OPTIND-1)) 39 | 40 | -------------------------------------------------------------------------------- /mount_disks: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | find_disk=$(command -v blkid) 4 | 5 | # Get the damn partitions shown 6 | get_disks=$($find_disk | gawk '{ print $1 $5 }' | grep -v /dev/mapper | grep PARTLABEL | sed 's/PARTLABEL=//') 7 | 8 | show_disks=$(printf "%s${get_disks[0]}" | dmenu -p "Disks available for mount,Press Escape:") 9 | 10 | # Actual disk to grab for mount 11 | actual_disks=$($find_disk | gawk '{ print $1 }' | tr -d : | grep -v /dev/mapper) 12 | 13 | mount_disk=$(printf "%s${actual_disks[0]}" | dmenu -i -p "Which one to mount:") 14 | 15 | # Target space, where the grabbed disk captured in previous step should be mounted 16 | where_to_mount=$(find / -maxdepth 1 -type d) 17 | 18 | target_mount_space=$(printf "%s${where_to_mount[0]}" | dmenu -i -p "Where to mount:") 19 | 20 | # Actual command to mount the damn disk to a targeted fs via sudo 21 | SUDO_ASKPASS=/home/bhaskar/bin/dpass sudo -A /bin/mount $mount_disk $target_mount_space 22 | 23 | # Showing how the damn targeted, where things get mounted looks like 24 | mounted_path=$(find $target_mount_space -maxdepth 1 -type d ) 25 | 26 | show_mounted=$(printf "%s${mounted_path[0]}" | dmenu -p "This is how mounted path looks:") 27 | -------------------------------------------------------------------------------- /.vim/autoload/bash-support/codesnippets/usage-and-command-line-arguments.noindent: -------------------------------------------------------------------------------- 1 | 2 | ScriptVersion="1.0" 3 | 4 | #=== FUNCTION ================================================================ 5 | # NAME: usage 6 | # DESCRIPTION: Display usage information. 7 | #=============================================================================== 8 | function usage () 9 | { 10 | cat <<- EOT 11 | 12 | Usage : ${0##/*/} [options] [--] 13 | 14 | Options: 15 | -h|help Display this message 16 | -v|version Display script version 17 | 18 | EOT 19 | } # ---------- end of function usage ---------- 20 | 21 | #----------------------------------------------------------------------- 22 | # Handle command line arguments 23 | #----------------------------------------------------------------------- 24 | 25 | while getopts ":hv" opt 26 | do 27 | case $opt in 28 | 29 | h|help ) usage; exit 0 ;; 30 | 31 | v|version ) echo "$0 -- Version $ScriptVersion"; exit 0 ;; 32 | 33 | \? ) echo -e "\n Option does not exist : $OPTARG\n" 34 | usage; exit 1 ;; 35 | 36 | esac # --- end of case --- 37 | done 38 | shift $(($OPTIND-1)) 39 | 40 | -------------------------------------------------------------------------------- /.vim/bash-support/templates/shelloptions.templates: -------------------------------------------------------------------------------- 1 | § ============================================================= 2 | § Shell Options 3 | § ============================================================= 4 | 5 | == LIST: shopt == list == 6 | 'autocd', 7 | 'cdable_vars', 8 | 'cdspell', 9 | 'checkhash', 10 | 'checkjobs', 11 | 'checkwinsize', 12 | 'cmdhist', 13 | 'compat31', 14 | 'compat32', 15 | 'compat40', 16 | 'compat41', 17 | 'dirspell', 18 | 'direxpand', 19 | 'dotglob', 20 | 'execfail', 21 | 'expand_aliases', 22 | 'extdebug', 23 | 'extglob', 24 | 'extquote', 25 | 'failglob', 26 | 'force_fignore', 27 | 'globstar', 28 | 'gnu_errfmt', 29 | 'histappend', 30 | 'histreedit', 31 | 'histverify', 32 | 'hostcomplete', 33 | 'huponexit', 34 | 'interactive_comments', 35 | 'lastpipe', 36 | 'lithist', 37 | 'login_shell', 38 | 'mailwarn', 39 | 'no_empty_cmd_completion', 40 | 'nocaseglob', 41 | 'nocasematch', 42 | 'nullglob', 43 | 'progcomp', 44 | 'promptvars', 45 | 'restricted_shell', 46 | 'shift_verbose', 47 | 'sourcepath', 48 | 'xpg_echo', 49 | == ENDLIST == 50 | 51 | == Shopts == expandmenu, insert, map:bso, sc:o == 52 | |PickList( 'Shopts', 'shopt' )| 53 | shopt -s |PICK|<CURSOR> 54 | == ENDTEMPLATE == 55 | -------------------------------------------------------------------------------- /userChrome.css: -------------------------------------------------------------------------------- 1 | #TabsToolbar { visibility: collapse !important; } 2 | 3 | browser vbox#appcontent tabbrowser, #content, #tabbrowser-tabpanels, 4 | browser[type=content-primary],browser[type=content] > html { 5 | /* background: #1D1B19!important */ 6 | background: #002b36 !important 7 | } 8 | 9 | 10 | @namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); /* only needed once */ 11 | 12 | #content browser { 13 | margin-right: -14px !important; 14 | overflow-y: hidden; 15 | margin-bottom: -14px !important; 16 | overflow-x: scroll; 17 | } 18 | 19 | #nav-bar { 20 | /* customize this value. */ 21 | --navbar-margin: -38px; 22 | 23 | margin-top: var(--navbar-margin); 24 | margin-bottom: 0; 25 | z-index: -100; 26 | transition: all 0.3s ease !important; 27 | opacity: 0; 28 | } 29 | 30 | #navigator-toolbox:focus-within > #nav-bar, 31 | #navigator-toolbox:hover > #nav-bar 32 | { 33 | margin-top: 0; 34 | margin-bottom: var(--navbar-margin); 35 | z-index: 100; 36 | opacity: 1; 37 | } 38 | 39 | #bookmarks-view, #historyTree { 40 | /* background-color: #CFB53B !important; */ 41 | background-color: #002b36 !important; 42 | } 43 | -------------------------------------------------------------------------------- /.vim/autoload/bash-support/templates/shelloptions.templates: -------------------------------------------------------------------------------- 1 | § ============================================================= 2 | § Shell Options 3 | § ============================================================= 4 | 5 | == LIST: shopt == list == 6 | 'autocd', 7 | 'cdable_vars', 8 | 'cdspell', 9 | 'checkhash', 10 | 'checkjobs', 11 | 'checkwinsize', 12 | 'cmdhist', 13 | 'compat31', 14 | 'compat32', 15 | 'compat40', 16 | 'compat41', 17 | 'dirspell', 18 | 'direxpand', 19 | 'dotglob', 20 | 'execfail', 21 | 'expand_aliases', 22 | 'extdebug', 23 | 'extglob', 24 | 'extquote', 25 | 'failglob', 26 | 'force_fignore', 27 | 'globstar', 28 | 'gnu_errfmt', 29 | 'histappend', 30 | 'histreedit', 31 | 'histverify', 32 | 'hostcomplete', 33 | 'huponexit', 34 | 'interactive_comments', 35 | 'lastpipe', 36 | 'lithist', 37 | 'login_shell', 38 | 'mailwarn', 39 | 'no_empty_cmd_completion', 40 | 'nocaseglob', 41 | 'nocasematch', 42 | 'nullglob', 43 | 'progcomp', 44 | 'promptvars', 45 | 'restricted_shell', 46 | 'shift_verbose', 47 | 'sourcepath', 48 | 'xpg_echo', 49 | == ENDLIST == 50 | 51 | == Shopts == expandmenu, insert, map:bso, sc:o == 52 | |PickList( 'Shopts', 'shopt' )| 53 | shopt -s |PICK|<CURSOR> 54 | == ENDTEMPLATE == 55 | -------------------------------------------------------------------------------- /.vim/bash-support/templates/builtins.templates: -------------------------------------------------------------------------------- 1 | § ============================================================= 2 | § Builtins 3 | § ============================================================= 4 | 5 | == LIST: builtins == list == 6 | 'alias', 7 | 'bg', 8 | 'bind', 9 | 'break', 10 | 'builtin', 11 | 'caller', 12 | 'cd', 13 | 'command', 14 | 'compgen', 15 | 'complete', 16 | 'continue', 17 | 'compopt', 18 | 'declare', 19 | 'dirs', 20 | 'disown', 21 | 'echo', 22 | 'enable', 23 | 'eval', 24 | 'exec', 25 | 'exit', 26 | 'export', 27 | 'false', 28 | 'fc', 29 | 'fg', 30 | 'getopts', 31 | 'hash', 32 | 'help', 33 | 'history', 34 | 'jobs', 35 | 'kill', 36 | 'let', 37 | 'local', 38 | 'logout', 39 | 'mapfile', 40 | 'popd', 41 | 'printf', 42 | 'pushd', 43 | 'pwd', 44 | 'read', 45 | 'readarray', 46 | 'readonly', 47 | 'return', 48 | 'set', 49 | 'shift', 50 | 'shopt', 51 | 'source', 52 | 'suspend', 53 | 'test', 54 | 'times', 55 | 'trap', 56 | 'true', 57 | 'type', 58 | 'typeset', 59 | 'ulimit', 60 | 'umask', 61 | 'unalias', 62 | 'unset', 63 | 'wait', 64 | == ENDLIST == 65 | 66 | == Builtins == expandmenu, insert, map:bbu, sc:b == 67 | |PickList( 'Builtins', 'builtins' )| 68 | |PICK|<CURSOR> 69 | == ENDTEMPLATE == 70 | 71 | -------------------------------------------------------------------------------- /delete_file_by_inode.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #This is useful when a filename start with some uncanny character i.e underscore,hash,questionmark 4 | 5 | ARGCOUNT=1 # filename must be passed to this script 6 | 7 | E_WRONGARG=70 8 | 9 | E_FILE_NOT_EXISTS=71 10 | 11 | E_CHANGED_MIND=72 12 | 13 | if [[ $# -ne "$ARGCOUNT" ]] 14 | then 15 | echo "usage :`basename $0` filename" 16 | exit $E_WRONGARG 17 | fi 18 | 19 | 20 | if [[ ! -e "$1" ]] 21 | then 22 | echo "File \""$1"\" does not exists." 23 | exit $E_FILE_NOT_EXISTS 24 | fi 25 | 26 | inum='ls -i | grep "$1" | awk `{ print $1 }` ' 27 | 28 | echo "The inode number for the file '$1' is `ls -i $1` " 29 | 30 | #inum = index number of file 31 | #Every file is associated with an inode number ,which signifies it's physical location 32 | 33 | echo; 34 | 35 | echo -n "Are you absolutely sure you want to delete \"$1\" (y|n)?" 36 | read answer 37 | 38 | case "$answer" in 39 | 40 | [nN]) echo "Change your mind?" 41 | exit $E_CHANGED_MIND 42 | ;; 43 | 44 | *) echo "Deleting file \"$1\".... " ;; 45 | esac 46 | 47 | find . -inum $inum -exec rm {} \; 48 | 49 | echo "File "\" $1"\" deleted!!" 50 | 51 | exit 0 52 | 53 | 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /.vim/autoload/bash-support/templates/builtins.templates: -------------------------------------------------------------------------------- 1 | § ============================================================= 2 | § Builtins 3 | § ============================================================= 4 | 5 | == LIST: builtins == list == 6 | 'alias', 7 | 'bg', 8 | 'bind', 9 | 'break', 10 | 'builtin', 11 | 'caller', 12 | 'cd', 13 | 'command', 14 | 'compgen', 15 | 'complete', 16 | 'continue', 17 | 'compopt', 18 | 'declare', 19 | 'dirs', 20 | 'disown', 21 | 'echo', 22 | 'enable', 23 | 'eval', 24 | 'exec', 25 | 'exit', 26 | 'export', 27 | 'false', 28 | 'fc', 29 | 'fg', 30 | 'getopts', 31 | 'hash', 32 | 'help', 33 | 'history', 34 | 'jobs', 35 | 'kill', 36 | 'let', 37 | 'local', 38 | 'logout', 39 | 'mapfile', 40 | 'popd', 41 | 'printf', 42 | 'pushd', 43 | 'pwd', 44 | 'read', 45 | 'readarray', 46 | 'readonly', 47 | 'return', 48 | 'set', 49 | 'shift', 50 | 'shopt', 51 | 'source', 52 | 'suspend', 53 | 'test', 54 | 'times', 55 | 'trap', 56 | 'true', 57 | 'type', 58 | 'typeset', 59 | 'ulimit', 60 | 'umask', 61 | 'unalias', 62 | 'unset', 63 | 'wait', 64 | == ENDLIST == 65 | 66 | == Builtins == expandmenu, insert, map:bbu, sc:b == 67 | |PickList( 'Builtins', 'builtins' )| 68 | |PICK|<CURSOR> 69 | == ENDTEMPLATE == 70 | 71 | -------------------------------------------------------------------------------- /archive: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | filename=$1 4 | 5 | folder=$2 6 | 7 | usage() { 8 | 9 | echo "$(basename $0) filename > filename.gz ---> Zip" 10 | echo "$(basename $0) filename directory_name ---> Tar Gz" 11 | echo "$(basename $0) filename OR directory_name ---> Bunzip2" 12 | echo "$(basename $0) directory_name ---> XZ" 13 | } 14 | 15 | if [[ "$filename" == "" ]]; then 16 | echo You are suppose provide filename or directory 17 | usage 18 | exit 1 19 | fi 20 | 21 | 22 | #filenameext="${filename##*.}" 23 | 24 | declare -a compress=(zip gz bz2 xz) 25 | echo ${compress[@]} 26 | 27 | 28 | printf "Which compression method : %s" 29 | read -r com 30 | 31 | if [[ $com == "zip" ]];then 32 | echo You want a zip archive 33 | $(command -v gzip) -9 "$filename" 34 | elif [[ $com == "gz" ]];then 35 | echo You want a tar gz archive 36 | $(command -v tar) -cvzf "$filename" "$folder" 37 | elif [[ $com == "bz2" ]];then 38 | echo You want a bunzip archive 39 | $(command -v bunzip2) -z "$filename" 40 | elif [[ $com == "xz" ]];then 41 | echo You want a xz archive 42 | $(command -v xz) "$filename" 43 | else 44 | echo It seems you are not sure what archive is needed. 45 | fi -------------------------------------------------------------------------------- /mail_compose_send_by_emacs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash - 2 | #=============================================================================== 3 | # 4 | # FILE: mail_compose_send_by_emacs.sh 5 | # 6 | # USAGE: ./mail_compose_send_by_emacs.sh 7 | # 8 | # DESCRIPTION: opens new Emacs window with empty message and attaches files mentioned as script arguments 9 | # 10 | # OPTIONS: Need to pass an argument if you want to attach a file. 11 | # REQUIREMENTS: The server/daemon should be in running condition/active 12 | # BUGS: --- 13 | # NOTES: Stolen from this web page: https://notmuchmail.org/notmuch-emacs/ 14 | # AUTHOR: Bhaskar Chowdhury 15 | # ORGANIZATION: 16 | # CREATED: 06/01/2021 03:55 17 | # REVISION: --- 18 | #=============================================================================== 19 | 20 | set -o nounset # Treat unset variables as an error 21 | 22 | attach_cmds="" 23 | while [ $# -gt 0 ]; do 24 | fullpath=$(readlink --canonicalize "$1") 25 | attach_cmds="$attach_cmds (mml-attach-file \"$fullpath\")" 26 | shift 27 | done 28 | emacsclient -a '' -c -e "(progn (compose-mail) $attach_cmds)" 29 | -------------------------------------------------------------------------------- /i3-scripts/diskio.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | #=============================================================================== 3 | # 4 | # FILE: diskio.sh 5 | # 6 | # USAGE: ./diskio.sh 7 | # 8 | # DESCRIPTION: 9 | # 10 | # OPTIONS: --- 11 | # REQUIREMENTS: sysstat package 12 | # BUGS: --- 13 | # NOTES: --- 14 | # AUTHOR: Bhaskar Chowdhury (https://about.me/unixbhaskar), unixbhaskar@gmail.com 15 | # ORGANIZATION: Independent 16 | # CREATED: 05/12/2019 20:38 17 | # REVISION: --- 18 | #=============================================================================== 19 | 20 | set -o nounset # Treat unset variables as an error 21 | 22 | root=$(mount|grep ' / '|cut -d' ' -f 1) 23 | disk=$(basename $root) 24 | #root=$(readlink /dev/root) 25 | show=$(iostat -p sda | grep $disk | gawk '{ print "Disk:"$1 ",Read:"$6 ",Write:" $7}') 26 | #show1=$(iostat -p sda | grep $root1 | gawk '{ print "Disk:"$1 ",Read:"$5 ",Write:" $6}') 27 | 28 | #if [[ $root != "" ]];then 29 | echo -e "<span color='black' bgcolor='#7FFF00'>:$show</span>\n" 30 | #echo $show 31 | #fi 32 | 33 | #if [[ $root1 != "" ]];then 34 | # echo $show1 35 | #fi 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /.mutt/mailcap: -------------------------------------------------------------------------------- 1 | # use "lynx" to render HTML files: 2 | # # text/html; w3m -dump %s; nametemplate=%s.html; copiousoutput 3 | text/html ; lynx -dump -force_html %s ; copiousoutput 4 | text/htm ; lynx -dump -force_html %s ; copiousoutput 5 | message/html ; lynx -dump -force_html %s ; copiousoutput 6 | message/htm ; lynx -dump -force_html %s ; copiousoutput 7 | text/*; LESSQUIET=1 lesspipe.sh '%s'; copiousoutput 8 | #application/*; LESSQUIET=1 lesspipe.sh '%s'; copiousoutput 9 | image/*; sxiv %s; description="Images"; 10 | #image/*; LESSQUIET=1 lesspipe.sh '%s'; copiousoutput 11 | audio/*; mpv %s; description="Audio"; 12 | #audio/*; LESSQUIET=1 lesspipe.sh '%s'; copiousoutput 13 | video/*; mpv %s; description="Video"; 14 | application/pdf; "${PDFVIEWER:-zathura}" %s; test=test -n "$DISPLAY"; nametemplate=%s.pdf; description="PDF Document" 15 | #Alternative from ArchWiki mutt page 16 | 17 | #text/html; xdg-open %s &> /dev/null &; nametemplate=%s.html 18 | #application/*; xdg-open %s &> /dev/null &; 19 | #image/*; xdg-open %s &> /dev/null &; -------------------------------------------------------------------------------- /.vifm/colors/juef-zenburn.vifm: -------------------------------------------------------------------------------- 1 | " vim: filetype=vifm : 2 | 3 | " Author: Svyatoslav Mishyn (a.k.a. juef) 4 | 5 | " zenburn like color scheme for vifm 6 | " http://slinky.imukuppi.org/zenburnpage/ 7 | 8 | highlight Border cterm=none ctermfg=default ctermbg=235 9 | 10 | highlight Win cterm=none ctermfg=188 ctermbg=237 11 | highlight Directory cterm=none ctermfg=108 ctermbg=default 12 | highlight CurrLine cterm=none ctermfg=223 ctermbg=235 13 | highlight Selected cterm=none ctermfg=116 ctermbg=238 14 | 15 | highlight StatusLine cterm=bold ctermfg=144 ctermbg=235 16 | highlight ErrorMsg cterm=bold ctermfg=115 ctermbg=default 17 | highlight WildMenu cterm=bold,reverse ctermfg=144 ctermbg=235 18 | highlight CmdLine cterm=none ctermfg=188 ctermbg=237 19 | 20 | highlight TopLine cterm=none ctermfg=108 ctermbg=235 21 | highlight TopLineSel cterm=bold ctermfg=186 ctermbg=236 22 | 23 | highlight Executable cterm=none ctermfg=172 ctermbg=default 24 | highlight Link cterm=none ctermfg=142 ctermbg=default 25 | highlight BrokenLink cterm=none ctermfg=174 ctermbg=default 26 | 27 | highlight Device cterm=none ctermfg=228 ctermbg=default 28 | highlight Fifo cterm=none ctermfg=109 ctermbg=default 29 | highlight Socket cterm=none ctermfg=13 ctermbg=default 30 | -------------------------------------------------------------------------------- /extract_archive: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | archived_file=$1 4 | # latest_file=$(find $HOME/Downloads/ \( -iname \*.zip -o -iname \*.tar.gz -o -iname \*.tgz -o -iname \*.xz -o -iname \*.tar.bz2 \) -type f -newermt $(date '+%F') -ls | gawk '{ print $11}' | sort -f -i -r | head -1 ) 5 | 6 | extension="${archived_file##*.}" 7 | #extension2="${archived_file#*.}" 8 | 9 | filename="${archived_file%.*}" 10 | filename2=$(basename -- "${filename%.*}") 11 | 12 | usage() { 13 | if [[ "$archived_file" == "" ]];then 14 | echo "You are suppose to use: $(basename $0) filename.[zip|tar.gz|tgz|bz2|xz]" 15 | exit 1 16 | fi 17 | } 18 | 19 | if [[ "$extension" == "zip" ]];then 20 | $(command -v unzip) "$archived_file" >/dev/null 2>&1 21 | elif [[ "$extension" == "gz" ]];then 22 | $(command -v tar) -xvzf "$archived_file" >/dev/null 2>&1 23 | #elif [[ "$extension2" == "tar.gz" ]];then 24 | # $(command -v tar) xvzf "$archived_file" >/dev/null 2>&1 25 | elif [[ "$extension" == "bz2" ]];then 26 | $(command -v bunzip2) "$archived_file" >/dev/null 2>&1 27 | $(command -v tar) -xvf "$filename" >/dev/null 2>&1 28 | elif [[ "$extension" == "xz" ]];then 29 | $(command -v unxz) "$archived_file" >/dev/null 2>&1 30 | else 31 | echo Archiving has failed 32 | usage 33 | fi -------------------------------------------------------------------------------- /i3-scripts/cpu_temp.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash - 2 | #=============================================================================== 3 | # 4 | # FILE: cpu_temp.sh 5 | # 6 | # USAGE: ./cpu_temp.sh 7 | # 8 | # DESCRIPTION: 9 | # 10 | # OPTIONS: --- 11 | # REQUIREMENTS: --- 12 | # BUGS: --- 13 | # NOTES: --- 14 | # AUTHOR: Bhaskar Chowdhury (https://about.me/unixbhaskar), unixbhaskar@gmail.com 15 | # ORGANIZATION: Independent 16 | # CREATED: 05/29/2019 18:28 17 | # REVISION: --- 18 | #=============================================================================== 19 | 20 | set -o nounset # Treat unset variables as an error 21 | t_warn=${1:-60} 22 | t_crit=${2:-75} 23 | # sorting temp values for all cores 24 | t_curr=($(sensors -u coretemp-isa-0000 | awk '/input/{ printf "%d\n", $2}' | sort)) 25 | # using last value of array -> max temp ${t_curr[3]} 26 | if [[ $t_curr -lt $t_warn ]] 27 | then color="#90A959" #green - base16 28 | elif [[ $t_curr -ge $t_warn ]] && [[ $t_curr -lt $t_crit ]] 29 | then color="#D28445" #orange - base16 30 | else color="#AC4142" #red - base16 31 | fi 32 | # elements output for JSON (short text, full text, color) 33 | echo "$t_curr" 34 | echo "$t_curr" 35 | echo "$color" 36 | exit 37 | -------------------------------------------------------------------------------- /setup-sftp-user: -------------------------------------------------------------------------------- 1 | Setup SFTP-Only Access (Redhat-based Distro) 2 | April 12th, 2011 · No Comments · Centos, HowTo, Installation, Tips and Tricks 3 | 4 | Setup sftp-only access on default Redhat/CentOS install. Use built-in sftp-server which is non-chrooted and easy to setup. 5 | 6 | Server: Locate sftp-server binary and add to your list of valid shells on the system. 7 | 8 | which sftp-server 9 | 10 | Note: This will most likely give you this: /usr/libexec/openssh/sftp-server 11 | 12 | echo /usr/libexec/openssh/sftp-server >> /etc/shells 13 | 14 | Note: You may want to backup your /etc/shells first 15 | 16 | User Accounts: Add or modify accounts to use sftp-server. 17 | 18 | New User 19 | 20 | useradd -s /usr/libexec/openssh/sftp-server sftponlyuser 21 | 22 | Note: Important parameter there is the “-s /usr/libexec/openssh/sftp-server”, which sets the default shell for this account. By default you will have “/bin/bash”. 23 | 24 | Existing User: 25 | 26 | vi /etc/passwd 27 | 28 | Find the user that you want to configure for sftp only access and edit its shell. For exampleyou will see a line “username:x:500:500::/home/username:/bin/bash” change “/bin/bash” to “/usr/libexec/openssh/sftp-server” and save. Note: You may want to backup your /etc/passwd file as well. 29 | 30 | 31 | -------------------------------------------------------------------------------- /ffmpeg_cut: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Provide time in seconds 4 | 5 | 6 | # if [[ $# -lt 4 ]];then 7 | 8 | # echo You are suppose to provide two parameters to this script 9 | # echo Times should be given in hh:mm:ss format 10 | # echo $(basename $0) -ss start_sec -i source_file end_sec modifed_file 11 | # exit 1 12 | # fi 13 | 14 | printf "Give the start time in HH:MM:SS format: %s" 15 | read -r start_time 16 | 17 | start_sec=$(echo "$start_time" | gawk -F: '{ print ($1 * 60) + ($2 * 60) + $3 }') 18 | 19 | echo $start_sec 20 | 21 | printf "Give the Souce file: %s" 22 | 23 | read -r source_file 24 | 25 | printf "Give the end time in HH:SS:MM format: %s" 26 | read -r end_time 27 | 28 | 29 | end_sec=$(echo "$end_time" | gawk -F: '{ print ($1 * 60) + ($2 * 60) + $3 }') 30 | 31 | echo $end_sec 32 | 33 | printf "Give the modified file name: %s" 34 | read -r modi_file 35 | 36 | echo "ffmpeg -ss ${start_sec} -i ${source_file} -to ${end_sec} -c:a copy -c:v copy ${modi_file}.mp3" 37 | 38 | printf "Is it look alright?[Y/N]: %s" 39 | read -r res 40 | 41 | if test "$res" == "Y";then 42 | 43 | sh -c "ffmpeg -ss ${start_sec} -i ${source_file} -to ${end_sec} -c:a copy -c:v copy ${modi_file}.mp3" 44 | 45 | else 46 | printf "Something doesn't look right, fix it" 47 | 48 | fi 49 | 50 | -------------------------------------------------------------------------------- /i3-scripts/wea.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | location="$1"; [ -z "$location" ] || { location="$location+" && rm -f "$HOME/.local/share/weatherreport" ;} 3 | 4 | getforecast() { ping -q -c 1 1.1.1.1 >/dev/null || exit 1 5 | curl -s "wttr.in/$location" > "$HOME/.local/share/weatherreport" || exit 1 ;} 6 | 7 | showweather() { printf "%s" "$(sed '16q;d' "$HOME/.local/share/weatherreport" | grep -wo "[0-9]*%" | sort -n | sed -e '$!d' | sed -e "s/^/☔ /g" | tr -d '\n')" 8 | sed '13q;d' "$HOME/.local/share/weatherreport" | grep -o "m\\(-\\)*[0-9]\\+" | sort -n -t 'm' -k 2n | sed -e 1b -e '$!d' | tr '\n|m' ' ' | awk '{print " ❄️",$1 "°","☀",$2 "°"}' ;} 9 | 10 | case $BLOCK_BUTTON in 11 | 1) $TERMINAL -e less -S "$HOME/.local/share/weatherreport" ;; 12 | 2) getforecast && showweather ;; 13 | 3) pgrep -x dunst >/dev/null && notify-send "🌈 Weather module" "\- Left click for full forecast. 14 | - Middle click to update forecast. 15 | ☔: Chance of rain/snow 16 | ❄: Daily low 17 | 🌞: Daily high" ;; 18 | esac 19 | 20 | if [ "$(stat -c %y "$HOME/.local/share/weatherreport" >/dev/null 2>&1 | awk '{print $1}')" != "$(date '+%Y-%m-%d')" ] 21 | then getforecast && showweather 22 | else showweather 23 | fi 24 | 25 | -------------------------------------------------------------------------------- /check_lvm.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | import re,sys,commands,smtplib,string 3 | 4 | ################# 5 | #Set variables 6 | command = "df -h /home" 7 | critical = 95.0 8 | warning = 75.0 9 | ################# 10 | 11 | #build regex 12 | dfPattern = re.compile('[0-9]+') 13 | 14 | #get disk utilization 15 | diskUtil = commands.getstatusoutput(command) 16 | 17 | #split out the util % 18 | diskUtil = diskUtil[1].split()[11] 19 | 20 | #look for a match. If no match exit and return an 21 | #UNKNOWN (3) state to Nagios 22 | 23 | matchobj = dfPattern.match(diskUtil) 24 | if (matchobj): 25 | diskUtil = eval(matchobj.group(0)) 26 | else: 27 | print "STATE UNKNOWN" 28 | sys.exit(3) 29 | 30 | ################################ 31 | #Uncomment and change 32 | #diskUtil value to test plug-in 33 | #diskUtil = 98.0 34 | ################################ 35 | 36 | #Determine state to pass to Nagios 37 | #CRITICAL = 2 38 | #WARNING = 1 39 | #OK = 0 40 | if diskUtil >= critical: 41 | print "FREE SPACE CRITICAL: '/home' is %.2f%% full" % (float(diskUtil)) 42 | sys.exit(2) 43 | elif diskUtil >= warning: 44 | print "FREE SPACE WARNING: '/home' is %.2f%% full" % (float(diskUtil)) 45 | sys.exit(1) 46 | else: 47 | print "FREE SPACE OK: '/home' is %.2f%% full" % (float(diskUtil)) 48 | sys.exit(0) 49 | 50 | -------------------------------------------------------------------------------- /i3-scripts/batt.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ################################ 4 | # Shows info about connected batteries. 5 | # 6 | # Dependencies: 7 | # - acpi 8 | # 9 | # @return {Number(%)}: Current battery charge 10 | ################################ 11 | 12 | dir=$(dirname $0) 13 | source $dir/util.sh 14 | 15 | full="" 16 | short="" 17 | stat=0 18 | 19 | # Exit if no battery was found 20 | if [[ "$(acpi)" == "" ]]; then exit 0; fi 21 | 22 | state=$(acpi | sed -n 's/Battery [0]: \([A-Z]\).*, .*/\1/p') 23 | #state1=$(acpi | sed -n 's/Battery [1]: \([A-Z]\).*, .*/\1/p') 24 | chg=$(acpi | sed -n 's/Battery [0]:.*, \([0-9]\{1,3\}\)%.*/\1/p') 25 | #chg2=$(acpi | sed -n 's/Battery [1]:.*, \([0-9]\{1,3\}\)%.*/\1/p') 26 | 27 | # Charging or Unknown 28 | if [[ $state == "C" ]] || [[ $state == "U" ]] && [[ $state1 == "C" ]] || [[ $state1 == "U" ]];then 29 | 30 | icon="" 31 | fi 32 | if [[ $state != "C" ]] && [[ $state1 != "C" ]];then 33 | icon="" 34 | fi 35 | 36 | if [[ $chg -le 10 ]] && [[ $chg2 -le 10 ]];then 37 | icon="" 38 | stat=33 39 | LEVEL="critical" 40 | 41 | /usr/bin/notify-send --expire-time=0 --urgency=$LEVEL "Battery critical,please connect to power socket" "Exit Code: $LEVEL" 42 | fi 43 | full="$icon $chg% " 44 | short="$chg% %" 45 | 46 | echo $full 47 | echo $short 48 | exit $stat 49 | -------------------------------------------------------------------------------- /gitstats/index.html: -------------------------------------------------------------------------------- 1 | <!DOCTYPE html> 2 | <html> 3 | <head> 4 | <meta charset="UTF-8"> 5 | <title>GitStats - AdminScripts 6 | 7 | 8 | 9 | 10 | 11 |

GitStats - AdminScripts

12 | 22 |
Project name
AdminScripts
Generated
2016-11-14 13:13:53 (in 0 seconds)
Generator
GitStats (version 55c5c28), git version 2.10.2, gnuplot 5.0 patchlevel 5
Report Period
2016-09-13 10:19:58 to 2016-11-14 12:58:41
Age
63 days, 4 active days (6.35%)
Total Files
111
Total Lines of Code
6258 (6259 added, 1 removed)
Total Commits
6 (average 1.5 commits per active day, 0.1 per all days)
Authors
1 (average 6.0 commits per author)
23 | -------------------------------------------------------------------------------- /tools: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # This script helps you chose program to run in shell . If you failed to give 4 | # any argument to the command you chose ,it will simply show you the help 5 | # listing . And if you pass any argument to the specific command you select,it 6 | # will simply run the command with that argument. 7 | 8 | # The below array can be expanded as per your requirement. 9 | declare -a tools=( namei hostid findfs lsof pgrep pwdx pmap nm objdump objcopy readelf gdb ) 10 | 11 | # Select the tool from the prompt showing at the top of the screen. 12 | tool_choice=$(printf '%s\n' "${tools[@]}" | dmenu -l 10 -i -p "Tools:") 13 | 14 | # If you decide not to use it ,then simply exit 15 | [[ ! $tool_choice ]] && notify-send "You haven't select any tool" && exit 1 16 | 17 | # specify the argument you need to pass on along with the tool you have chosen 18 | # last step 19 | args=$(echo | dmenu -i -p "What arguments:") 20 | 21 | # Testing the condition to see ,if no argument given ,it will simply show the 22 | # help output 23 | if test "$args" == "";then 24 | $tool_choice --help && bash - 25 | 26 | # And when you provide specific argument ,it will go ahead and show output of 27 | # the command i.e whatever tool you have chosen 28 | elif test "$args" != "";then 29 | $tool_choice $args && bash - 30 | else 31 | : 32 | fi 33 | 34 | -------------------------------------------------------------------------------- /.vifm/colors/istib-solarized-dark.vifm: -------------------------------------------------------------------------------- 1 | " vim: filetype=vifm : 2 | 3 | " Author: Stéphane (a.k.a. istib) 4 | 5 | highlight Win cterm=none ctermfg=default ctermbg=none 6 | 7 | highlight TopLine cterm=none ctermfg=blue ctermbg=none 8 | highlight TopLineSel cterm=none ctermfg=blue ctermbg=none 9 | highlight StatusLine cterm=none ctermfg=blue ctermbg=none 10 | highlight Border cterm=none ctermfg=blue ctermbg=none 11 | 12 | highlight Selected cterm=bold ctermfg=magenta ctermbg=default 13 | highlight CurrLine cterm=bold ctermfg=default ctermbg=blue 14 | 15 | highlight WildMenu cterm=underline,reverse ctermfg=white ctermbg=black 16 | highlight CmdLine cterm=none ctermfg=white ctermbg=black 17 | highlight ErrorMsg cterm=none ctermfg=red ctermbg=black 18 | 19 | highlight Directory cterm=none ctermfg=cyan ctermbg=default 20 | highlight Link cterm=none ctermfg=yellow ctermbg=default 21 | highlight BrokenLink cterm=none ctermfg=red ctermbg=default 22 | highlight Socket cterm=none ctermfg=magenta ctermbg=default 23 | highlight Device cterm=none ctermfg=red ctermbg=default 24 | highlight Fifo cterm=none ctermfg=cyan ctermbg=default 25 | highlight Executable cterm=none ctermfg=green ctermbg=default 26 | -------------------------------------------------------------------------------- /vimwiki/important_files.wiki: -------------------------------------------------------------------------------- 1 | 2 | Alliance_cred 3 | asimov.jpg 4 | babbage.png 5 | bash.bashrc 6 | bash_browse_dev_tcp 7 | bash_support_keyword 8 | Bhaskar_Chowdhury 9 | Bhaskar_Chowdhury.docx 10 | bhaskar.jpeg 11 | bhaskar.jpg 12 | boot_from_grub_shell 13 | cheatsheet_Vim 14 | colors.sh 15 | Company_might_need_these_docs 16 | create_efi_entry 17 | debian_package_inspection_method 18 | e-filling-pass 19 | Electricity_customer_id 20 | elilo_install_on_EFI 21 | firefox 22 | firefox_key_combinations 23 | gentoo_pkgs 24 | gitmux.conf 25 | gpg-backup-restore-keys 26 | grub-efi-menu-install 27 | grub_rescue_boot 28 | http_status_code_explained 29 | IMG_20160812_151352_edit.jpg 30 | install_Wayland 31 | IPA_DNS 32 | kernel_config_options 33 | make-linux-fast-boot-parameter 34 | moving_from_one_kernel_version_to_another 35 | my-cert.tar.gz.gpg 36 | noyace.jpg 37 | open_port.gpg 38 | openvpn.conf 39 | os 40 | pgp 41 | pristime_gentoo_amd64_system_build_steps 42 | questions_to_recruiter 43 | set_capability 44 | set_locale 45 | shortcut 46 | smallkeypub 47 | small-pgp-pub-key 48 | smt_on_off 49 | spinner2.sh 50 | spinner.sh 51 | start_vpn 52 | tabbed-surf.xid 53 | terminal_colors_code 54 | tuxlogo.bmp 55 | twitter_backup_code 56 | userChrome.css 57 | userContent.css 58 | viminfo 59 | vimwiki 60 | vpn_connect 61 | WhatsApp-Image-20160515.jpg 62 | wpa_cli_procedure 63 | -------------------------------------------------------------------------------- /.vim/bash-support/codesnippets/well-behaved-script: -------------------------------------------------------------------------------- 1 | set -o nounset # treat unset variables as errors 2 | 3 | #=============================================================================== 4 | # GLOBAL DECLARATIONS 5 | #=============================================================================== 6 | declare -rx SCRIPT=${0##*/} # the name of this script 7 | declare -rx mkdir='/bin/mkdir' # the mkdir(1) command 8 | 9 | #=============================================================================== 10 | # SANITY CHECKS 11 | #=============================================================================== 12 | if [ -z "$BASH" ] ; then 13 | printf "$SCRIPT:$LINENO: run this script with the BASH shell\n" >&2 14 | exit 192 15 | fi 16 | 17 | if [ ! -x "$mkdir" ] ; then 18 | printf "$SCRIPT:$LINENO: command '$mkdir' not available - aborting\n" >&2 19 | exit 192 20 | fi 21 | 22 | #=============================================================================== 23 | # MAIN SCRIPT 24 | #=============================================================================== 25 | 26 | #=============================================================================== 27 | # STATISTICS / CLEANUP 28 | #=============================================================================== 29 | exit 0 30 | -------------------------------------------------------------------------------- /firefox_key_combinations: -------------------------------------------------------------------------------- 1 | Shortcut Key Description 2 | F5 Refresh 3 | F11 full screen mode 4 | Esc Stop loading page 5 | Space bar Moves down a page at a time 6 | Alt+Home Open your home 7 | Alt+Down previous text entered in a text box 8 | Alt+Left Back to previous page 9 | Alt+Right Arrow Forward web page 10 | Ctrl+(- or +) pressing ‘-‘ will decrease and ‘+’ will increase 11 | Ctrl+D Add current web page to bookmark 12 | Ctrl+F Access the Find option 13 | Ctrl+H View browser history 14 | Ctrl+J Display the download window 15 | Ctrl+I Display available bookmarks 16 | Ctrl+L Move cursor to address box 17 | Ctrl+N Open new browser window 18 | Ctrl+O Access the Open File window to open a file 19 | Ctrl+P Print the current web page 20 | Ctrl+T Open new tab 21 | Ctrl+F5 Force to full refresh 22 | Ctrl+Enter Quickly complete an address 23 | Ctrl+F4 or Ctrl+W Closes the currently selected tab 24 | Ctrl+Tab Moves through each of the open tabs. 25 | Ctrl+Shift+Del Open the Clear Data window to quickly clear private data from browser history 26 | Ctrl+Shift+B Open bookmarks window 27 | Ctrl+Shift+J Open the Browser Console 28 | Shift+Spacebar Moves up a page at a time 29 | Ctrl+Shift+W Close the Firefox browser window 30 | Ctrl+Shift+T Undo the close of a window 31 | Ctrl+Shift+P Open a new Private Browsing window 32 | Ctrl+Shift+N Reopen recently closed window 33 | -------------------------------------------------------------------------------- /.vim/autoload/bash-support/codesnippets/well-behaved-script: -------------------------------------------------------------------------------- 1 | set -o nounset # treat unset variables as errors 2 | 3 | #=============================================================================== 4 | # GLOBAL DECLARATIONS 5 | #=============================================================================== 6 | declare -rx SCRIPT=${0##*/} # the name of this script 7 | declare -rx mkdir='/bin/mkdir' # the mkdir(1) command 8 | 9 | #=============================================================================== 10 | # SANITY CHECKS 11 | #=============================================================================== 12 | if [ -z "$BASH" ] ; then 13 | printf "$SCRIPT:$LINENO: run this script with the BASH shell\n" >&2 14 | exit 192 15 | fi 16 | 17 | if [ ! -x "$mkdir" ] ; then 18 | printf "$SCRIPT:$LINENO: command '$mkdir' not available - aborting\n" >&2 19 | exit 192 20 | fi 21 | 22 | #=============================================================================== 23 | # MAIN SCRIPT 24 | #=============================================================================== 25 | 26 | #=============================================================================== 27 | # STATISTICS / CLEANUP 28 | #=============================================================================== 29 | exit 0 30 | -------------------------------------------------------------------------------- /linux_wikis_search: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | declare -a wiki_list=( arch gentoo slackware opensuse debian vim emacs ) 4 | 5 | wiki=$( printf '%s\n' "${wiki_list[@]}" | dmenu -i -l 10 -p "Search Which Wiki:") 6 | if [[ $wiki == "vim" ]];then 7 | setsid -f $(command -v vimb) https://vim.fandom.com/wiki/Vim_Tips_Wiki &>/dev/null 8 | 9 | elif [[ $wiki == "emacs" ]];then 10 | setsid -f $(command -v vimb) https://www.emacswiki.org/ &>/dev/null 11 | else 12 | 13 | query=$( echo | dmenu -p "$wiki Linux Wiki Search:" ) 14 | 15 | if [[ $wiki == "arch" ]]; then 16 | setsid -f $(command -v vimb) https://wiki.archlinux.org/title/$query 17 | elif [[ $wiki == "gentoo" ]];then 18 | setsid -f $(command -v vimb) https://wiki.gentoo.org/wiki/$query 19 | elif [[ $wiki == "slackware" ]];then 20 | setsid -f $(command -v vimb) https://docs.slackware.com/start 21 | elif [[ $wiki == "opensuse" ]];then 22 | setsid -f $(command -v vimb) https://en.opensuse.org/$query 23 | elif [[ $wiki == "debian" ]];then 24 | setsid -f $(command -v vimb) https://wiki.debian.org/$query 25 | # elif [[ $wiki == "vim" ]];then 26 | # setsid -f $(command -v vimb) https://vim.fandom.com/wiki/Vim_Tips_Wiki 27 | # elif [[ $wiki == "emacs" ]];then 28 | # setsid -f $(command -v vimb) https://www.emacswiki.org/ 29 | else 30 | notify-send "you haven't select any wiki" 31 | fi 32 | fi 33 | -------------------------------------------------------------------------------- /check_top_process.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Bill Beavis 4 | # 5 | # todo: better checking for commandline arguments 6 | 7 | CLIMIT=80 8 | WLIMIT=50 9 | STATE_OK=0 10 | STATE_CRITICAL=2 11 | STATE_WARNING=1 12 | 13 | print_help() { 14 | echo "" 15 | echo "Usage: check_top_process -w -c " 16 | echo "" 17 | echo "This plugin checks the top running process." 18 | echo "" 19 | exit 0 20 | } 21 | 22 | case "$1" in 23 | -w) 24 | WLIMIT=$2 25 | CLIMIT=$4 26 | ;; 27 | -c) 28 | CLIMIT=$2 29 | WLIMIT=$4 30 | ;; 31 | --help) 32 | print_help 33 | exit $STATE_OK 34 | ;; 35 | -h) 36 | print_help 37 | exit $STATE_OK 38 | ;; 39 | *) 40 | esac 41 | 42 | if [ `echo $WLIMIT $CLIMIT |awk '{print ($1 > $2) ? "true" : "false" }'` = "true" ] 43 | then 44 | echo "Error: WARNING value must be below CRITICAL value" 45 | print_help 46 | exit $STATE_OK 47 | fi 48 | 49 | 50 | x=`UNIX95= ps -eo pcpu,comm,user,pid,time |sort -rnk1 | head -1` 51 | y=`echo $x |awk '{print $1 "% command=" $2 " user=" $3 " pid=" $4 " cputime=" $5}'` 52 | if [ `echo $x $CLIMIT |awk '{print ($1 > $6) ? "true" : "false" }'` = "true" ] 53 | then 54 | echo $y 55 | exit $STATE_CRITICAL 56 | fi 57 | 58 | if [ `echo $x $WLIMIT |awk '{print ($1 > $6) ? "true" : "false" }'` = "true" ] 59 | then 60 | echo $y 61 | exit $STATE_WARNING 62 | fi 63 | 64 | echo $y 65 | exit $STATE_OK 66 | -------------------------------------------------------------------------------- /github_repo_creation: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | github-create() { 4 | repo_name=$1 5 | 6 | dir_name=`basename $(pwd)` 7 | 8 | if [ "$repo_name" = "" ]; then 9 | echo "Repo name (hit enter to use '$dir_name')?" 10 | read repo_name 11 | fi 12 | 13 | if [ "$repo_name" = "" ]; then 14 | repo_name=$dir_name 15 | fi 16 | 17 | username=`git config github.user` 18 | if [ "$username" = "" ]; then 19 | echo "Could not find username, run 'git config --global github.user '" 20 | invalid_credentials=1 21 | fi 22 | 23 | token=`git config github.token` 24 | if [ "$token" = "" ]; then 25 | echo "Could not find token, run 'git config --global github.token '" 26 | invalid_credentials=1 27 | fi 28 | 29 | if [ "$invalid_credentials" == "1" ]; then 30 | return 1 31 | fi 32 | 33 | echo -n "Creating Github repository '$repo_name' ..." 34 | curl -u "$username:$token" https://api.github.com/user/repos -d '{"name":"'$repo_name'"}' > /dev/null 2>&1 35 | echo " done." 36 | 37 | echo -n "Pushing local code to remote ..." 38 | git remote add origin git@github.com:$username/$repo_name.git > /dev/null 2>&1 39 | git push -u origin master > /dev/null 2>&1 40 | echo " done." 41 | } 42 | -------------------------------------------------------------------------------- /vimwiki/Music.wiki: -------------------------------------------------------------------------------- 1 | 2 | AAJ EI BRISHTIR KANNA DEKHEY - TAPOSH FEAT. PAPON - OMZ WIND OF CHANGE [ S -05 ]-5VN1tCbwukg.mp3 3 | Abhijit 4 | Ami Brishti Dekhechi Anjan Dutta Lyric-wZwcy-BGsGU.mp3 5 | Amit_Kumar 6 | Anup_Jolota 7 | Arijit_Singh 8 | A.R. Rahman - Ghanan Ghanan Best Video_Lagaan_Aamir Khan_Alka Yagnik_Udit Narayan-GmCn31pq8i0.mp3 9 | Blues 10 | Bob_Dylan 11 | Classical 12 | Dance_number 13 | downloaded_songs 14 | Drums 15 | Frank_Sinatra 16 | Gulam_Ali 17 | Hariharan 18 | Hariharan and Tari Khan- Kaise Chupau Raaz-e-gum-vjDdSyicFfo.mp3 19 | Hariharan and Ustad Sabir Khan part 2-_TL3txGNj6A.mp3 20 | HariharanZakir 21 | Illayaraja 22 | IndraNil 23 | Jagjit_Singh 24 | Jamuna Ki Bolte Paare _ Sonali Roy-MJN4LNKg8OU.mp3 25 | Kailash_kher 26 | Kenny_G 27 | KISHORE 28 | Kisoreda_Bengali_Songs 29 | kisore_lata 30 | Kumar_Sanu 31 | Manna_Dey 32 | Mark_Knopfler 33 | MdRafi 34 | Monomoy 35 | Nochiketa 36 | Nusrat_Fetah_Ali_Khan 37 | Pankaj_Udhas 38 | Pink_Floyd 39 | Rabindra sangeet Tumi Robe Nirobe - Kuheli-QBtvi1ZjAEc.mp3 40 | Rabindra_Sangit 41 | RAFI 42 | rafi_lata 43 | Rahat_Fateh_Ali_Khan 44 | RamKumar.mp3 45 | Random_collection 46 | Rupankar 47 | Safaqat_Jubin_KK 48 | Shan 49 | Shankar_Mahadevan 50 | Songs_All 51 | Sonu_Nigam 52 | SPB 53 | Srikanta 54 | Subhomita 55 | Sukhwinder_Shing 56 | Suresh_Wadekar 57 | The_Saxophone_Sisters_with_the_Fareed_Haque_Trio-4Yo7E9DMBlM.mp3 58 | Udit_Narayan 59 | -------------------------------------------------------------------------------- /vimwiki/ pristime_gentoo_amd64_system_build_steps.wiki: -------------------------------------------------------------------------------- 1 | 2 | don't skip this `-1` option for emerge in my examples, otherwise you'll add packages to your world file. 3 | 4 | # get new portage 5 | emerge portage -av1 6 | 7 | # update linux-headers and glibc and co, so it's using up to date headers 8 | emerge linux-headers glibc -av1 9 | etc-update 10 | 11 | # update binutils and libtool, get rid of old 12 | emerge libtool binutils binutils-config -avu1 13 | emerge -ca binutils 14 | env-update && source /etc/profile && export PS1="(CHROOT) $PS1" 15 | 16 | # update gcc and co, skipping old. 17 | emerge gcc mpfr mpc gcc-config -avu1 18 | gcc-config x86_64-pc-linux-gnu-8.2.0 19 | emerge -ca gcc 20 | env-update && source /etc/profile && export PS1="(CHROOT) $PS1" 21 | 22 | # rebuild toolchain and co with all new gcc 23 | emerge libtool binutils glibc libnsl opensp mpc mpfr gmp libtirpc dev-libs/libffi -av1 24 | 25 | # update perl and update all it's deps to prevent build falures 26 | emerge perl perl-CPAN-Meta perl-cleaner -avu1 27 | perl-cleaner --reallyall 28 | 29 | # update all packages to unstable 30 | emerge -uDN --with-bdeps=y --changed-deps y --dynamic-deps y --complete-graph @world @system -av1 --keep-going 31 | etc-update 32 | 33 | # clean up unneeded 34 | emerge -ca 35 | 36 | # read the news! 37 | eselect news read 38 | 39 | # run this to rebuild all packages with the new flags 40 | emerge -e world 41 | -------------------------------------------------------------------------------- /.vifm/colors/astrell-root.vifm: -------------------------------------------------------------------------------- 1 | " vim: filetype=vifm : 2 | 3 | highlight clear 4 | 5 | highlight Border cterm=none ctermfg=black ctermbg=131 6 | 7 | highlight TopLine cterm=none ctermfg=black ctermbg=white 8 | highlight TopLineSel cterm=bold ctermfg=default ctermbg=default 9 | 10 | highlight StatusLine cterm=none ctermfg=black ctermbg=white 11 | highlight WildMenu cterm=none ctermfg=default ctermbg=153 12 | 13 | highlight CmdLine cterm=none ctermfg=white ctermbg=black 14 | highlight ErrorMsg cterm=none ctermfg=red ctermbg=default 15 | 16 | highlight Win cterm=none ctermfg=0 ctermbg=182 17 | highlight Directory cterm=bold ctermfg=17 ctermbg=default 18 | highlight Link cterm=none ctermfg=94 ctermbg=default 19 | highlight BrokenLink cterm=bold ctermfg=160 ctermbg=default 20 | highlight Socket cterm=bold ctermfg=91 ctermbg=default 21 | highlight Device cterm=bold ctermfg=52 ctermbg=default 22 | highlight Fifo cterm=bold ctermfg=105 ctermbg=default 23 | highlight Executable cterm=bold ctermfg=23 ctermbg=default 24 | highlight Selected cterm=bold ctermfg=default ctermbg=217 25 | highlight CurrLine cterm=bold ctermfg=238 ctermbg=153 26 | highlight OtherLine cterm=default ctermfg=default ctermbg=default 27 | -------------------------------------------------------------------------------- /.vifm/colors/astrell-user.vifm: -------------------------------------------------------------------------------- 1 | " vim: filetype=vifm : 2 | 3 | highlight clear 4 | 5 | highlight Border cterm=none ctermfg=black ctermbg=131 6 | 7 | highlight TopLine cterm=none ctermfg=black ctermbg=white 8 | highlight TopLineSel cterm=bold ctermfg=default ctermbg=default 9 | 10 | highlight StatusLine cterm=none ctermfg=black ctermbg=white 11 | highlight WildMenu cterm=none ctermfg=default ctermbg=153 12 | 13 | highlight CmdLine cterm=none ctermfg=white ctermbg=black 14 | highlight ErrorMsg cterm=none ctermfg=red ctermbg=default 15 | 16 | highlight Win cterm=none ctermfg=0 ctermbg=224 17 | highlight Directory cterm=bold ctermfg=17 ctermbg=default 18 | highlight Link cterm=none ctermfg=94 ctermbg=default 19 | highlight BrokenLink cterm=bold ctermfg=160 ctermbg=default 20 | highlight Socket cterm=bold ctermfg=91 ctermbg=default 21 | highlight Device cterm=bold ctermfg=52 ctermbg=default 22 | highlight Fifo cterm=bold ctermfg=105 ctermbg=default 23 | highlight Executable cterm=bold ctermfg=23 ctermbg=default 24 | highlight Selected cterm=bold ctermfg=default ctermbg=182 25 | highlight CurrLine cterm=bold ctermfg=238 ctermbg=153 26 | highlight OtherLine cterm=default ctermfg=default ctermbg=default 27 | --------------------------------------------------------------------------------