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 / 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

alt . = hightlight menu

alt . H = text ribbon (its Home)

  • 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

@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 && \
@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 / 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 / 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 / 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 / ParamSetListBuilder.java
Created August 14, 2018 20:18
a temp gist, this code is used in testng to create combination of parameter in dataProvider
public static class ParamSetListBuilder {
private List<List> paramList = new ArrayList<>();
private Logger logger = LoggerFactory.getLogger(getClass());
public ParamSetListBuilder addParams(List paramListToCombine) {
addParamsAtIndex(paramListToCombine, Helper.calcParamIndex(paramList));
return this;
}
  • cancel action : C-g
  • query/replace in selected : C-<space> select region >>> M-x >> replace-string >> ....
  • copy/cut paste : M-w/C-w C-y
  • del i.e kill line: M-x
  • list bufferes : C-x C-b ; close it : C-x 1
  • Switch buffers : C-x b or select from C-x C-f
  • Save all buffer : C-x s this will ask you for all unsaved buffer
  • File ops [todo: anything from below if repeated above, delete the above one]
	C-x C-f		Find file