Tips

Tips

Useful Cygwin commands

Service Management

Using net

Start a service

net start "screen-scraper server"

Stop a service

net stop "screen-scraper server"

Using sc

List all running services

sc query type= service

List all inactive services

sc query type= service state= inactive

List all services

sc query type= service state= all

Start a service

sc start "screen-scraper server"

Stop a service

sc stop "screen-scraper server"

Status of a service

sc query "screen-scraper server"

Run command on a remote machine

sc \\user@remotehost start "name of service"

Useful Linux commands

General

ssh into server

 ssh username@host

display manual for myprogram

 man myprogram

display help file for myprogram

 myprogram --help

go to home directory

 cd

navigate to some_path under your home directory

 cd ~/some_path

show current directory path

 pwd

print out permissions octal notation for myfile.txt

 stat -c '%n %a %A' myfile.txt

change permissions on myfile.txt

 chmod 777 myfile.txt

change group of myfile.txt to group

 chgrp group myfile.txt

change owner and group of myfile.txt

 chown user:group myfile.txt

list files, display human readable and sort by time

 ls -hlt

calculate size of folder foo and its subfolders

du -sh foo

search for the word foo in the output of ls

 ls | grep "foo"

display number of matches to the word foo

 ls | grep "foo" | wc -l

find files matching a string

 find ./* -name '*.png'

search recursively in files for "my phrase" (case insensitive) where file names match "*.txt" and list matching file name and line number of each result

 grep -ir "my phrase" *.txt

copy myfile.txt

 cp /home/user/myfile.txt /usr/local/

rename myfile.txt to myfile2.txt

 mv myfile.txt myfile2.txt

move myfile.txt one directory below and rename it

 mv myfile.txt ../myfile2.txt

forcibly remove all files and directories recursively starting at current location

 rm -f -R ./*

search for "my phrase" in all files starting at current location

 grep "my phrase" ./*

search for "my phrase" in all files and subdirectories starting at the current location

 grep -r "my phrase" ./*

list all files contained in mydir starting with the word foo

 ls -R mydir/foo*

show all running processes with java somewhere in the process string

 ps ax | grep java

kill running process 1234

 kill 1234

show where apache is installed

 whereis apache

show version number of apache

 which apache

display location of files related to apache

 locate apache

display network settings

 ifconfig

transfer a local file to another machine

 scp my-local-file.txt user@host:/path/on/server/

transfer a file from another machine to my machine

 scp user@host:/path/on/server/myfile.txt /local/path/

decompress a tar file that was compressed with gzip

 tar xvzf myfile.tar.gz

download myfile.txt from foo.com

 wget http://foo.com/myfile.txt

run myprogram

 ./myprogram

vim

create a new file or open an existing called myfile.txt

 vim myfile.txt

search for "foo"

 /foo

show next result

 n

move to bottom of document

 shift+g

enter insert/edit mode

 i

return to default view mode

 esc

quit

 :q

quit and don't save

 :q!

write and quit

 :wq

sql

login to sql using username "root" and password "root123"

 sql -uroot -proot123

list available databases

 show databases;

load database "foo"

 use foo;

list tables in database

 show tables;

show structure of table "bar"

 describe bar;

display number of records in "bar"

 select count(*) from bar;

Useful Tools

No matter how feature-equipped screen-scraper may be, there are simply some useful external tools that we use quite regularly.
Some of them are browser add-ons and features, others are actual external programs. Browser tools are listed first, followed
by some external programs you may find useful.

Tools/Add-ons for:

  • Chrome
    • SwitchyOmega

      SwitchyOmega provides a quick and easy way to switch between proxies with a strong indicator whether or not any
      proxies are in effect.
  • Firefox

    • SwitchProxy (available for Firefox 2.0)

      SwitchProxy provides a drop-down menu in the toolbar for quickly switching to and from your configured proxy
      servers. Puts itself on a toolbar.
    • FoxyProxy (available for Firefox 3.0)

      FoxyProxy, like SwitchProxy, allows for quickly switching to and from configured proxy servers. Puts itself
      in the status bar.
    • Firebug (available for Firefox 3.0)

      Firebug allows you to edit, debug, and monitor CSS, HTML, and JavaScript in realtime on any web page. It
      works out of the browser's cached files, so there is no danger of making a permanent change of any sort.
    • Tamper Data (available for Firefox 2 and 3)

      Allows you to intercept and alter information coming or leaving your browser, like request headers and POST
      parameter data.
    • Web Developer toolbar (available for Firefox 3.0)

      Adds a menu and a toolbar with various web developer tools.
    • Chinese Popup Translator (available for Firefox 3.0)

      Simply put, this extension will allow you read Chinese on websites.
    • Javascript Live HTTP (available for Firefox 2 and 3)
      This useful tool will help identify what happens when javascript is excessively used on a page.
  • Internet Explorer

    • IE7Pro Add-on (available for IE7)

      Gives Internet Explorer enhancements and optimizations for security, proxy switching, inline searching,
      spell checking, speed, many other useful tweaks.
  • Opera

    • Dragonfly (available in Opera 9.5 and higher)

      Dragonfly is Opera's official version of Firefox's Add-on "Firebug" (see above). It is built directly into
      Opera, so there is no need to download it seperately, or even update it. It is accessed through Opera's web
      servers, so updates are seen in realtime for the user.
    • Enable/Disable proxy server (option available through customization of a toolbar)

      Opera's toolbars can be customized to hold virtually any preference-toggling button, proxy server included.
      Follow the link to see how to place the option on a toolbar.

External tools for:

  • Linux

    • gedit (gnome-based, open source)

      A great utility-knife of a text editor. Can use plugins. Includes most of the features listed in the "Notepad++"
      for Windows. Comes standard with Ubuntu distributions of Linux.
    • Eclipse (Open source)

      Wretchedly confusing to configure and update at times, Eclipse is a powerful IDE written in Java. Supports
      plugins to allow dealing with code written in other languages (called 'perspectives'). Default package to
      download is the 151mb 'Eclipse Classic'. Comparable to MS Visual Studio or Netbeans.
    • Kodos Regex Debugger (Open source)

      Intended to be a regular expression debugger for Python, but works just as well for most other regex flavors,
      such as the one used by screen-scraper and Java.
  • Windows

    • Notepad++ (Open source)

      Features include zooming, multiple viewports for documents, code completion, default and user-defined source
      highlighting, code folding, macro recording, file updating when changed externally, saving sessions, auto
      indent, regular expression find/replace, line numbers, etc.
    • Editpad Lite (Freeware, 'Pro' version available)

      Lightweight text editor. Simply beats out Notepad. Lacks almost all of the features listed above, unless
      you buy the full version ($50). Does, however, do line numbers, 'go to line x', Windows
      <-> Mac
      <-> Linux line breaks, and an auto-indent feature.
    • Eclipse (Open source)

      Wretchedly confusing to configure and update at times, Eclipse is a powerful IDE written in Java. Supports
      plugins to allow dealing with code written in other languages (called 'perspectives'). Default package to
      download is the 151mb 'Eclipse Classic'. Comparable to MS Visual Studio or Netbeans.
    • Kodos Regex Debugger (Open source)

      Intended to be a regular expression debugger for Python, but works just as well for most other regex flavors,
      such as the one used by screen-scraper and Java.
    • Large Text File Viewer Application (Free)

      This is a very useful application for opening text files that are much too large to be opened with regular
      text editors. It can open text files that are several gigabytes in size with ease, which can be particularly
      helpful for viewing large log files.
  • Mac OS X

    • Eclipse (Open source)

      Wretchedly confusing to configure and update at times, Eclipse is a powerful IDE written in Java. Supports
      plugins to allow dealing with code written in other languages (called 'perspectives'). Default package to
      download is the 151mb 'Eclipse Classic'. Comparable to MS Visual Studio or Netbeans.
    • Kodos Regex Debugger (Open source)

      Intended to be a regular expression debugger for Python, but works just as well for most other regex flavors,
      such as the one used by screen-scraper and Java.
  • Decompilers

    • showmycode.com (Free, hosted)

      Online SWF & Java Class decompiler. Have only tested on a few SWF files with mixed results.