Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # (c) Zygmunt Krynicki 2007,
- # Licensed under GPL, see COPYING for the whole text
- #
- # This script will look-up command in the database and suggest
- # installation of packages available from the repository
- if [[ -x /usr/lib/command-not-found ]] ; then
- if (( ! ${+functions[command_not_found_handler]} )) ; then
- function command_not_found_handler {
- [[ -x /usr/lib/command-not-found ]] || return 1
- /usr/lib/command-not-found --no-failure-msg -- ${1+"$1"} && :
- }
- fi
- fi
- Thu Aug 16 19:30:57 EDT 2018
- du -sh ./** | sort -h
- -----------------------------
- Thu Aug 16 20:13:27 EDT 2018
- NOTE:
- echo -e "\n-----------------------------\n`date`\nNOTE:\n" >> ~/notes
- -----------------------------
- Thu Aug 16 20:13:58 EDT 2018
- NOTE:
- #!/bin/sh
- set -e
- . /usr/share/debconf/confmodule
- MISSING='/dev/.udev/firmware-missing /run/udev/firmware-missing'
- DENIED=/tmp/missing-firmware-denied
- if [ "x$1" = "x-n" ]; then
- NONINTERACTIVE=1
- else
- NONINTERACTIVE=""
- fi
- IFACES="$@"
- log () {
- logger -t check-missing-firmware "$@"
- }
- # Not all drivers register themselves if firmware is missing; in that
- # case determine the module via the device's modalias.
- get_module () {
- local devpath=$1
- if [ -d $devpath/driver ]; then
- # The real path of the destination of the driver/module
- # symlink should be something like "/sys/module/e100"
- basename $(readlink -f $devpath/driver/module) || true
- elif [ -e $devpath/modalias ]; then
- modalias="$(cat $devpath/modalias)"
- # Take the last module returned by modprobe
- modprobe --show-depends "$modalias" 2>/dev/null | \
- sed -n -e '$s#^.*/\([^.]*\)\.ko.*$#\1#p'
- fi
- }
- # Some modules only try to load firmware once brought up. So bring up and
- # then down any interfaces specified by ethdetect.
- upnics() {
- for iface in $IFACES; do
- log "taking network interface $iface up/down"
- ip link set "$iface" up || true
- ip link set "$iface" down || true
- done
- }
- # Checks if a given module is a nic module and has an interface that
- # is up and has an IP address. Such modules should not be reloaded,
- # to avoid taking down the network after it's been configured.
- nic_is_configured() {
- module="$1"
- for iface in $(ip -o link show up | cut -d : -f 2); do
- dir="/sys/class/net/$iface/device/driver"
- if [ -e "$dir" ] && [ "$(basename "$(readlink "$dir")")" = "$module" ]; then
- if ip address show scope global dev "$iface" | grep -q 'scope global'; then
- return 0
- fi
- fi
- done
- return 1
- }
- get_fresh_dmesg() {
- dmesg_file=/tmp/dmesg.txt
- dmesg_ts=/tmp/dmesg-ts.txt
- # Get current dmesg:
- dmesg > $dmesg_file
- # Truncate if needed:
- if [ -f $dmesg_ts ]; then
- # Transform [foo] into \[foo\] to make it possible to search for
- # "^$tspattern" (-F for fixed string doesn't play well with ^ to
- # anchor the pattern on the left):
- tspattern=$(cat $dmesg_ts | sed 's,\[,\\[,;s,\],\\],')
- log "looking at dmesg again, restarting from $tspattern"
- # Find the line number for the first match, empty if not found:
- ln=$(grep -n "^$tspattern" $dmesg_file |sed 's/:.*//'|head -n 1)
- if [ ! -z "$ln" ]; then
- log "timestamp found, truncating dmesg accordingly"
- sed -i "1,$ln d" $dmesg_file
- else
- log "timestamp not found, using whole dmesg"
- fi
- else
- log "looking at dmesg for the first time"
- fi
- # Save the last timestamp:
- grep -o '^\[ *[0-9.]\+\]' $dmesg_file | tail -n 1 > $dmesg_ts
- log "saving timestamp for a later use: $(cat $dmesg_ts)"
- # Write and clean-up:
- cat $dmesg_file
- rm $dmesg_file
- }
- check_missing () {
- upnics
- # Give modules some time to request firmware.
- sleep 1
- modules=""
- files=""
- # The linux kernel and udev no longer let us know via
- # /dev/.udev/firmware-missing and /run/udev/firmware-missing
- # which firmware files the kernel drivers look for. Check
- # dmesg instead. See also bug #725714.
- fwlist=/tmp/check-missing-firmware-dmesg.list
- get_fresh_dmesg | sed -rn 's/^(\[[^]]*\] )?([^ ]+) [^ ]+: firmware: failed to load ([^ ]+) .*/\2 \3/p' > $fwlist
- while read module fwfile ; do
- log "looking for firmware file $fwfile requested by $module"
- if [ ! -e /lib/firmware/$fwfile ] ; then
- if grep -q "^$fwfile$" $DENIED 2>/dev/null; then
- log "listed in $DENIED"
- continue
- fi
- files="${files:+$files }$fwfile"
- modules="$module${modules:+ $modules}"
- fi
- done < $fwlist
- # This block looking in $MISSING should be removed when
- # hw-detect no longer should support installing using older
- # udev and kernel versions.
- for missing_dir in $MISSING
- do
- if [ ! -d "$missing_dir" ]; then
- log "$missing_dir does not exist, skipping"
- continue
- fi
- for file in $(find $missing_dir -type l); do
- # decode firmware filename as encoded by
- # udev firmware.agent
- fwfile="$(basename $file | sed -e 's#\\x2f#/#g')"
- # strip probably nonexistant firmware subdirectory
- devpath="$(readlink $file | sed 's/\/firmware\/.*//')"
- # the symlink is supposed to point to the device in /sys
- if ! echo "$devpath" | grep -q '^/sys/'; then
- devpath="/sys$devpath"
- fi
- module=$(get_module "$devpath")
- if [ -z "$module" ]; then
- log "failed to determine module from $devpath"
- continue
- fi
- rm -f "$file"
- if grep -q "^$fwfile$" $DENIED 2>/dev/null; then
- continue
- fi
- files="$fwfile${files:+ $files}"
- if [ "$module" = usbcore ]; then
- # Special case for USB bus, which puts the
- # real module information in a subdir of
- # the devpath.
- for dir in $(find "$devpath" -maxdepth 1 -mindepth 1 -type d); do
- module=$(get_module "$dir")
- if [ -n "$module" ]; then
- modules="$module${modules:+ $modules}"
- fi
- done
- else
- modules="$module${modules:+ $modules}"
- fi
- done
- done
- if [ -n "$modules" ]; then
- log "missing firmware files ($files) for $modules"
- return 0
- else
- log "no missing firmware in loaded kernel modules"
- return 1
- fi
- }
- # If found, copy firmware file; preserve subdirs.
- try_copy () {
- local fwfile=$1
- local sdir file f target
- sdir=$(dirname $fwfile | sed "s/^\.$//")
- file=$(basename $fwfile)
- for f in "/media/$fwfile" "/media/firmware/$fwfile" \
- ${sdir:+"/media/$file" "/media/firmware/$file"}; do
- if [ -e "$f" ]; then
- target="/lib/firmware${sdir:+/$sdir}"
- log "copying loose file $file from '$(dirname $f)' to '$target'"
- mkdir -p "$target"
- rm -f "$target/$file"
- cp -aL "$f" "$target" || true
- break
- fi
- done
- }
- first_try=1
- first_ask=1
- ask_load_firmware () {
- if [ "$first_try" ]; then
- first_try=""
- return 0
- fi
- if [ "$NONINTERACTIVE" ]; then
- if [ ! "$first_ask" ]; then
- return 1
- else
- first_ask=""
- return 0
- fi
- fi
- db_subst hw-detect/load_firmware FILES "$files"
- if ! db_input high hw-detect/load_firmware; then
- if [ ! "$first_ask" ]; then
- exit 1;
- else
- first_ask=""
- fi
- fi
- if ! db_go; then
- exit 10 # back up
- fi
- db_get hw-detect/load_firmware
- if [ "$RET" = true ]; then
- return 0
- else
- echo "$files" | tr ' ' '\n' >> $DENIED
- return 1
- fi
- }
- list_deb_firmware () {
- udpkg -c "$1" \
- | grep '^\./lib/firmware/' \
- | sed -e 's!^\./lib/firmware/!!' \
- | grep -v '^$'
- }
- check_deb_arch () {
- arch=$(udpkg -f "$1" | grep '^Architecture:' | sed -e 's/Architecture: *//')
- [ "$arch" = all ] || [ "$arch" = "$(udpkg --print-architecture)" ]
- }
- # Remove non-accepted firmware package
- remove_pkg() {
- pkgname="$1"
- # Remove all files listed in /var/lib/dpkg/info/$pkgname.md5sum
- for file in $(cut -d" " -f 2- /var/lib/dpkg/info/$pkgname.md5sum) ; do
- rm /$file
- done
- }
- install_firmware_pkg () {
- if echo "$1" | grep -q '\.deb$'; then
- # cache deb for installation into /target later
- mkdir -p /var/cache/firmware/
- cp -aL "$1" /var/cache/firmware/ || true
- filename="$(basename "$1")"
- pkgname="$(echo $filename |cut -d_ -f1)"
- udpkg --unpack "/var/cache/firmware/$filename"
- if [ -f /var/lib/dpkg/info/$pkgname.preinst ] ; then
- # Run preinst script to see if the firmware
- # license is accepted Exit code of preinst
- # decide if the package should be installed or
- # not.
- if /var/lib/dpkg/info/$pkgname.preinst ; then
- :
- else
- remove_pkg "$pkgname"
- rm "/var/cache/firmware/$filename"
- fi
- fi
- else
- udpkg --unpack "$1"
- fi
- }
- # Try to load udebs (or debs) that contain the missing firmware.
- # This does not use anna because debs can have arbitrary
- # dependencies, which anna might try to install.
- check_for_firmware() {
- echo "$files" | sed -e 's/ /\n/g' >/tmp/grepfor
- for filename in $@; do
- if [ -f "$filename" ]; then
- if check_deb_arch "$filename" && list_deb_firmware "$filename" | grep -qf /tmp/grepfor; then
- log "installing firmware package $filename"
- install_firmware_pkg "$filename" || true
- fi
- fi
- done
- rm -f /tmp/grepfor
- }
- while check_missing && ask_load_firmware; do
- # first, check if needed firmware (u)debs are available on the
- # PXE initrd or the installation CD.
- if [ -d /firmware ]; then
- check_for_firmware /firmware/*.deb /firmware/*.udeb
- fi
- if [ -d /cdrom/firmware ]; then
- check_for_firmware /cdrom/firmware/*.deb /cdrom/firmware/*.udeb
- fi
- # second, look for loose firmware files on the media device.
- if mountmedia; then
- for file in $files; do
- try_copy "$file"
- done
- umount /media || true
- fi
- # last, look for firmware (u)debs on the media device
- if mountmedia driver; then
- check_for_firmware /media/*.deb /media/*.udeb /media/*.ude /media/firmware/*.deb /media/firmware/*.udeb /media/firmware/*.ude
- umount /media || true
- fi
- # remove and reload modules so they see the new firmware
- # Sort to only reload a given module once if it asks for more
- # than one firmware file (example iwlagn)
- for module in $(echo $modules | tr " " "\n" | sort -u); do
- if ! nic_is_configured $module; then
- log "removing and loading kernel module $module"
- modprobe -r $module || true
- modprobe -b $module || true
- fi
- done
- done
- ____________________________________________
- Thu Aug 16 20:43:03 EDT 2018
- NOTE:
- wget https://raw.githubusercontent.com/gkiefer/backup2l/master/first-time.conf : backup2l.conf file
- ---------------------------------------------
- Thu Aug 16 20:57:25 EDT 2018
- NOTE:
- alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'
- ---------------------------------------------
- Thu Aug 16 21:47:17 EDT 2018
- NOTE:
- Creating check file for <all.1001>...
- Running post-backup procedure...
- post-backup:
- nothing to do
- Thu Aug 16 21:46:43 EDT 2018
- Summary =======
- Backup Date Time | Size | Skipped Files+D | New Obs. | Err.
- ------------------------------------------------------------------------------
- all.1 2018-08-16 20:42 | 273.8M | 0 3745 | 3745 0 | 0
- Filesystem Size Used Avail Use% Mounted on /dev/mmcblk1 15G 15G 53M 100% /media/v1ral_/SD_CARD
- ---------------------------------------------
- Fri Aug 17 00:13:53 EDT 2018
- NOTE: ACTION_WPA.SH [COPY]
- #!/bin/sh
- # Action script to enable/disable wpa-roam interfaces in reaction to
- # ifplugd events.
- #
- # Copyright: Copyright (c) 2008-2010, Kel Modderman <kel@otaku42.de>
- # License: GPL-2
- #
- PATH=/sbin:/usr/sbin:/bin:/usr/bin
- if [ ! -x /sbin/wpa_action ]; then
- exit 0
- fi
- # ifplugd(8) - <iface> <action>
- #
- # If an ifplugd managed interface is brought up, disconnect any
- # wpa-roam managed interfaces so that only one "roaming" interface
- # remains active on the system.
- IFPLUGD_IFACE="${1}"
- case "${2}" in
- up)
- COMMAND=disconnect
- ;;
- down)
- COMMAND=reconnect
- ;;
- *)
- echo "$0: unknown arguments: ${@}" >&2
- exit 1
- ;;
- esac
- for CTRL in /run/wpa_supplicant/*; do
- [ -S "${CTRL}" ] || continue
- IFACE="${CTRL#/run/wpa_supplicant/}"
- # skip if ifplugd is managing this interface
- if [ "${IFPLUGD_IFACE}" = "${IFACE}" ]; then
- continue
- fi
- if wpa_action "${IFACE}" check; then
- wpa_cli -i "${IFACE}" "${COMMAND}"
- fi
- done
- ---------------------------------------------
- Fri Aug 17 00:18:04 EDT 2018
- NOTE: pcmanfm.conf found in /etc/xdg
- [config]
- bm_open_method=0
- [volume]
- mount_on_startup=1
- mount_removable=1
- autorun=1
- [desktop]
- wallpaper_mode=0
- desktop_bg=#000000
- desktop_fg=#ffffff
- desktop_shadow=#000000
- show_wm_menu=0
- [ui]
- win_width=640
- win_height=480
- splitter_pos=150
- side_pane_mode=1
- view_mode=0
- show_hidden=0
- sort_type=0
- sort_by=2
- max_tab_chars=32
- ---------------------------------------------
- Fri Aug 17 00:20:35 EDT 2018
- NOTE:
- START OLD NOTES PASTE
- ---------------------------------------------
- pkexec rsync -r -p -v --ignore-existing --modify-window=1 -D --existing -z -i /media/d0ctor/SD_CARD /media/d0ctor/SD_CARD/MY_BACKUPS
- How to Open Disk Management From Command Prompt
- Time Required: Opening Disk Management from the Command Prompt only takes several seconds, and probably much less once you learn the command.
- In Windows 10 and Windows 8, open Run from the Start menu or Apps screen (or see the A Quicker Method... section at the bottom of the page for an even faster way to get to Disk Management than using its command).
- In Windows 7 and Windows Vista, click on the Start button.
- In Windows XP and earlier, click on Start and then Run.
- Type the following Disk Management command in the text box:
- diskmgmt.msc
- ...and then hit the Enter key or press the OK button, depending on where you ran the command from.
- Note: Technically, opening Disk Management from the Command Prompt would require that you actually open the Command Prompt program. However, running an executable program like diskmgmt.msc from the search or Run box accomplishes the same thing.
- Note: Also, technically, diskmgmt.msc is not the "Disk Management command" any more than any non command-line tool's executable is a "command." In the strictest sense, diskmgmt.msc is just the Run command for the Disk Management program.
- You must extract it but you dont must extract it to your harddrive you can use stdtout and pipe it to genisoimage or mkisofs
- tar --to-stdout xf tareddata.tar | genisoimage -o image.iso tareddata
- test it: mount -o loop image.iso /mnt
- you can write a small script to automize this issue
- #!/bin/bash
- FILES="$@"
- for f in $FILES
- do
- # if .bak backup file exists, read next file
- if [ -f ${f}.bak ]
- then
- echo "Skiping $f file..."
- continue # read next file and skip the cp command
- fi
- # we are here means no backup file exists, just use cp command to copy file
- /bin/cp $f $f.bak
- done
- -------------------------
- for I in 1 2 3 4 5
- do
- statements1 #Executed for all values of ''I'', up to a disaster-condition if any.
- statements2
- if (condition)
- then
- continue #Go to next iteration of I in the loop and skip statements3
- fi
- statements3
- done
- ---------------------------
- Sat Aug 11 18:17:48 EDT 2018
- NOTE: gdialog --backtitle "Word Count Script" --msgbox "Words: $a" 25 20
- Sun Aug 12 05:40:05 EDT 2018
- NOTE: (tar cf - .) | (gzip > /tmp/bin.tar.gz)
- Sun Aug 12 09:11:49 EDT 2018
- NOTE: find . -print | cpio -pdm /target/folder
- Sun Aug 12 10:21:55 EDT 2018
- NOTE: time (pbar | (tar cf - . | gzip > out.tgz) 2>&1 )
- Sun Aug 12 10:37:00 EDT 2018
- NOTE: tar -C $PWD --numeric-owner -S -c . | pv -tpeba -s 100G | tar -C /tmp/bin --numeric-owner -S -xp
- Sun Aug 12 10:56:15 EDT 2018
- NOTE: tar --to-stdout -S -c . | pv -tpeba -s 10G | gzip > /bkup/test.tar.tgz
- Sun Aug 12 11:07:58 EDT 2018
- NOTE: shell script example of checking for your scritps needed apt packages
- needed_tool='youtube-dl ffmpeg'
- require_tools () {
- local NOT_AVAIL=""
- for TOOL in $needed_tool; do
- if [ "`which $TOOL 2> /dev/null`" == "" ]; then NOT_AVAIL="$NOT_AVAIL $TOOL";
- fi
- done
- if [[ "$NOT_AVAIL" != "" ]]; then echo "ERROR: The following required tool(s) cannot be found: $NOT_AVAIL"
- exit
- 3
- fi
- }
- # Check If Package Downloaded
- require_tools
- Mon Aug 13 01:23:37 EDT 2018
- NOTE: s openvpn --config vpnbook-ca1-tcp80.ovpn --auth-user-pass ./vpnbook.auth
- Mon Aug 13 01:25:54 EDT 2018
- NOTE: cat /media/d0ctor/MISC./g0ne.iso/.dr3
- Mon Aug 13 18:26:40 EDT 2018
- NOTE: type -a 'CMD'
- Mon Aug 13 21:27:15 EDT 2018
- NOTE: nmcli connection show nmcli device show
- Mon Aug 13 21:33:19 EDT 2018
- NOTE: ls . | zenity --title "Choose File From Current Direcotry" --list --column "ImPerial TeK. Solutions {v1ral_ITS}" --width=1000 --height=200
- Mon Aug 13 22:49:07 EDT 2018
- NOTE: gnome-session-quit --reboot
- Mon Aug 13 22:49:20 EDT 2018
- NOTE: gnome-session-quit --logout
- Mon Aug 13 22:49:34 EDT 2018
- NOTE: gnome-session-quit --power-off
- Mon Aug 13 23:00:06 EDT 2018
- NOTE: PS1 = notes
- %F{blue}ITS%F{red}_%F{white} %F{yellow}~
- %F{blue} %Bv%F{green}%b1%Br%F{cyan}%bal%F{red}_%BITS %b%U%@%u -
- %b%F{red}%BITS%b%F{red} %F{white}%B<%/> %U%B%F{yellow}%@%u%F{black}-%b%F{white}%u %F{yellow}%k
- Mon Aug 13 23:10:12 EDT 2018
- NOTE: qps is a system and process monitor
- Mon Aug 13 23:35:00 EDT 2018
- NOTE: cp -r -u -v $SOURCE $DESTINATION
- Mon Aug 13 23:43:57 EDT 2018
- NOTE: you can create a file with "touch new.tar.gz" then use archivemount new.tar.gz /tmp/new and cp or mv any and all files to /tmp/new then fusermount -u /tmp/new and all the files will be in the new arhive
- NOTE:
- read FILE < <( echo "$(yad --file --multiple --width=800 --height=600 \
- --title="Select Files")" )
- Tue Aug 14 00:25:11 EDT 2018
- NOTE: tar cf - . | pv -tpeba -s 1G | gzip > awesome.tar.gz
- Tue Aug 14 04:43:41 EDT 2018
- NOTE:
- testing
- ---------------------------------------------
- Fri Aug 17 00:34:14 EDT 2018
- NOTE: BEST COMPRESSION
- 7z -mx=9 -tgzip a test.tgz ./new.1.tgz
- ---------------------------------------------
- Fri Aug 17 00:44:34 EDT 2018
- NOTE: blank entry form
- $(zenity --title "" --width=560 --text "" --forms --add-entry "")
- ---------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement