AptTool
version 0.7.2
Type:  Script File
Language:  Python 3
Searches apt packages names and descriptions (using regex), can also reverse search installed files, and list installed files per package.
This tool is for searching package names and descriptions in the apt-cache, listing dependencies/reverse-dependencies and suggested packages. It also handles installs, upgrades, removals/purges, and some other stuff (reverse file searches, history searching). By using regex or plain-text you can quickly find a package by part of a name, or part of a description. The real package name, install-state, and description will be listed for all packages that match (or don't match when
--reverse
is used). There are options to search names only, or omit the descriptions when printing results. The cache is searched while it is being loaded. This helps to cut down on the time, by iterating over the packages only once instead of loading first, and searching second. Results are shown as they are found, so even if searching the packages is taking too long you will normally see some results right away. You can always CTRL + C if you already found what you were looking for.
Using the
--containsfile
option you can reverse-search a file to find out what package it came from (if any). You can also list all installed-files for a package using the
--files
option. Obviously, a package must already be installed to list the installed-files.
The
-V
option will show the current version information for a package, and when coupled with
-a
, can show all available versions. It will always tell you if the latest version is installed or not.
The install, remove, and purge options work. They don't offer much of an improvement over the usual
apt-get install|remove|purge
methods, unless you just really hate typing and prefer
apttool -i|-d|-p
(with the proper symlink in place).
This script requires some third-party modules:
apt
,
apt_pkg
,
colr
, and
docopt
The latest version can always be found at github.com/welbornprod/apttool .
Usage:
    apttool -? | -h | -v
    apttool -c file [-C] [-n] [-q]
    apttool (-i | -d | -p) PACKAGES... [-C] [-q]
    apttool (-e | -f | -S) PACKAGES... [-C] [-q] [-s]
    apttool (-P | -R) PACKAGES... [-C] [-I | -N] [-q] [-s]
    apttool -H [QUERY] [COUNT] [-C] [-q]
    apttool (-l | -L) PACKAGES... [-C] [-q] [-s]
    apttool -u [-C] [-q]
    apttool -V PACKAGES... [-C] [-a] [-q] [-s]
    apttool PATTERNS... [-a] [-C] [-I | -N] [-D | -n] [-q] [-r] [-s] [-x]

Options:
    COUNT                        : Number of history lines to return.
    PACKAGES                     : One or many package names to try.
                                   If a file name is given, the names
                                   are read from the file. If '-' is
                                   given, names are read from stdin.
    PATTERNS                     : One or more text/regex patterns to
                                   search for. Multiple patterns will be
                                   joined with (.+)? if -a is used,
                                   otherwise they are joined with |.
    QUERY                        : Query to filter history with. The
                                   default is 'installed'.
    -a,--all                     : When viewing package version, list all
                                   available versions.

                                   When searching, join all patterns so
                                   they must all be found in the exact
                                   argument order.
                                   Like doing (arg1)(.+)?(arg2).
    -c file,--containsfile file  : Search all installed packages for an
                                   installed file using regex or text.
    -C,--nocolor                 : Disable colors always.
    -d,--delete                  : Uninstall/delete/remove a package.
    -D,--dev                     : Search for development packages.
    -e,--executables             : Show installed executables for a
                                   package.
                                   It just shows files installed to
                                   /bin directories.
    -f,--files                   : Show installed files for package.
                                   Multiple package names may be
                                   comma-separated, or passed with
                                   multiple flags.
    -?,--examples                : Show specific usage examples and exit.
    -H,--history                 : Show package history.
                                   (installs, uninstalls, etc.)
    -i,--install                 : Install a package.
    -I,--INSTALLED               : When searching for a package, only
                                   include installed packages.
    -l,--locate                  : Determine whether or not a package
                                   exists. You can pass a file name to
                                   read from, or use - for stdin.
                                   Otherwise a full package name is
                                   needed. Multiple names can be passed.
    -L,--LOCATE                  : Same as --locate, but only shows
                                   existing packages that are found.
    -n,--names                   : When searching for packages, only
                                   search names, not descriptions.
                                   When searching with -c, don't use the
                                   full file path, only the file name.
    -N,--NOTINSTALLED            : When searching for a package, only
                                   include non-installed packages.
    -p,--purge                   : Purge the package completely,
                                   remove all configuration.
    -P,--dependencies            : List all dependencies for a package.
    -q,--quiet                   : Don't print extra status messages.
    -r,--reverse                 : When searching, return packages that
                                   DON'T match.
    -R,--reversedeps             : Show reverse dependencies.
    -s,--short                   : Use shorter output.
                                   When searching, don't print the
                                   description.
                                   When locating, don't show the install
                                   state.
    -S,--suggests                : Show package suggestions.
    -u,--update                  : Update the cache.
                                   ..Just like `apt-get update`.
    -V,--VERSION                 : Show a package's installed or available
                                   versions.
    -x,--ignorecase              : Make the search query case-insensitive.

This has been tested with Python 3, but it won't work with Python 2.
FindExe
version 1.3.0
Type:  Script File
Language:  Python
Searches known /bin and /sbin directories to locate executables by name or part of a name.
Searches several well known /bin directories for files by name. Includes the /home/[your name] directories too. Can be ran with Python 2 or 3. This script requires the
docopt
module. You can install it by running
pip install docopt
for whatever version of Python you are using.
Usage:
    findexe.py <searchterm> [-a] [-e dirs] [-s] [-q]
    findexe.py -d

Options:
    -h,--help                   : Show this message.
    <searchterm>                : Name, or part of a name to search for.
    -a,--argstyle               : Output is formatted in argument-style so
                                  it can be used with another command like:
                                  stat `findexe ls -a`
                                  Output is either nothing ('') with
                                  return code 1,
                                  or 'file1 file2 file3' with return
                                  code 0.
    -d,--dirs                   : List the known executable directories.
    -e dirs,--exclude dirs      : Directories to exclude,
                                  separated by ',' or ':'.
    -s,--sort                   : Sort results.
                                  Results aren't shown as they're found.
    -q,--quote                  : Quote paths when argstyle is used.

This is known to work with Python 2 and 3.
PidName
version 1.3.4
Type:  Script File
Language:  Python 2
Gets the pid for a process by name using regex...
Gets the process ID by matching a name. If there are several processes with the same name, it will list them all with PIDs included. This script requires the
docopt
module. You can install it by running
pip install docopt
.
Usage:
        pidname.py -h
        pidname.py -l
        pidname.py name [options]
        pidname.py name -e excludename [options]

Options:
        name                                : known process name, or name to search for (regex allowed).
        -h,--help                           : show this message.
        -a,--args                           : include command arguments in results when found.
        -A,--ARGS                           : always include command arguments in results.
        -e excluded,--exclude excluded      : exclude any process names matching this regex.
        -l,--list                           : list all running processes with arguments.
        -p,--pidonly                        : same as --short.
        -s,--short                          : use short output suitable for chaining with another program.
                                              (first if many are found).

This has been tested with Python 2, but it won't work with Python 3.
PidNet
version 0.2.1
Type:  Script File
Language:  Python 2
Shows which internet sockets a process has open...
This script uses
lsof
and
pidof
to show which socket/internet connections a process has open.

You don't have to know the PID of the process, you can just enter its known name.
Usage:
    pidnet -h | -v
    pidnet [-F | -N] [-f | -q] [-D] [PROCESS...]

Options:
    PROCESS       : Process name/pattern, or pid to use.
                    A pattern may return more than one pid.
                    Stdin words are used when not given.
    -D,--debug    : Show some debug info while running.
    -F,--file     : Show file information.
    -f,--first    : Use first pid with usable info if multiple pids are
                    found.
    -h,--help     : Show this help message.
    -N,--net      : Show network information (default).
    -q,--quick    : Use first pid if multiple pids are found.
    -v,--version  : Show version.

This has been tested with Python 2, but it won't work with Python 3.
XHighlights
version 1.0.0
Type:  HexChat Script
Language:  Python 3
HexChat script that highlights nicks and links with customisable colors.

This script enhances the HexChat experience by automatically highlighting user-nicks and links when they are mentioned. Colors can be set with the /xhighlights command, and can be mixed by putting a comma between the multiple style names.

Here is a basic description of available commands:

xhighlights / highlights
Lists available colors (names/numbers), displays current settings, and allows you to set the preferred style for nicks and links.
Usage: /XHIGHLIGHTS [-n [style] | -l [style]]

Options:
    -c,--colors            : Show available styles.
    -l style,--link style  : Set link style by name/number.
    -n style,--nick style  : Set nick style by name/number.
    * style can be comma separated style names/numbers.
    * if no style is given, the current style will be shown.
    

To use these hexchat scripts you can either drop them in the HexChat config directory (usually ~/.config/hexchat/addons), or load the script manually by going to:
HexChat -> Load Plugin or Script...

This has been tested with Python 3, but it won't work with Python 2.
XTools
version 0.3.8
Type:  HexChat Script
Language:  Python 3
HexChat script that provides several useful commands.

This script enhances the XChat 2/HexChat experience by providing several commands not usually found in XChat/HexChat. I'm not sure if it works on windows or not because of the configuration file locations. It also requires Python 2.6.9+. This is because of XChat's Python plugin using python 2.6+ on some systems, and several features in XTools requiring some backports from 2.7.

Version 0.3.6

Fixed more encoding errors when printing to a new tab.

Version 0.3.5-4

Several clean-ups.

Version 0.3.5-3

Fixed encoding errors when printing unicode to the chat window.

Version 0.3.5-2

Word-wrap was fixed when printing filtered/ignored messages. The old method would break lines in the middle of a word, the new method breaks the line after a whole word (much better for long URLs).

Version 0.3.5

This script is now compatible with both XChat 2 and HexChat (fork from XChat).

Here is a basic description of available commands:

catch
Catch and save messages containing a regex/text pattern. Messages are saved per-session, and can be viewed with the
-m
flag. The time, channel, nick, and message are printed in chronological order. Action messages (/me actions) are marked with a '*'. Also see the
/catchers
command for quickly viewing which 'msg-catchers' are currently set.

Usage: /CATCH <pattern>
       /CATCH -f <pattern>
       /CATCH -r <pattern>
       /CATCH [-c | -d] | [-l | -m] [-t]

Options:
    <pattern>            : A word or regex pattern, if found in
                           a message it causes the msg to be
                           saved. You can retrieve the msgs
                           with the -m flag.
    -c,--clear           : Clear the msg-catcher list.
    -d,--delete          : Delete all caught messages.
    -f pat,--filter pat  : Removed any saved msgs that contain
                           the given text or regex pattern.
    -l,--list            : List all msg-catcher patterns.
    -m,--msgs            : Print all caught messages.
    -p,--print           : Toggle (enable/disable) the message
                           printer. When enabled, caught msgs
                           are printed to the xtools tab as
                           they are received.
    -r,--remove          : Remove catcher by number or text.
    -t,--tab             : Show output in the xtools tab.

    * With no arguments passed, all caught msgs are listed.
    * You can pass several space-separated catchers.
    * To include a catcher with spaces, wrap it in quotes.
    
catchers
This is a shortcut command for
/catch --list
. It lists the catchers instead of the messages by default. If any arguments are given, they are passed to the
/catch
command.
eval
Evaluates/executes python code and prints the output to the current xchat window. With the --chat flag given, output will be sent as a message to the current channel. If the snippet was in reply to a certain person, their nick may be given to 'mention' the person in the message. The result will never be sent to chat if an exception is raised, so you don't look so foolish for making a typo. Chat messages are only sent if the --chat flag is given, and the code actually compiles and runs with no exceptions. Raising your own exception will cause the message to not be sent.

Warning:
This will execute any code you throw at it. It is smarter than the plain
eval()
function, and allows you to do dangerous things. It only accepts input from you, so you only have yourself to blame if something goes wrong.

Do not
import os;os.system('rm -rf *')

Do not
print(open('mypassword.txt').read())

Do not do anything you wouldn't do in a python interpreter.

Usage: /EVAL [-c [nick] [-e] [-r]] [-k] <code>
       /EVAL [-k] [-t] <code>

Options:
         -c [n],--chat [n] : Send as msg to current channel.
                             Newlines are replaced with \\n,
                             and long output is truncated.
                             If a nick (n) is given, mention the
                             nick in the message.
     
                             * Nick must come before eval code,
                               and nick must be present in the
                               current channel.
         -e,--errors       : Force send any errors to chat.
                             This overrides default behavior of
                             cancelling chat-sends when exceptions
                             are raised.
                             Sends the last line of the error msg
                             to chat, usually the Exception string.
         -k,--code         : Print parsed code to window with
                             formatted newlines. Prints before code
                             is evaluated.
         -r,--result       : When chat-sending, send result only.
                             The original query is not sent.
         -t,--tab          : Show output in the xtools tab
    
findtext / whosaid
Searches current window or all windows for text, and reports back the time, channel, nick, and message where it was found.
Usage: /FINDTEXT [options]

Options:
     -a,--all   : Search all open windows.
     -n,--nick  : Search nicks only.
     -t,--tab   : Show output in the xtools tab.
    
listusers
Lists all users and hostnames in the current channel, or all channels.
Usage: /LISTUSERS [options]

Options:
     -a,--all    : List from all channels, not just the current channel.
     -c,--count  : Show count only.
     -t,--tab    : Show output in the xtools tab.
finduser / searchuser
Searches nicks, hosts, or both for part of a user nick and reports all matching results.
 
Usage: /SEARCHUSER [options] 

Options:
     <usernick>     : All or part of a user nick to find. Regex is allowed.
     -a, --all      : Searches all current channels, not just the current channel.
     -h,--host      : Search host also.
     -o,--onlyhost  : Only search hosts, not nicks.
     -t,--tab       : Show output in the xtools tab.
    
xignore
Ignores messages based on nick regex matching. Add, remove, or list currently ignored users. Ignored messages can be viewed with the -m flag.
Usage: /XIGNORE <nick>
       /XIGNORE -r <nick>
       /XIGNORE [-c | -l | -m]
 Options:
     <nick>       : Regex or text for nick to ignore.
     -c,--clear   : Clear the ignored list.
     -l,--list    : List all ignored nicks.
     -m,--msgs    : Print all ignored messages.
     -r,--remove  : Remove nick by number or name.
 
     * With no arguments passed, all ignored nicks are listed.
     * You can pass several space-separated nicks.
    
xtools
Shows help/descriptions for all XTools commands.
Usage: /XTOOLS [-v] | [[-d | -h] ]

Options:
    <cmdname>               : Show help for a command. (same as /help cmdname)
    -d [cmd],--desc [cmd]   : Show description for a command, or all commands.
    -h [cmd],--help [cmd]   : Show help for a command, or all commands.
    -v,--version            : Show version.

    * If no options are given, -d is assumed.
    

To use these hexchat scripts you can either drop them in the HexChat config directory (usually ~/.config/hexchat/addons), or load the script manually by going to:
HexChat -> Load Plugin or Script...

This has been tested with Python 3, but it won't work with Python 2.
If you would like to donate to welborn productions, you can do so here: Donate to welborn prod.
top