Difference between revisions of "Computer Productivity Hacks"

From TeleCafeWiki
Jump to navigation Jump to search
(→‎Text Editors: Added section for Notepad++.)
Line 246: Line 246:
 
=== Rename List of Files With Batch File ===
 
=== Rename List of Files With Batch File ===
 
It's easy to rename a group of files by running a [[wikipedia:Batch file|batch file]] (<tt>file.bat</tt>), configured something like this:
 
It's easy to rename a group of files by running a [[wikipedia:Batch file|batch file]] (<tt>file.bat</tt>), configured something like this:
<pre>
+
<pre>rename "Old-File_001.jpg" "New-File_001.jpg"
rename "Old-File_001.jpg" "New-File_001.jpg"
 
 
rename "Old-File_002.jpg" "New-File_002.jpg"
 
rename "Old-File_002.jpg" "New-File_002.jpg"
rename "Old-File_003.jpg" "New-File_003.jpg"
+
rename "Old-File_003.jpg" "New-File_003.jpg"</pre>
</pre>
 
 
# Using a simple text editor (such as [[wikipedia:Notepad++|Notepad++]]), just create your [[wikipedia:Batch file|batch file]] using the format shown above.
 
# Using a simple text editor (such as [[wikipedia:Notepad++|Notepad++]]), just create your [[wikipedia:Batch file|batch file]] using the format shown above.
 
# Save the file as <tt>rename.bat</tt> (or similar name) in the same folder containing the files you want to rename.
 
# Save the file as <tt>rename.bat</tt> (or similar name) in the same folder containing the files you want to rename.
 
# Double-click your batch file (e.g. <tt>rename.bat</tt>) to rename the files to the new file name.
 
# Double-click your batch file (e.g. <tt>rename.bat</tt>) to rename the files to the new file name.
 +
 +
=== Rename List of Folders With Batch File | Include Full Paths ===
 +
It's easy to rename a group of folders located in different parent directories by running a [[wikipedia:Batch file|batch file]] (<tt>file.bat</tt>), configured something like this:
 +
<pre>MOVE "C:\Parent Directory One \Sub Directory\Old Folder Name" "C:\Parent Directory One \Sub Directory\New Folder Name"
 +
MOVE "C:\Parent Directory Two \Sub Directory\Old Folder Name" "C:\Parent Directory Two \Sub Directory\New Folder Name"
 +
MOVE "C:\Parent Directory Three \Sub Directory\Old Folder Name" "C:\Parent Directory Three \Sub Directory\New Folder Name"</pre>
  
 
* [http://www.wikihow.com/Write-a-Batch-File How to Write a Batch File]
 
* [http://www.wikihow.com/Write-a-Batch-File How to Write a Batch File]

Revision as of 14:49, 28 December 2016

Command Line

Sometimes referred to as a command script, a command language is a language used for executing a series of commands that would otherwise be executed at the prompt. A good example of a command language is Microsoft Windows batch files. Although command languages are useful for executing a series of commands, their functionality is limited to what is available at the command line which can make them easier to learn.
Quick super fast course in using the command line. It is intended to be done rapidly in about a day or two, and not meant to teach you advanced shell usage.

Bash & Linux Commands

Got a bunch of .tar.gz files you want to unpack onto a server at the same time. Then this tutorial is for you.

WGET

Using PowerShell (Among other useful options listed at this resource.):
WinWGet is a GUI (Graphical User Interface) for Wget. It is FREE. It will keep track of your downloads - add, clone, edit, delete jobs.
GNU Wget is a free network utility to retrieve files from the World Wide Web using HTTP and FTP, the two most widely used Internet protocols. It works non-interactively, thus enabling work in the background, after having logged off.
Say you want to backup your blog or create a local copy of an entire directory of a web site for archiving or reading later. The command: wget -m http://website.tld
Tips for mirroring specific directories, update only changed files, etc.
Download files using curl or wget. This addon generates curl/wget commands that emulate the request as though it's coming from your browser allowing you to download protected files directly to a separate machine (e.g. server).

Windows Command Line

Cmdlets are the heart-and-soul of Windows PowerShell, Microsoft's latest command shell/scripting language.
Robocopy: A robust file copy command for the Windows command line.
Each command is linked to more info about the particular command.
The xcopy command is a Command Prompt command used to copy one or more files and/or folders from one location to another location.
This question is answered in numerous ways. Many of the answers point to useful utilities to accomplish find-and-replace.

Command Prompt

  1. Open desired directory in windows explorer.
  2. Hold down shift and right click.
  3. Select open command window here from menu.
Mounting shared drives and connecting to remote resources is something you can easily do from the Windows GUI. With our quick guide to the command prompt, however, you can more easily automate large tasks.
cd is primarily for changing directories, you're trying to change drives.
- From the command prompt type z: or cd /D z:

Console & Command Line Tools

  • Clink: Powerful Bash-style command line editing for cmd.exe
Overview: Clink combines the native Windows shell cmd.exe with the powerful command line editing features of the GNU Readline library, which provides rich completion, history, and line-editing capabilities. Readline is best known for its use in the well-known Unix shell Bash, the standard shell for Mac OS X and many Linux distributions.
Portable console emulator for Windows. “All the magic is happening through ConEmu. With enhancements from Clink.” Hat tip: Ben Keller
ConEmu-Maximus5 is a Windows console emulator with tabs, which presents multiple consoles and simple GUI applications as one customizable GUI window with various features.
Top Three: #1 cmder #2 ConEmu #3 Babun. Many others listed.

Generate File List

Example: C:\Users\me\Downloads\MyFolder> dir /b > filelist.txt
(The text in orange shows the command used once you've navigated into the directory from which you want to generate the list of file names.)
This tutorial contains several working answers for using Windows PowerShell to list files and folders.
Works with cmd.exe, but doesn't seem to work with Windows PowerShell.

Generate Folder List (No Files, Just Directories and Sub-Directories)

Try This: C:\Users\me\Downloads\MyFolder> dir /s /b /o:n /ad > folderlist.txt

Data Analysis Tools

Moved content to Data Analysis.

Databases

Includes Section: Copying Tables or Databases to Another Host:
(You can) send the output of mysqldump directly over the network to the remote MySQL server. If you can connect to both servers from the host where source database resides, use this command (Make sure you have access on both the servers):
$ mysqldump -u root -p database_name \:
| mysql -h other-host.com database_name

Educate Yourself

Also See: Data Analysis#Learn_Data_Science

Learn to Code

The Learn to Code movement has picked up momentum worldwide and that is actually a good thing as even basic programming skills can have a major impact. If you can teach yourself how to write code, you gain a competitive edge over your peers, you can think more algorithmically and thus can tackle problems more efficiently.
Lena Groeger: When I started learning to code, I was amazed by how much was out there: introductory videos, explanatory blog posts, tips and tricks and step-by-step guides. If you're a journalist who wants to make a news app or a student interested in learning to code, you have plenty of paths to choose from.

Multiple Codes

Learn to code while building a project. Free online courses include: HTML & CSS; jQuery; JavaScript; PHP; Python; Ruby; Web Projects; APIs

D3.js

d3Vienno features a series of video tutorials, each about 10-12 minutes long, on using D3.js.
D3 Tools
A Chrome-specific bookmarklet that extracts SVG nodes and accompanying styles from an HTML document and downloads them as an SVG file—A file which you could open and edit in Adobe Illustrator, for instance. Because SVGs are resolution independent, it’s great for when you want to use web technologies to create documents that are meant to be printed (like, maybe on newsprint). It was created with d3.js in mind, but it should work fine no matter how you choose to generate your SVG.

Python

Learn Data Science Online: Master data analysis from the comfort of your browser, at your own pace, tailored to your needs and expertise. Whether you want to learn R, Python or Data Visualization, we want to help!

R

Learn R & Become a Data Analyst
swirl teaches you R programming and data science interactively, at your own pace, and right in the R console!

SQL

Learn how to use SQL to store, query, and manipulate data. SQL is a special-purpose programming language designed for managing data in a relational database, and is used by a huge number of apps and organizations.
This book will teach you the 80% of SQL you probably need to use it effectively, and will mix in concepts in data modeling at the same time. If you've been fumbling around building web, desktop, or mobile applications because you don't know SQL, then this book is for you. It is written for people with no prior database, programming, or SQL knowledge, but knowing at least one programming language will help.

File Transfer

File Transfer Clients for Windows Mac

Lists several clients recommended for interoperating with OpenSSH from Mac OS machines. Note that Mac OS X includes OpenSSH by default.
SSH Clients for Windows, Mac, and Unix
Libre FTP, SFTP, WebDAV, S3 & OpenStack Swift browser for Mac and Windows.

Folder & File Compression

Example: for /d %%X in (*) do "c:\Program Files\7-Zip\7z.exe" a "%%X.zip" "%%X\"
To compress a folder without using any particular compression software.
Getting screenshots from a Mac.

Internet Relay Chat (IRC) Resources

IRC in the Cloud

Legacy app. Super simple interface.
KiwiIRC makes Web IRC easy. A hand-crafted IRC client that you can enjoy. Designed to be used easily and freely.

Maintenance

Dual Boot

Boot Disks

Rufus is an utility that helps format and create bootable USB flash drives, such as USB keys/pendrives, memory sticks, etc.

Network Issues

Post reviews various "fixes" found all over the web, and which "fix" actually worked for the post's author.
Path MTU Discovery (PMTUD) in Windows just doesn’t seem to figure out the MTU for a given path. So Windows uses the default. For the most part this doesn’t affect anyone. But failure of PMTUD will result in some websites not loading correctly, having trouble connecting to normally reliable online services and general Internet weirdness.

Print Screen / Screen Grabs / Screen Shots

In Microsoft Windows, pressing Prt Scr will capture the entire screen, while pressing the Alt key in combination with Prt Scr will capture the currently selected window.
iOS
OneShot for iOS lets you highlight screenshots of text and share them to Twitter.
Linux (Ubuntu)
Mac OS
Windows

Regular Expressions

Moved content to Data Analysis.

Rename Files & Folders

Rename Files Using REN or RENAME
- RENAME [drive:][path]filename1 filename2
- REN [drive:][path]filename1 filename2
Rename Folders: You can rename folders with the MOVE command:
- MOVE d:\path\folder1 folder2
To rename files in bulk more efficiently, you can either learn some complex shell scripting language (SED, AWK, Perl) or switch to something more simple--a spreadsheet.

Bulk Rename Files

Rename List of Files With Batch File

It's easy to rename a group of files by running a batch file (file.bat), configured something like this:

rename "Old-File_001.jpg" "New-File_001.jpg"
rename "Old-File_002.jpg" "New-File_002.jpg"
rename "Old-File_003.jpg" "New-File_003.jpg"
  1. Using a simple text editor (such as Notepad++), just create your batch file using the format shown above.
  2. Save the file as rename.bat (or similar name) in the same folder containing the files you want to rename.
  3. Double-click your batch file (e.g. rename.bat) to rename the files to the new file name.

Rename List of Folders With Batch File | Include Full Paths

It's easy to rename a group of folders located in different parent directories by running a batch file (file.bat), configured something like this:

MOVE "C:\Parent Directory One \Sub Directory\Old Folder Name" "C:\Parent Directory One \Sub Directory\New Folder Name"
MOVE "C:\Parent Directory Two \Sub Directory\Old Folder Name" "C:\Parent Directory Two \Sub Directory\New Folder Name"
MOVE "C:\Parent Directory Three \Sub Directory\Old Folder Name" "C:\Parent Directory Three \Sub Directory\New Folder Name"
A batch file contains a series of DOS commands, and is commonly written to automate frequently performed tasks. Instead of typing the same commands over and over, you can simply double-click the batch file. Writing a batch file is easier than it looks; the difficult part is making sure that everything happens in the right order. Well-made batch files can save you a lot of time over the long run, especially if you deal in repetitive tasks.
See this answer: http://stackoverflow.com/a/3808074
For help with using Regular Expressions in text file, see this answer: Regular expresion in text editor (sic)

Rename Multiple Folders / Directories With Batch File

There are a couple of pretty good answers to this question; answers that explain how the regular expression written into the .bat file actually works.

Text Editors

Mac Text Editors

Notepad++

If you go into Notepad++ and go to Edit>EOL Conversion, if allows you to convert from the current EOL to Unix-style, Windows-style, or Mac-style.
Unix is \n only
Windows is \r\n
Mac is \r only

Text Extraction

Moved content to Data Analysis.

Investigative Reporting; Journalism; General Research

Moved content to Journalism Tools.

See Also

References

Additional Resource Wiki Pages

HomeDave