Skip to content

Instantly share code, notes, and snippets.

View saurabh-sp-tripathi's full-sized avatar

saurabh-sp-tripathi

View GitHub Profile
@saurabh-sp-tripathi
saurabh-sp-tripathi / why_prefer_non_static.md
Last active August 15, 2018 17:39
this is in progress note on why prefer non static method over static

As I said I would always prefer non-static over static method.

  • I am big fan of pure/stateless function,there easy to understand and test, Static method as pure function i.e stateless are not bad but the real problem is to maintain the decipline to keep the 'em stateless.
  • Testablitly: Class B has static method B.foo(), now consider
class A  {

	public void bar() {
		//some important code
		B.foo();// How mock foo bahaviour? may be fiddling classloader with PowerMock but that comes with some bagage too
 //some more important code
@saurabh-sp-tripathi
saurabh-sp-tripathi / when_singleton_could_be_bad_4_even_stateless_object.md
Last active August 15, 2018 18:52
A use case where singleton can be bad even for the stateless object

While working on TestAutomation, we introduced spring IoC and had a look at PageObjects, there are totally stateless so why dont' let just make 'em singleton?

IMO it will burden unecessary memory requirements on JVM, but given today's machine where we usaually have many GB of RAM I am not sure how significant can be the impact.

Let's say we have 100 pageObjects, if 20 instance create a load of 1 MB, 100 will create 5 MB.

If you are using singleton for before the test spring has to load the 10MB, although it will be one time cost due to context-caching

@saurabh-sp-tripathi
saurabh-sp-tripathi / groovy-how-to-get-all-methods.md
Created July 11, 2019 15:35
quick copy paste for jenkins script console
def methods = obj.getClass().methods.collect { it.name }
println methods.each {println it}

//courtesy: my week memory, lazyness and https://stackoverflow.com/questions/22065290/how-to-get-all-method-names-of-a-class-without-inherited-methods-with-groovy
@saurabh-sp-tripathi
saurabh-sp-tripathi / git-cmd.md
Last active May 22, 2020 17:24
This gist contains list of reference of git commands or workflows
  • list branches (local i.e tracking and remote): git branch -vv
  • checkout: git checkout --track origin/abranch
  • Create remote branch
    //Create a new branch:
    git checkout -b feature_branch_name
    //Edit, add and commit your files. Push your branch to the remote repository:
    git push -u origin feature_branch_name
@saurabh-sp-tripathi
saurabh-sp-tripathi / vscode_cmd_debug.js
Created August 2, 2021 00:12
How to debug in vscode a test with custom command line arguments?
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Launch via NPM",
"request": "launch",
@saurabh-sp-tripathi
saurabh-sp-tripathi / Dockerfile_ansi-nmd-cnsl-lvnt
Created February 22, 2022 03:32
A container capable of nomad + consul + levant + ansible operations
FROM quay.io/centos/centos:stream8
ARG levant_bin_url=https://releases.hashicorp.com/levant/0.3.1/levant_0.3.1_linux_386.zip
RUN yum -y install epel-release && \
yum -y install ansible && \
yum -y install python3 && \
yum install python3-pip -y && \
pip3 install netaddr && \
yum -y install yum-utils && \
  • cm-cn-q: lock scr : ccquit

  • search in help: cm-sh-/ : cmdr shoot slash

    • mini >> maxi: chrome (maxi = cm-t->cm-w)
  • close win: cm-w; kaise nikalu <> cm-w || win closable u <> c-w

  • autocomplete text: F5 : Mac autocum key, key airlift hook n flee || mac autocumer, 5 finger

  • Fn lock: fn esc but lock up late

    refs:

  • https://gist.github.com/raisty/520fc113bada741c06c41b7b9659206a

alt . = hightlight menu

alt . H = text ribbon (its Home)

@saurabh-sp-tripathi
saurabh-sp-tripathi / notes-dump.yaml
Last active May 19, 2023 19:58
dump all you notes here
#Linux #DNS #resolv.conf
resolve.conf:
- define dns: `nameserver x.x.x.x`
- define domain: |`search abc.xyz.com another.domain.com`
This sits as a suffix to domain name
nslookup txmyserver
Name: txmyserver.abc.xyz.com
Address: 10.10.10.10
- troubleshot:
- NO VPN: dns resolution times out: 1. powsershell[ipconfig /all]; identify(dns) 'e.g.:10.0.0.1'. 2. wsl > resolv.conf > nameserver 10.0.0.1