Avatar for Feedage Forager
Feedage Fora...
Rating: 83
Member since: 2009-07-24
Feeds: 1
Share |
Subscribe: IT diary - Stuff that works
Energy in code ... http://ysgitdiary.blogspot.com/feeds/posts/default?alt=rss
Added By: Feedage Forager Feedage Grade A rated
Language: English
Tags:
background color  cmd  color csharpcode  color  csharpcode  current  echo  file  files  line  runlog  start  user  windows 
Rate this Feed
Rate this feedRate this feedRate this feedRate this feedRate this feed
Rate this feed 1 starRate this feed 2 starRate this feed 3 starRate this feed 4 starRate this feed 5 star

Comments (0)

Feed Details and Statistics Feed Statistics
Sponsored Links:
Preview: IT diary - Stuff that works

Energy in code ...



Perl and C# Code , TSQL , Teradata SQL, cmd batch scripts, Sh and bash scripts , Oracle , MySql some old Java stuff , Linux , Sun Solaris , NSIS , VB 6.0 , some old Essbase VB API in non-user friendly fashion + occasionally strong statements and opinio



Last Build Date: Fri, 03 Feb 2012 19:05:45 +0000

 



Perl Special Vars quick reference

Fri, 03 Feb 2012 19:05:00 +0000

source: Perl MonksSpecial Vars Quick Reference$_ The default or implicit variable.@_ Subroutine parameters.$a$b sort comparison routine variables.@ARGV The command-line args.Regular Expressions$ Regexp parenthetical capture holders.$& Last successful match (degrades performance).${^MATCH} Similar to $& without performance penalty. Requires /p modifier.$` Prematch for last successful match string (degrades performance).${^PREMATCH} Similar to $` without performance penalty. Requires /p modifier.$' Postmatch for last successful match string (degrades performance).${^POSTMATCH} Similar to $' without performance penalty. Requires /p modifier.$+ Last paren match.$^N Last closed paren match (last submatch).@+ Offsets of ends of successful submatches in scope.@- Offsets of starts of successful submatches in scope.%+ Like @+, but for named submatches.%- Like @-, but for named submatches.$^R Last regexp (?{code}) result.${^RE_DEBUG_FLAGS} Current value of regexp debugging flags. See use re 'debug';${^RE_TRIE_MAXBUF} Control memory allocations for RE optimizations for large alternations.Encoding${^ENCODING} The object reference to the Encode object, used to convert the source code to Unicode.${^OPEN} Internal use: \0 separated Input / Output layer information.${^UNICODE} Read-only Unicode settings.${^UTF8CACHE} State of the internal UTF-8 offset caching code.${^UTF8LOCALE} Indicates whether UTF8 locale was detected at startup.IO and Separators$. Current line number (or record number) of most recent filehandle.$/ Input record separator.$| Output autoflush. 1=autoflush, 0=default. Applies to currently selected handle.$, Output field separator (lists)$\ Output record separator.$" Output list separator. (interpolated lists)$; Subscript separator. (Use a real multidimensional array instead.)Formats$% Page number for currently selected output channel.$= Current page length.$- Number of lines left on page.$~ Format name.$^ Name of top-of-page format.$: Format line break characters$^L Form feed (default "\f").$^A Format AccumulatorStatus Reporting$? Child error. Status code of most recent system call or pipe.$! Operating System Error. (What just went 'bang'?)%! Error number hash$^E Extended Operating System Error (Extra error explanation).$@ Eval error.${^CHILD_ERROR_NATIVE} Native status returned by the last pipe close, backtick (`` ) command, successful call to wait() or waitpid(), or from the system() operator.ID's and Process Information$$ Process ID$< Real user id of process.$> Effective user id of process.$( Real group id of process.$) Effective group id of process.$0 Program name.$^O Operating System name.Perl Status Info$] Old: Version and patch number of perl interpreter. Deprecated.$^C Current value of flag associated with -c switch.$^D Current value of debugging flags$^F Maximum system file descriptor.$^I Value of the -i (inplace edit) switch.$^M Emergency Memory pool.$^P Internal variable for debugging support.$^R Last regexp (?{code}) result.$^S Exceptions being caught. (eval)$^T Base time of program start.$^V Perl version.$^W Status of -w switch${^WARNING_BITS} Current set of warning checks enabled by use warnings;$^X Perl executable name.${^GLOBAL_PHASE} Current phase of the Perl interpreter.$^H Internal use only: Hook into Lexical Scoping.%^H Internaluse only: Useful to implement scoped pragmas.${^TAINT} Taint mode read-only flag.${^WIN32_SLOPPY_STAT} If true on Windows stat() won't try to open the file.Command Line ArgsARGV Filehandle iterates over files from command line (see also <>).$ARGV Name of current file when reading <>@ARGV List of command line args.ARGVOUT Output filehandle for -i switchMiscellaneous@F Autosplit (-a mode) recipient.@INC List of library paths.%INC Keys are filenames, values are paths to modules included via use, require, or do.%ENV Hash containing current environment variables%SIG Signal handlers.$[ Array and substr first element (Deprecated!). See perlvar for detailed descriptions of each of these (and a few more) special variables. When modifiyin[...]



one reason more to dislike svn

Fri, 03 Feb 2012 10:07:00 +0000

Before shooting me for all the rational reasons to have your code under source control .... Listen:

- Any developer should have 100% control over the source code of the instance of the project he is working on
- Any binary messing with that control is EVIL. Perioid

I have seen it with Microsoft Visual Studio. I saw it today with svn  - it messes the permissions of the projects so that you will not be able copy , move or edit FULLY from your source root dir and bellow.

And because of this EVIL I do have the templatize feature in the morphus project, which might introduce rare nasty bugs from time to time but provides me with independance without hiding and EVIL.




morphus.1.1.4.dev.ysg.zip out

Thu, 12 Jan 2012 13:43:00 +0000

morphus.1.1.4.dev.ysg.zip out



how-to start apache on x64 window with a batch script

Thu, 12 Jan 2012 11:51:00 +0000

.csharpcode, .csharpcode pre{ font-size: small; color: black; font-family: Consolas, "Courier New", Courier, Monospace; background-color: #ffffff; /*white-space: pre;*/}.csharpcode pre { margin: 0em; }.csharpcode .rem { color: #008000; }.csharpcode .kwrd { color: #0000ff; }.csharpcode .str { color: #a31515; }.csharpcode .op { color: #0000c0; }.csharpcode .preproc { color: #cc6633; }.csharpcode .asp { background-color: #ffff00; }.csharpcode .html { color: #800000; }.csharpcode .attr { color: #ff0000; }.csharpcode .alt { background-color: #f4f4f4; width: 100%; margin: 0em;}.csharpcode .lnum { color: #606060; }:: next_line_is_templatized::File:StartApache.cmd:: disable the echo@echo off :: this is part of the name of the file - not usedset Action=start :: which component are we going to startset Component=apache  :: the name of the Product next_line_is_templatizedset ProductName=morphus :: the version of the current Product next_line_is_templatizedset ProductVersion=1.1.3 :: could be dev , test , dev , prod next_line_is_templatizedset ProductType=dev :: who owns this Product / environment next_line_is_templatizedset ProductOwner=ysg :: identifies an instance of the tool ( new instance for this version could be created by simply changing the owner ) set EnvironmentName=%ProductName%.%ProductVersion%.%ProductType%.%ProductOwner% :: where the Apache binaries are installedset ApacheBinDir="C:\Program Files (x86)\Apache Software Foundation\Apache2.2\" :: the full path to the Apache binaryset ApacheBin="C:\Program Files (x86)\Apache Software Foundation\Apache2.2\bin\httpd.exe" :: the full path to the http.confset HttpdConf="C:\Program Files (x86)\Apache Software Foundation\Apache2.2\conf\httpd.conf" :: the full path to the set ApacheWorkingDir="C:\Program Files (x86)\Apache Software Foundation\Apache2.2\."  :: go the run dircd %~dp0 :: do 4 times going upfor /L %%i in (1,1,5) do pushd .. :: The BaseDir is 4 dirs up than the run dirset ProductBaseDir=%CD%:: debug echo BEFORE ProductBaseDir is %ProductBaseDir%:: remove the trailing \IF %ProductBaseDir:~-1%==\ SET ProductBaseDir=%ProductBaseDir:~0,-1%:: debug echo AFTER ProductBaseDir is %ProductBaseDir%:: debug pause  :: The version directory of the Product set ProductVersionDir=%ProductBaseDir%\%ProductName%\%EnvironmentName%  :: where the error logs of this call are situated set ErrorLog=%ProductVersionDir%\data\log\StartApache.cmd.Error.%ProductName%.cmd.log :: where the running of this set RunLog=%ProductVersionDir%\data\log\StartApache.cmd.%ProductName%.cmd.log :: define a favorite editor set MyEditor=textpad ECHO Check the variables  :: truncate the run logecho date is %date% time is %time% > %RunLog% :: truncate the error logecho date is %date% time is %time% > %ErrorLog% :: uncomment this to debug all the vars :: debug set >> %RunLog% :: go to the Apache bin dircd %ApacheBinDir% :: now open the run logcmd /c start /max %MyEditor% %RunLog%  :: Action !!!echo CFPoint1 OK The run cmd script %0 is executed >> %RunLog%echo CFPoint2 OK The run cmd script %0 starts the apache binary with STDOUT and STDERR to a single RunLog file >> %RunLog%:: perl %PerlScript% %IniFile% >>%RunLog% %ApacheBin% -w -f %HttpdConf% -d %ApacheWorkingDir% >>%RunLog% 2>&1 :: open the run logcmd /c start /max %MyEditor% %RunLog% :: uncomment this line to wait for 5 seconds:: ping localhost -n 5 :: uncomment this line to see what is happening :: PAUSE :: Requirements: :: This script requires perl , text editor supporting <> <> cmd call syntax  :: VersionHistory:: 0.1.0 --- ysg --- Initial creation copy from run-morphus  [...]



how-to setup non-password requiring connection between a win and *nix box with putty ...

Thu, 12 Jan 2012 11:48:00 +0000


1. Install Cygwin
2. Install separately the ssh-keygen ( or sshd ) on cygwin
3. Download the puttycfg , unzip to a dir in your Windows path
4. Find out where cygwin1.dll is installed cygcheck -sd >list.txt
5. Open the list.txt ( it is quite big ) : notepad list.txt
6. Copy all the files from   C:\temp\something  to the dir where the cygwin1.dll is located
7. Start the putty.exe : Start - Run : cmd /c START  /max putty
8. In the GUI , check that Session on the Left is selected , click on Cygterm option , for hostName type - , leave port number 22
9. Open the puttycfg :
10. Generate the public and private key's :
11. ssh-keygen -t rsa
12. Type Enter,Enter
13. Now here is the tricky part you have to tell also putty that the public and private key files are the one you want to use with you : Copy the /home/<>/id_rsa and ..id_rsa.pub to the dir where your save your putty conf in my case: C:\Temp\ysg\conf\<>\putty\ssh
14. Start - Run - type puttygen
15. Load the copied private key file and save it as <> , save also the public key file
16. Copy the id_rsa.pub file to the server's ~ dir
17. cp -vr /home/username/.ssh/ .
18. On the server cat id_rsa.pub >> ~/.ssh/authorized_keys
19. Now when started from the windows client :
cmd /c START  /max putty  username@servername.domain.com no password should be asked




bad software design sucks !?

Mon, 26 Dec 2011 21:47:00 +0000

Why ?
Because it does not reflect the real-world properly.

Think about the guys having designed the statistical software for USA


"A prominent example is President Barack Obama’s decision to not identify his multiracial ancestry on the 2010 Census Survey. Half white, Obama selected the “black” box option."

, BUT HEY WHAT ARE THE OPTIONS ?

So they are checking the “white,” “black” or “Asian” boxes.

Give me a break!!! The most multi-ethnical country in the world, and the db designers did not bother to put some more options ...









Edison vs . Tesla

Fri, 16 Dec 2011 20:36:00 +0000


It is strange that the famous quote from Thomas Edison :
"I have not failed, I've just found ten thousand ways that won't work."

gets entirely new meaning after the words of his worst non-business competitor Nikola Tesla about him:

He had no hobby, cared for no sort of amusement of any kind and lived in utter disregard of the most elementary rules of hygiene  ... His method was inefficient in the extreme, for an immense ground had to be covered to get anything at all unless blind chance intervened and, at first, I was almost a sorry witness of his doings, knowing that just a little theory and calculation would have saved him 90 percent of the labor. But he had a veritable contempt for book learning and mathematical knowledge, trusting himself entirely to his inventor's instinct and practical American sense



how-to get nice file sizes with du and perl

Wed, 07 Dec 2011 19:16:00 +0000

du -BK /cygdrive/f/morphus/morphus.1.0.7.dev.ysg/ | perl -ne 'm/(\d{1,9})K(\s+)(.*?)(morphus\.)(.*)/; printf("%9d %3s %-100s \n" , $1 , " " , "$4" . "$5") ;' | sort -nr | less




Sat, 03 Dec 2011 08:39:00 +0000

Cool programs , utilities and programming environments for Windows, most of which free ( revised ) Opera - simply the best browser on the planet Google Chrome Firefox strawberry perl for Windows (with dmake for modules ) Cygwin SysInternals Suiteizarc - the best zipper Process Explorer - shows resources usage per running process on Windows Google Earth Picasa - the best free picture viewer , organizer Mozilla Thunderbird Textpad - the best text editor for Windows FreeMind - mind maps freware smstoolpack - create CRUD for sql server GreenShotOpen diff - tool for comparing sql server 2005 databases Skype - the best client for Internet and Video Telephony NSIS - the best open source Windows installer maker And the time plugin Gears -- edit online documents offline Free youtube to ipod converter -- get mp4 files easily to your phone Defragler - Disk Defragment utility DvdDecrypter - the best DVD free ripper ImgBurner - burn ISO images - freeware ArsClip remembers your clibboard stuff - Hint , Ctrl + Shift + Z , 2 colorpic - Color to hex utility Expresso - a GUI tool for building and verifying Regular Expressions a flv file player Python - for cool scripts and programming STARUML - the best open source UML editor Infrarecorder - free CD / DVD burner Paint.Net - freeware image editor putty winscp Multiline Search and Replace utility program Google Gears - use Gmail offline HijackThis tortoise svn - a stable gui and command line to subversion for Windows slik svn - the command line tools for svn for windows Data Recovery - recover Shift + del removed programs Windows Sysinternal utilities Cmdow is a Win32 commandline utility for NT4/2000/XP/2003 that allows windows to be listed, moved, resized, renamed, hidden/unhidden, disabled/enabled, minimized, maximized, restored, activated/inactivated, closed, killed and more. Grep , FGrep and Egrep for windows (remember the dll's also ) Less for Windows ( remember the dll's also ) 7-zip Rise Editor - Entity Relationship Diagram tool Adobe Acrobat Virtual Clone Drive - Map ISO files svn client and server Doxygen - code documentation utility Qt - Nokia's Development Platform Dia - control flow chars freeware software AudioGrabber - the best mp3 ripper AutoHotKey - GUI automating Fiddler - http sniffer Windows GNU utils Active Perl Safari - [...]



how-to display human readable file sizes on HP-UX

Tue, 15 Nov 2011 08:52:00 +0000

# how-to display human readable file sizes on systems with stupid du# of course you would have to have perlfind `pwd` -type f -exec du -k {} \; | perl -ne 'split /\s+/;my $SizesInMegs=$_[0]/1024;printf ( "%10d %10s \n" , "$SizesInMegs" , "MB $_[1]")' | sort -nr | more



No can do ! I could only admire my new gmail theme

Sun, 06 Nov 2011 18:29:00 +0000




how-to find out who was lately on my server via ssh

Thu, 03 Nov 2011 08:39:00 +0000

# who the f..k was here find /var/log/ -name secure* | sort -n | xargs grep -nHP 'session opened for user' | less



Linux / Unix Cheat Sheet

Wed, 26 Oct 2011 07:02:00 +0000

.csharpcode, .csharpcode pre{ font-size: small; color: black; font-family: Consolas, "Courier New", Courier, Monospace; background-color: #ffffff; /*white-space: pre;*/}.csharpcode pre { margin: 0em; }.csharpcode .rem { color: #008000; }.csharpcode .kwrd { color: #0000ff; }.csharpcode .str { color: #006080; }.csharpcode .op { color: #0000c0; }.csharpcode .preproc { color: #cc6633; }.csharpcode .asp { background-color: #ffff00; }.csharpcode .html { color: #800000; }.csharpcode .attr { color: #ff0000; }.csharpcode .alt { background-color: #f4f4f4; width: 100%; margin: 0em;}.csharpcode .lnum { color: #606060; }# FilF:NixCheatSheet.sh v.1.3.0 docs at the end  # how-to get a nice prompt on HP-AIXclear;export PS1=$USER'@'`hostname`:$PWD:`echo ``date +%Y.%m.%d-%H:%M:%S`` `:`echo "\n" $ " "`; clear;  # who , where and whenuname -a ;id;date +%Y.%m.%d-%H:%M:%S;# all env vars starting with _env | grep -e "^_"  ls -lt --time-style=long-iso ls -alt --time-style=long-iso  # http://www.gnu.org/software/findutils/manual/html_mono/find.html# The ultimate "find in files"find /etc/httpd/ -type f -print0 | xargs --null grep -nHP 'StartServers\s+\d' | less find / -name '*bash*' -exec grep -nHP '*APerlRegex*' {} \;  # or even faster , be aware of funny file names xargs -0find / -name '*bak' -print0 | xargs --null grep -nPH 'curl' # find and replace recursivelyfind . -name '*.html' -print0 | xargs -0 perl -pi -e 's/foo/bar/g' # find all the files greather than 100 MB , sort them by the size and print their sizes find / -type f -size +100M -exec du -B M {} \; | sort -r | less  # disk usage of users under the /home directory in MBclear;du -all -m --max-depth=3 /home | sort -n -r | less # where I have been lately ?history | grep cd # what I have opening recently history | grep vi #send my history history | mailx -s "my history" $MyEmailtcpdump dst 10.168.28.22 and tcp port 22tcpdump dst 172.21.212.212 # record the current session via scriptmkdir ~/scriptlogsscript -a /scriptlogs/`date +%Y%m%d%H%M%S`_script.log #/usr/bin is for normal user executables, /usr/sbin is for superuser executables, /usr/sfw is for external software (like gnu one), but provided with bundle of OS, /usr/ccs is for development utilities, usually not need for daily tasks like make, lex, yacc, sccs   # take the last 5 commands for faster execution to the temp execution scripttail -n 5 /root/.bash_history >> /var/run.sh # I saw the command cd /to/some/suching/dir/which/was/very/long/to/typeecho so I redid it and saved my fingers!345 history >history.txt ---- # the last 1000 commands into a history.txt file # send that file to myself cat history.txt | mail -s "test file sending" -c mail1@comyordan.georgiev(boom)gmail.com # remove all trealing spaces from the history file works for TextPad ^([ ]*)([0-9]*)(.*)$ \3 --- replace with the pure commands history | gawk -F1 'BEGIN {FS=" "};{print $2 , $3}' | less # display the history withouth the line numbers ... history | perl -i -pe 's/^([ ]*)([0-9]*)(.*)$/$3/gi' vi fileName anotherFile # how to deal with command outputscommand | filtercommand > command_output.txt 2>errors_from_command.txt # Hint after the less filter pressing s will prompt you for saving theoutput to a file ... # find the files having os somewhere in their names and only those having linuxfind . -name '*os*' | grep linux | less # find all xml type of files and display only the rows having wordToFindInRowfind . -name '*.xml' -exec cat {} \;| grep wordToFindInRow | less # putty , bash shortcuts Ctrl + A --- Go to the beginning of the line you are currently typing onCtrl + E --- Go to the end of the line you are currently typing on # how-to mount an u[...]



how-to start putty from the command line with pre-saved session

Wed, 26 Oct 2011 06:33:00 +0000

:: Start - Run - type cmd /c START /max putty -load userName@ServerHostName.Domain.comNow if you would like to export your putty settings from PC to PC you could use the following cmd for that :(Hint: I use to Have the following folder structure C:\Temp\\conf\\conf\putty ) Now is var and is var ... thus you could keep all the PC's settings always with you ; ) .csharpcode, .csharpcode pre{ font-size: small; color: black; font-family: Consolas, "Courier New", Courier, Monospace; background-color: #ffffff; /*white-space: pre;*/}.csharpcode pre { margin: 0em; }.csharpcode .rem { color: #008000; }.csharpcode .kwrd { color: #0000ff; }.csharpcode .str { color: #006080; }.csharpcode .op { color: #0000c0; }.csharpcode .preproc { color: #cc6633; }.csharpcode .asp { background-color: #ffff00; }.csharpcode .html { color: #800000; }.csharpcode .attr { color: #ff0000; }.csharpcode .alt { background-color: #f4f4f4; width: 100%; margin: 0em;}.csharpcode .lnum { color: #606060; }@ECHO OFFECHO any comments suggestions are welcome at : ECHO http://ysgitdiary.blogspot.com/search/label/PuttyECHO This batch file copies some the needed settings of PuttyECHO it depends on a simple GetNiceTime_on_%computername%.cmd ECHO batch file producing the %_NICETIME% variable in YYYYMMDD_hhmmss ECHO formatECHO Tested on Win7 64 -bit Putty ECHO you should call this batch file from its current directorry :: GET A YYYYMMDD_hhmmss TIMESTAMPcall GetNiceTime_on_%computername%.cmd SET _RegFileWithSettings=PuttySettings_Helios_on_%COMPUTERNAME%_%NiceTime%.regSET _RunLog=%0.run.logSET _ErrorLog=%0.error.log::SET _PuttySynFilesDirOnWin64=%ProgramFiles(x86)%\Putty 5\system::SET _PortableSynFilesDir=%CD%\systemSET _RegistryKey=HKEY_CURRENT_USER\Software\SimonTathamSET _RegistryFilesDir=%CD%\regSET _RegistryFileWithSettings=%_RegistryFilesDir%\PuttySettings_on_%computername%_%NiceTime%.regSET _LogDir="%CD%\log"  ECHO START REGISTRY SETTINGS EXPORT AT %_NiceTime%ECHO RUN LOG : START REGISTRY SETTINGS EXPORT AT %_NiceTime% >%_RunLog%ECHO ERROR LOG START REGISTRY SETTINGS EXPORT AT %_NiceTime% >%_ErrorLog%ECHO.1>>%_RunLog% 2>> %_ErrorLog% ECHO create a directory called sysm in the current directory ECHO create a directory called sysm in the current directory 1>>%_RunLog% 2>> %_ErrorLog% ECHO.1>>%_RunLog% 2>> %_ErrorLog% ECHO now copy alls the files from the %Program Files(x86)%\Putty 5\system\ ECHO now copy alls the files from the %Program Files(x86)%\Putty 5\system\ 1>>%_RunLog% 2>> %_ErrorLog% ECHO IF NOT EXIST %_PortableSynFilesDir% MKDIR %_PortableSynFilesDir% 1>>%_RunLog% 2>> %_ErrorLog%:: IF NOT EXIST %_PortableSynFilesDir% MKDIR %_PortableSynFilesDir% 1>>%_RunLog% 2>> %_ErrorLog%ECHO.1>>%_RunLog% 2>> %_ErrorLog% ECHO COPY EACH syn files :: for /f "tokens=*" %%i in (' dir "%_PuttySynFilesDirOnWin64%\*.syn" /s /b') do copy /y "%%i" "%_PortableSynFilesDir%" 1>>%_RunLog% 2>> %_ErrorLog%ECHO.1>>%_RunLog% 2>> %_ErrorLog% :: CREATE THE _RegistryFilesDir if it does not exist ECHO IF NOT EXIST %_RegistryFilesDir% MKDIR %_RegistryFilesDir% 1>>%_RunLog% 2>> %_ErrorLog%IF NOT EXIST %_RegistryFilesDir% MKDIR %_RegistryFilesDir% 1>>%_RunLog% 2>> %_ErrorLog%ECHO.1>>%_RunLog% 2>> %_ErrorLog% :: NOW PERFORM THE ACTUAL EXPORT OF THE CURRENT SETTINGSECHO REG EXPORT "%_RegistryKey%" "%_RegistryFileWithSettings%" 1>>%_RunLog% 2>> %_ErrorLog%REG EXPORT "%_RegistryKey%" "%_RegistryFileWithSettings%" ECHO IF NOT EXIST %_LogDir% MKDIR %_LogDir% 1>>%_RunLog% 2>> %_ErrorLog%IF NOT EXIST %_LogDir% MKDIR %_LogDir% [...]



Next gen EV ...

Wed, 12 Oct 2011 18:46:00 +0000

frameborder='0' scrolling='no' align='middle' SRC='http://mediasuite.multicastmedia.com/player.php?v=jov5h3s3' height='258' width='336' allowtransparency='true'>




Tue, 11 Oct 2011 19:25:00 +0000

Cool programs , utilities and programming environments for Windows, most of which free ( revised ) Opera - simply the best browser on the planet Google Chrome Firefox strawberry perl for Windows (with dmake for modules ) Cygwin SysInternals Suiteizarc - the best zipper Process Explorer - shows resources usage per running process on Windows Google Earth Picasa - the best free picture viewer , organizer Mozilla Thunderbird Textpad - the best text editor for Windows smstoolpack - create CRUD for sql server GreenShotOpen diff - tool for comparing sql server 2005 databases Skype - the best client for Internet and Video Telephony NSIS - the best open source Windows installer maker And the time plugin Gears -- edit online documents offline Free youtube to ipod converter -- get mp4 files easily to your phone Defragler - Disk Defragment utility DvdDecrypter - the best DVD free ripper ImgBurner - burn ISO images - freeware ArsClip remembers your clibboard stuff - Hint , Ctrl + Shift + Z , 2 colorpic - Color to hex utility Expresso - a GUI tool for building and verifying Regular Expressions a flv file player Python - for cool scripts and programming STARUML - the best open source UML editor Infrarecorder - free CD / DVD burner Paint.Net - freeware image editor putty winscp Multiline Search and Replace utility program Google Gears - use Gmail offline HijackThis tortoise svn - a stable gui and command line to subversion for Windows slik svn - the command line tools for svn for windows Data Recovery - recover Shift + del removed programs Windows Sysinternal utilities Cmdow is a Win32 commandline utility for NT4/2000/XP/2003 that allows windows to be listed, moved, resized, renamed, hidden/unhidden, disabled/enabled, minimized, maximized, restored, activated/inactivated, closed, killed and more. Grep , FGrep and Egrep for windows (remember the dll's also ) Less for Windows ( remember the dll's also ) 7-zip Rise Editor - Entity Relationship Diagram tool Adobe Acrobat Virtual Clone Drive - Map ISO files svn client and server Doxygen - code documentation utility Qt - Nokia's Development Platform Dia - control flow chars freeware software AudioGrabber - the best mp3 ripper AutoHotKey - GUI automating Fiddler - http sniffer Windows GNU utils Active Perl Safari - [...]






Sh Cheat Sheet

Sat, 01 Oct 2011 19:34:00 +0000

.csharpcode, .csharpcode pre{ font-size: small; color: black; font-family: Consolas, "Courier New", Courier, Monospace; background-color: #ffffff; /*white-space: pre;*/}.csharpcode pre { margin: 0em; }.csharpcode .rem { color: #008000; }.csharpcode .kwrd { color: #0000ff; }.csharpcode .str { color: #006080; }.csharpcode .op { color: #0000c0; }.csharpcode .preproc { color: #cc6633; }.csharpcode .asp { background-color: #ffff00; }.csharpcode .html { color: #800000; }.csharpcode .attr { color: #ff0000; }.csharpcode .alt { background-color: #f4f4f4; width: 100%; margin: 0em;}.csharpcode .lnum { color: #606060; }#File:ShCheatSheet.sh v.1.1.0 docs at the end #source:http://www.dartmouth.edu/~rc/classes/ksh/index.html#for loop examplefor file in * ; do echo Processing $file ; done ;  for file in `ls -1` ; do echo Processing $file ; done ;  #if example  if [ -r $myfile ]then cat $myfileelse echo $myfile not readablefi #case example  case $filename in*.dat)echo Processing a .dat file;;*.sas)echo Processing a .sas file;;*)# catch anything else that doesn't match patternsecho "Don't know how to deal with $filename";;esac  *Matches any zero or more characters. ?Matches any one character. [string]Matches exactly one character that is a member of the string string. This is called a character class. As a shorthand, string may contain ranges, which consist of two characters with a dash between them. For example, the class ‘[a-z0-9_]’ matches a lowercase letter, a number, or an underscore. You can negate a class by placing a ‘!’ or ‘^’ immediately after the opening bracket. Thus, ‘[^A-Z@]’ matches any character except an uppercase letter or an at sign. \Removes the special meaning of the character that follows it. This works even in character classes. # while example count=0max=10while [[ $count -lt $max ]] ; do echo $count ; count=$((count + 1)) ; done ; echo "Value of count after loop is: $count"   wlog(){ echo "`date +%Y.%m.%d-%H:%M:%S` [$$] $*" >> $LOGFILE test -t 1 && echo "$*"} send_mail(){ # $1 = subject # $* = recipients # - = text test -z "$2" && { wlog "NOTICE: no mail recipients" return 0 } _sm_s="$1" shift 1 mailx -s "$_sm_s" $* || { wlog "ERROR: Failed to send mail to $*" return 1 } return 0} #get a nice date`date +%Y%m%d%H%M%S` outgoing_dirs=`find $ROOTDIR -type d -name 'outgoing'` for odir in $outgoing_dirsdo test -d "$odir" || continue find $odir -type f -mtime $MAXAGE -print0 | xargs --null -r $debug rmdone #The ultimate find in files DirToSearch=/var/log/FilesToSearch=`ls -rt $DirToSearch`for file in $FilesToSearchdo file=$DirToSearch/$file test -f "$file" || continue grep -nH 'sekauppi' $file done  find $DirToSearch -type f -exec grep -nH 'yogeorgi' {} \; | less  today=`date +%Y%m%d`yesterday=`date --date yesterday +%Y%m%d` Help(){ cat<



mysql cheat sheet

Sat, 01 Oct 2011 19:25:00 +0000

.csharpcode, .csharpcode pre{ font-size: small; color: black; font-family: Consolas, "Courier New", Courier, Monospace; background-color: #ffffff; /*white-space: pre;*/}.csharpcode pre { margin: 0em; }.csharpcode .rem { color: #008000; }.csharpcode .kwrd { color: #0000ff; }.csharpcode .str { color: #006080; }.csharpcode .op { color: #0000c0; }.csharpcode .preproc { color: #cc6633; }.csharpcode .asp { background-color: #ffff00; }.csharpcode .html { color: #800000; }.csharpcode .attr { color: #ff0000; }.csharpcode .alt { background-color: #f4f4f4; width: 100%; margin: 0em;}.csharpcode .lnum { color: #606060; }-- File:MySqlCheatSheet.sql v.1.1.0 docs at the end  /* [mysql dir] *//bin/mysql -h hostname -u root -p  mysql -u userName -p -D DbName -B -e "select * from users;" > /home/yogeorgi/tmp/list.csv ;mysql -u userName -p -D information_schema -B -e "select columns from columns;" > /home/yogeorgi/tmp/list.csv ; -- Batch mode (feeding in a script): mysql -u user -p < batch_file/* (Use -t for nice table layout and -vvv for command echoing.) */-- Alternatively: source batch_file;  -- List all databases on the mysql server. show databases; /* Switch to a database. */use [db name]; -- get all the tables in the currently selected database show tables; -- get the table's fields format describe [TableName]; -- to remove a dbdrop database [database name]; -- to drop a table drop table [TableName]; /* Show all data in a table. */SELECT * FROM [TableName]; /* Returns the columns and column information pertaining to the designated table. */show columns from [TableName]; /* Show certain selected rows with the value "whatever". */SELECT * FROM [TableName] WHERE [field name] = "whatever"; /* Show all records containing the name "Bob" AND the phone number '3444444'. */SELECT * FROM [TableName] WHERE name = "Bob" AND phone_number = '3444444'; /* Show all records not containing the name "Bob" AND the phone number '3444444' order by the phone_number field. */SELECT * FROM [TableName] WHERE name != "Bob" AND phone_number = '3444444' order by phone_number; /* Show all records starting with the letters 'bob' AND the phone number '3444444'. */SELECT * FROM [TableName] WHERE name like "Bob%" AND phone_number = '3444444'; -- Use a regular expression to find records. Use "REGEXP BINARY" to force case-sensitivity. -- This finds any record beginning with a. SELECT * FROM [TableName] WHERE rec RLIKE "^a$"; -- how-to show only unique records. SELECT DISTINCT [column name] FROM [TableName]; /* Show selected records sorted in an ascending (asc) or descending (desc). */SELECT [col1],[col2] FROM [TableName] ORDER BY [col2] DESC; /* Return number of rows. */SELECT COUNT(*) FROM [TableName]; /* Sum column. */SELECT SUM(*) FROM [TableName]; /* Join tables on common columns. */ select lookup.illustrationid, lookup.personid,person.birthday from lookupleft join person on lookup.personid=person.personid=statement to join birthday in person table with primary illustration id; /* Switch to the mysql db. Create a new user. */ INSERT INTO [TableName] (Host,User,Password) VALUES('%','user',PASSWORD('password')); -- Change a users password.(from unix shell). [mysql dir]/bin/mysqladmin -u root -h hostname.blah.org -p password 'new-password' -- Change a users password.(from MySQL prompt).SET PASSWORD FOR 'user'@'hostname' = PASSWORD('passwordhere'); /* Allow the user "bob" to connect to the server from localhost using the passwo[...]



win registry cheat sheet

Sat, 01 Oct 2011 18:38:00 +0000


Windows Registry Editor Version 5.00
;File:WinRegistryCheatSheet.reg : v1.1.0 docs at the end
;HOW TO IMPORT SILENTLY A REGISTRY FROM A FILE

;REMEMBER TO SAVE ALLWAYS YOUR REG FILES IN ANSI
;reg import /s C:\temp\the_name_of_the_file.reg
;HOW TO GO TO SPECIFIC KEY
;DOWNLOAD REGJUMP regjump "[HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\TypedURLs]"


;PUT THE NAME OF THE COMMANDS YOU WOULD LIKE NOT TO TYPE
;FROM THE START - RUN
[HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\TypedURLs]
"url1"="firefox http://www.youtube.com/my_playlists"
"url2"="firefox http://gmail.google.com"
"url3"="C:\\Program Files\\Opera\\opera.exe g toSearch"
"url4"="firefox http://www.google.com/search?hl=en&q= typeHereTheWordToSearch"
;Note the space before typeHereTheWordToSearch if yount to have several words
;ANOTHER CACHE FOR THE RUN MENU
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\RunMRU]
"a"="shutdown -f -s -t 00"
"b"="shutdown -f -r -t 00"
"c"="shutdown -f -h -t 00"
"d"="opera g toSearch"


;THE FOLLOWING ARE HISTORY KEYS, FOR TYPED URLS ,LAST DOCUMENTS ETC
[HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\TypedURLs]
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\RunMRU]
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\RecentDocs]
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\ComDlg32\LastVisitedMRU]
[HKEY_CURRENT_USER\Software\Microsoft\Search Assistant\ACMru]

[HKEY_CLASSES_ROOT\*\shell\cmdhere]
@="Cmd&Here"

[HKEY_CLASSES_ROOT\*\shell\cmdhere\command]
@="cmd.exe /c start cmd.exe /k pushd \"%L\\..\""

[HKEY_CLASSES_ROOT\Folder\shell\cmdhere]
@="Cmd&Here"

[HKEY_CLASSES_ROOT\Folder\shell\cmdhere\command]
@="cmd.exe /c start cmd.exe /k pushd \"%L\""

;add a command line functionality from Start - Run with Opera on Windows
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\opera.exe]
@="C:\\Program Files\\Opera\\opera.exe"
"Path"="C:\\Program Files\\Opera"

;Purpose: provide a single reg import <> to commonly used registry settings
;VersionHistory
;1.1.0 --- ysg --- refactor added in morphus
;1.0.0 --- ysg --- initial creation



cmd cheat sheet ( revised )

Sat, 01 Oct 2011 18:22:00 +0000

::File:Cmd_Cheat_Sheet.cmd v.1.2.0:: GET A NICE PROMPTset prompt=$P$S$S$t$_$_$S$S:: forcely restart nowshutdown -r -f -t 00:: forcely shutdown nowshutdown -s -f -t 00:: forcely hibernate nowshutdown -h -f -t 00RUNAS /profile /user:userName " shutdown.exe -r -f -m \\remoteHost":: execute command remotely not workingLSrunas /user:userName /password:company01 /domain:%computername% /command:"reboot -r -f -m \\remoteHost" /runpath:"C:\Temp\QARunpack\bin"psexec -u user001 -p pass "shutdown.exe -r -f -m \\RemoteHostName "psexec -u user001 -p pass "shutdown.exe -r -f -m \\RemoteHostName"LSrunas /user:userName /password:company01 /domain:%computername% /command:" updateTRN.bat \\1USD01011" /runpath:"C:\Temp\QARunpack\bin":: ADDING USER WITH PASSnet user userName company01 /ADD:: ADDING USER TO THE LOCALGROUP ADMINISTRATORSnet localgroup "Administrators" userName /add:: ADDING VANTAGE USER IDENTIFIED BY company01 TO THE LOCALGROUP ADMINISTRATORSnet user vantage company01 /add:: ADDING USER TO THE LOCALGROUP ADMINISTRATORSnet localgroup "Administrators" vantage /add:: OPENS THE EXPLORER IN THE C:\TEMP FOLDER MAXIMIZED - USE THE /MIN OPTION TO GET:: THE WINDOWS STARTED MINIMIZEDcmd /c start /max Explorer /e , "C:\Temp":: RUN THE REGEDIT AS A SPECIFIC USERRUNAS /profile /user:userName regedit | sanur /i C:\utils\psts.txt:: REboot agent remotely using the runas command - WORKS !!!!:: START A CMD PROMPT UNDER THE userName userRUNAS /profile /user:userName cmd.exe | sanur /i C:\utils\psts.txtRUNAS /profile /user:userName " shutdown.exe -f -r -t 00 -m \\RemoteHostName"::WORKS ALSO NEEDS SANUR http://www.commandline.co.uk/sanur_unsupported/index.htmlRUNAS /profile /user:userName " shutdown.exe /f /r /t 00 /m \\2SGD00070" | sanur /i C:\utils\psts.txtrunas /u:domain\username program.exe | sanur /i C:\utils\psts.txt:: GET ALL THE INFORMATION RELATED TO NETWORKING ON A WINDDOWS STATIONipconfig /all:: USE OF FOR /FFOR /F "usebackq delims=\" %i IN (`DIR /AD /B`) DO FIND /I "TEMP":: LIST THE RUNNING APPLICATIONStasklist /v:: FIND SOMETHING IN A COMMANDipconfig /all | find /i "Address":: EXPORT AND PARSE VALUE FROM THE REGISTRYsetlocalif exist tmp.reg del /q tmp.regreg export "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" tmp.regfor /f "tokens=2 delims==" %%a in ('find /i "username" tmp.reg') do set line=%%a&call :stripendlocalgoto :EOF:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::strip::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::set usr=%line:"=%echo/the user is %usr%>>%computername%.txtdel /q tmp.reg:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: ANOTHER WAY OF EXPORTING KEYS FROM THE REGISTRYregedit /e c:\zzz\reg.reg "HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer":: COUNT THE NUMBER OF SPECIFIC TYPE OF FILES ARE THEY IN A SPECIFIED DIRECTORYfor /f "tokens=* delims=" %%i in ('dir C:\Temp\scripts\*.* /b /a-d ^| find /i /c "mdb"') do @echo num of scripts is %%i>>"%cd%\%computername%.txt":: LABEL EACH FILE IN A DIRECTORYfor /f "tokens=* delims=" %%i in ('dir /b C:\Temp\scripts\*.mdb') do @echo installed script %%i >>"%cd%\%computername%.txt":: START EXPLORERfor /f "tokens=* delims=" %%i in ('type DrillDownAllNames.txt') do ():: CHANGE DRIVE AND DIRECTORY AT THE SAME TIME.cd /d %ProgramFiles%:: COMMAND SEPERATOR. EXECUTES TWO (OR MORE) COMMANDS ON ONE LINE.dir & pathSAME, BUT THE EC[...]



how-to setup public private key authentication between an Win and Nix box

Tue, 27 Sep 2011 15:40:00 +0000

Install CygwinInstall separately the ssh-keygen ( or sshd )Download the puttycfg , unzip to a dir in your Windows pathFind out where cygwin1.dll is installed cygcheck -sd >list.txtOpen the list.txt ( it is quite big ) : notepad list.txt Copy all the files from   C:\temp\something  to the dir where the cygwin1.dll is located Start the putty.exe : Start - Run : cmd /c START  /max puttyIn the GUI , check that Session on the Left is selected , click on Cygterm option , for hostName type - , leave port number 22Open the puttycfg : Generate the public and private key's : # ssh-keygen -t rsaType Enter,EnterNow here is the tricky part you have to tell also putty that the public and private key files are the one you want to use with you : Copy the /home/<>/id_rsa and ..id_rsa.pub to the dir where your save your putty conf in my case: C:\Temp\ysg\conf\<>\putty\sshStart - Run - type puttygen Load the copied private key file and save it as <> , save also the public key file Copy the id_rsa.pub file to the server's ~ dirOn the server cat id_rsa.pub >> ~/.ssh/authorized_keysNow when started from the windows client  :cmd /c START  /max putty  username@servername.domain.com no password should be asked [...]



how-to start outlook with unread e-mails folder selected

Thu, 22 Sep 2011 07:05:00 +0000


ECHO START OUTLOOK with selected Unread Mail folder
cmd /c start /max outlook /select ""




how-to get the column metadata in mysql

Fri, 16 Sep 2011 12:30:00 +0000

 
/* when asked type the password for the username */
mysql -u username -p  -B -e "use information_schema; SELECT     TABLE_CATALOG  , TABLE_SCHEMA  , TABLE_NAME  , COLUMN_NAME  , ORDINAL_POSITION  , COLUMN_DEFAULT  , IS_NULLABLE  , DATA_TYPE  , CHARACTER_MAXIMUM_LENGTH  , CHARACTER_OCTET_LENGTH  , NUMERIC_PRECISION  , NUMERIC_SCALE  , CHARACTER_SET_NAME  , COLLATION_NAME  , COLUMN_TYPE  , COLUMN_KEY  , EXTRA  , PRIVILEGES  , COLUMN_COMMENT
INTO OUTFILE '/var/lib/mysql/information_schema.csv'
FIELDS TERMINATED BY '\t' OPTIONALLY ENCLOSED BY ' '
LINES TERMINATED BY '\n'
from COLUMNS; "
 
 



I hate watching at the end of the terminal in Unix ...

Sat, 03 Sep 2011 07:32:00 +0000

history | sort -r | less