Skip to content

Instantly share code, notes, and snippets.

@sureshnath
sureshnath / excel-formulas.txt
Last active June 29, 2020 07:06
Excel handy formulas
# formula.10minutes.txt
field> (10/(24*60))
# characters before last occurence of '.'
=LEFT([@TestFullName], SEARCH("^^",SUBSTITUTE([@TestFullName],".","^^",LEN([@TestFullName])-LEN(SUBSTITUTE([@TestFullName],".",""))))-1)
# characters after the last occurence of '.'
=RIGHT([@TestFullName],LEN([@TestFullName])- SEARCH("^^",SUBSTITUTE([@TestFullName],".","^^",LEN([@TestFullName])-LEN(SUBSTITUTE([@TestFullName],".","")))))
@sureshnath
sureshnath / ca-commands.txt
Created March 24, 2015 08:43
CA commands
DEFine JOBSET ID=jobset [ABENDaction=|CONTINUE] [ANYCpu=Yes|] [AUTOSel=Yes|] [AVGTime=time] [BACKLOG=|No] [CALendar=calendar-name] [DESCription=description] [EARLYTime= time] [EFFectivedate=date] [EXPIresdate=date] [FAILCond=(+|- llll,+|-hhhh)] [HISTory=nnnn] [HOLD=Yes|] [MAXTime=time] [MODEL=jobset] [MUSTCOMPTime=time] [MUSTSTARTTime=time] [PRIority=nn] [SETType=|PREcpu|POSTcpu] [SKIP=nnnn] [STATION=station] [SUBDomain=domain-name][CRITCAL=calname] [CRITHACT=holiday-action] [CRITNWACT=non-workday-action] [CRITCADJ=+|-nnn] [CRITKEYS=(keywords)] [EXPand=|No] [SCope=All|] [SUBPASS=password] [SUBUSER=submit-user-id ] [USEREnv=Yes|No]
DEFine JOB ID=(jobset-name,job-name,jno[,station-id]) [ABENDAction=ABORT|CONTINUE|jobset] [ANYCPU=Yes|No|Grp|All|] [AUTOSEl=|No|DEF] [AVGTime=time] [BACKLOG=|No|Run|DEF] [CALendar=calendar-name] [DESCription='description'] [EARLYTime=time] [EFFectivedate=date] [EXPIresdate=date] [FAILCond=(+|-llll,+|-hhhh)] [HISTory=nnnn] [HOLD=Yes|] [INTERruptible=Yes|] [JOBType=|P
@sureshnath
sureshnath / regex.keyvalue.txt
Created March 18, 2015 15:45
keyvalue pair regex
private static final Pattern KEY_VALUE_PAIR = Pattern.compile("(\\w+\\s*=\\s*\\w+)|(\\w+\\s*=\\s*\\([^\\)]+\\))|(\\w+\\s*=\\s*'[^']+')|(\\w+\\s*=\\s*\"[^\"]+\")");
@sureshnath
sureshnath / pattern.sql
Created February 17, 2015 13:19
sybase, mssql pattern
DECLARE @ExcludeUserList varchar(256)
select
@ExcludeUserList = case
when @@servername like 'SERV____[UPF]' then 'username'
else 'others'
end
select @ExcludeUserList
@sureshnath
sureshnath / zip_commands.txt
Created January 8, 2015 18:31
zip unzip files
cd src_folder
zip zip_file_path file_pattern
unzip -l zip_file_path [file_pattern]
@sureshnath
sureshnath / slf4j.tmpl
Last active August 29, 2015 14:12 — forked from esamson/slf4j.tmpl
private static final ${LOG_TYPE type="org.slf4j.Logger" default="Logger" editable=false} log =
${LOG_FACT type="org.slf4j.LoggerFactory" default="LoggerFactory" editable=false}.getLogger(${classVar editable="false" currClassName default="getClass()"}.class);
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
log4j.rootLogger=TRACE, stdout
@sureshnath
sureshnath / windows-passwords.txt
Last active March 24, 2025 13:46
Windows passwords in SYSTEM context
https://social.technet.microsoft.com/Forums/windows/en-US/e1ef04fa-6aea-47fe-9392-45929239bd68/securitykerberos-event-id-14-credential-manager-causes-system-to-login-to-network-with-invalid?forum=w7itprosecurity
The Windows 7 computer had a hidden old password from that domain account.
There are passwords that can be stored in the SYSTEM context that can't be seen in the normal Credential Manager view.
Download PsExec.exe from http://technet.microsoft.com/en-us/sysinternals/bb897553.aspx and copy it to C:\Windows\System32 .
From a command prompt run: psexec -i -s -d cmd.exe
@sureshnath
sureshnath / unix-remove-files-not-active.sh
Last active August 29, 2015 14:06
unix remove files currently not active and find and remove files modified n days ago
# remove files in the current directory, which are currently not in use
for file in `ls -1`; do fuser $file; if [ $? != '0' ]; then rm -f $file; fi; done
# remove files modified 3 days ago
find -type d -mtime +3 -exec rm -rf {} \;
#create directory if not exists
$TARGETDIR = "c:\Temp\test\1\2"
if(!(Test-Path -Path $TARGETDIR )){
New-Item -ItemType directory -Path $TARGETDIR
}
#get basename of url
$URL = "http://stackoverflow.com/questions/4546567/get-last-element-of-pipeline-in-powershell"
$NAME = $URL.Split('/') | Select-Object -Last 1
echo $NAME