Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
basic little tools
Awk Shell C
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
README
add_times
args.c
bar_graph
cfold
fah-stats
fib.c
flatten
getmtime.c
lessopen
merge
mycp
myunlink.c
newscript
noclobber
nsplit
psort
remove_old
seg.c
sub
update_gits
url_decode.c
url_encode.c

README

These tools are written in C, bash 4, and POSIX awk.

add_times:
  adds each TIME together and prints the result to stdout.

args:
  prints command line arguments given in a very readable format

bar_graph:
  Creates a bar graph of the categories and values in FILE(s) (or the standard
  input if no files are named, or if a single hyphen (-) is given), reading the
  first field as the category and the second as the value. Must be called with
  bar_grap -- [OPTIONS] [FILE...] (the -- is required). See bar_graph -- -h

cfold:
  Wraps input lines in each FILE (standard input if not provided), writing to
  standard output. Also included (although slightly different) in awk-libs as
  an example. must be called with cfold -- [OPTIONS] [FILE...] (the -- as the
  first arg is required)

fah-stats:
  parses the FAH log and gives useful information

fib:
  prints the Nth number of the fibonacci sequence. must be compiled with -lgmp

flatten:
  flattens a directory (recursively moves all files in sub-dirs to the current
  dir, and deletes the sub-dirs)

getmtime:
  usage: getmtime FORMAT FILE [...]
  prints the mtime for each FILE given according to FORMAT. FORMAT is anything
  valid for strftime(3), as well as %N, which will be replaced with FILE.

lessopen:
  this script is for the LESSOPEN env var, and is an "input pipe". it allows
  less to read archives, pdfs (with pdftotext), and will use lynx -dump for html
  to use it, set LESSOPEN='|lessopen %s'

merge:
  Merge sorted FILEs into one, and print the result to the standard output.

mycp:
  copies files. instead of erring or overwriting, appends numbers to dups
  (work in progress)

myunlink:
  does a call to unlink(2), prints errno and strerr(errno) if it errs

newscript:
  creates a new script, adding the shebang and other things for you. see 
  newscript --help or usage() in the source code

noclobber:
  Appends a numeric suffix to FILE, incrementing it until the resulting filename
  no longer exists. Prints the result to the standard output. If FILE already has
  an extension, adds the number before that extension. For example, if FILE is
  `my_file.txt', a possible result would be `my_file.1.txt'. See noclobber -h,
  or the comments in the source

nsplit:
  numeric version of split(1) written in POSIX awk. must be called with
  nsplit -- [OPTIONS] [FILE ...] (the -- is required). see nsplit -- -h, or the
  comments in the source

pac_removed:
  parses the pacman logfile and lists all removed packages that have not been
  reinstalled. see pac_removed -- -h, or the comments in the source

psort:
  sort implementation that allows prioritizing the sort by pattern.
  see psort -- -h, or the comments in the source

remove_old:
  removes all but the latest N files in DIR(s).

seg:
  segfaults. for testing purposes.

sub:
  substitutes STR for REP, treating them as literal strings. must be called
  with sub -- [OPTIONS] [FILE...] (the '--' as the first argument is required)

update_gits:
  Find and update all git repositories (with git pull) within DIR, or the
  current working directory if DIR is not provided. By default, only check for
  repositories in the highest level sub-directories. Requires GNU find.

url_encode:
  uses libcurl to escape a given URL. must be compiled with -lcurl

url_decode:
  uses libcurl to decode a given URL. must be compiled with -lcurl

TODO:
  extend mycp, and fix bugs





Copyright Daniel Mills <dm@e36freak.com>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE SOFTWARE.
Something went wrong with that request. Please try again.