background preloader

Scripting

Facebook Twitter

Bash

Wmi. Speaking UNIX: The Squirrel portable shell and scripting language. In 1799, a French Army engineer made a remarkable find. No, it wasn't foie gras, camembert, pasteurization, or Sartre—in fact, it was the Rosetta stone, the key to deciphering much of Egypt's ancient hieroglyphics (see Figure 1). Figure 1. The Rosetta stone, an 1100-pound, trilingual tax policy. The inscription is a proclamation relaxing taxes on the priesthood. The stone, created in 196 BCE, inscribes three translations of a single passage—one each in hieroglyphics, Demotic (an Egyptian script), and classical Greek. In other words, think of the Rosetta stone as a half-ton Babelfish.

Software developers face a similar problem some 2000 years later. In general, the variety is good, but it can also be daunting. If you don't want to commit to the idiosyncrasies of the Fish shell, the Bash shell, the Z shell, the Windows operating system's cmd.exe, or some other shell scripting language, try the Squirrel Shell. Even better, you don't have to put a half-ton rock in your ear to use it. $ . A#! Bash Tricks II: repetitive tasks on files. It's been a while since I wrote for the last time. I found a job (finally) and it's eating up most of my time.

Anyway, I had already written a piece on repetitive tasks before. Yesterday I had to do a thing that required another set of repetitive tricks. I had to find a file that could be included in a number (huge number) of compressed files. Some where named .tar.gz, others where tgz. I didn't want to spend the next month checking each compressed file to see if my target file was there. So I made a one-liner that did the whole thing for me. First Attempt ( find /mnt/tmp/ -iname '*'.tgz; find /mnt/tmp/ -iname '*'.tar.gz; ) | while read filename; do lines=`tar tzf $filename | grep -i file-pattern | wc -l`; if [ $lines -gt 0 ]; then echo $filename; fi; doneFirst we have the ()s.

Second we have the while read variable; do x; y; z; done. Then the ``s. Finally, we are testing to see if the number is lines is greater than 0. Second Attempt And that's it! The Falcon programming language. AutoIt v3 - Automate and Script Windows Tasks - For Free! AutoIt v3 is a freeware BASIC-like scripting language designed for automating the Windows GUI and general scripting. It uses a combination of simulated keystrokes, mouse movement and window/control manipulation in order to automate tasks in a way not possible or reliable with other languages (e.g.

VBScript and SendKeys). AutoIt is also very small, self-contained and will run on all versions of Windows out-of-the-box with no annoying “runtimes” required! AutoIt was initially designed for PC “roll out” situations to reliably automate and configure thousands of PCs. Over time it has become a powerful language that supports complex expressions, user functions, loops and everything else that veteran scripters would expect.

Features: AutoIt has been designed to be as small as possible and stand-alone with no external .dll files or registry entries required making it safe to use on Servers. Take me to the downloads page! Features Basic-like Syntax and Rich Function Set Standalone and Small Controls. JavaScript - MDC. JavaScript (JS) is a lightweight interpreted (or just-in-time compiled) programming language with first-class functions. While it is most well-known as the scripting language for Web pages, many non-browser environments also use it, such as Node.js, Apache CouchDB and Adobe Acrobat. JavaScript is a prototype-based, multi-paradigm, single-threaded, dynamic language, supporting object-oriented, imperative, and declarative (e.g. functional programming) styles.

JavaScript's dynamic capabilities include runtime object construction, variable parameter lists, function variables, dynamic script creation (via eval), object introspection (via for...in and Object utilities), and source-code recovery (JavaScript functions store their source text and can be retrieved through toString()). This section is dedicated to the JavaScript language itself, and not the parts that are specific to Web pages or other host environments. Looking to become a front-end web developer? Get started. Good Shell Coding Practices. How to manage EMC, NetApp arrays with Perl scripting. Because EMC Symmetrix DMX arrays and NetApp arrays are heavily text- and command-line-oriented, managing them via Perl scripting makes a lot of sense.

In fact, I managed several hundred NetApp filers and large EMC Symmetrix DMX environments, all via Perl. I like Perl because it doesn't involve compiling, like with a traditional programming language, yet it has the fire power to do heavy lifting if the task calls for it. Perl (or any scripting language, for that matter, though Perl has benefits over others) can be leveraged to automate and manage your network-attached storage (NAS) or storage area network (SAN) environment. Here are a few other examples of using Perl for managing storage environments.

In Perl, you can have a large text file completely loaded in memory as one long string. Local ( $/ ); Once you have the output or file in a string, you can run a global search of a regular expression . I've used this extensively to manage my NetApp environments. Ssh1.enable off if ($filerA ! AppleScript: Exploring the power of Folder Actions, part I. Welcome to Part I of this mini AppleScript feature on creating useful folder actions. We'll have more posts on this topic coming up, but for now, let's introduce what a folder action is. Have you ever wanted to just drop a file into a folder and have something magically happen? Say, have a file printed, whisked to a remote site via FTP, or perhaps have an image be automatically flipped from horizontal to vertical? With Mac OS X's built-in folder actions, you can easily do this with a simple drag and drop. Creating the folder First, let's talk about how we can enable these "magical folders" that perform actions on files dropped within them.

For this example, I'll show you how to make a folder on your desktop that, when a file gets dropped into it, will display a dialog letting your know that the file was placed there.Start by creating a regular folder on the desktop; you can either right-click and select "New Folder," or select "New Folder" from the Finder's File menu. Waffle software · ThisService. What's all this, then? Built into Mac OS X is the concept of 'services'. A service is a small and targeted tool you can use in almost any program to insert text or do something useful with the current selection.

Out of the box, there are services to search the selected text in Google, or look it up in a dictionary. Just select text (or place the insertion point where you want it) and pick a service from the Services menu in the right-click context menu (or in the application menu). Normally, you have to write services using Apple's Cocoa framework, using languages like C, C++ or Objective-C. Help! ThisService is solely for creating new services. Swiss file knife - free command line text file processor.