Skip to content

Instantly share code, notes, and snippets.

View ankurpshah's full-sized avatar
:bowtie:
Focusing

Ankur Shah ankurpshah

:bowtie:
Focusing
View GitHub Profile
@ankurpshah
ankurpshah / install.bat
Created July 5, 2020 07:03 — forked from stormoz/install.bat
Start Selenium Grid hub and nodes as Windows services
nssm install SeleniumHub java -jar C:\Selenium\selenium-server-standalone-2.48.2.jar -role hub
nssm start SeleniumHub
nssm install SeleniumNode1 java -jar C:\Selenium\selenium-server-standalone-2.48.2.jar -role node -hub http://localhost:4444/grid/register -Dwebdriver.chrome.driver=C:\Selenium\chromedriver.exe
nssm set SeleniumNode1 DependOnService SeleniumHub
nssm start SeleniumNode1
nssm install SeleniumNode2 java -jar C:\Selenium\selenium-server-standalone-2.48.2.jar -role node -hub http://localhost:4444/grid/register -Dwebdriver.chrome.driver=C:\Selenium\chromedriver.exe
nssm set SeleniumNode2 DependOnService SeleniumHub
nssm start SeleniumNode2
@ankurpshah
ankurpshah / Jenkins locally in docker
Last active April 15, 2020 21:19
Running jenkins locally in docker container.
docker volume create jenkins-data
docker volume create jenkins-root
docker run -u root --rm -d \
-p 8080:8080 \
-p 50000:50000 \
-v jenkins-data:/var/jenkins_home \
-v jenkins-root:/root \
-v /var/run/docker.sock:/var/run/docker.sock \
-v /Users/ankurshah/work:/Users/ankurshah/work \
jenkinsci/blueocean
# Four node (three workers) cluster config
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
image: kindest/node:v1.18.0@sha256:0e20578828edd939d25eb98496a685c76c98d54084932f76069f886ec315d694
kubeadmConfigPatches:
- |
kind: InitConfiguration
nodeRegistration:

Keybase proof

I hereby claim:

  • I am ankurpshah on github.
  • I am ankurpshah (https://keybase.io/ankurpshah) on keybase.
  • I have a public key ASCOydLSxav8LiPf6EXGT-YujEeUytlNN0yBC6FX4aX0Awo

To claim this, I am signing this object:

Verifying that +ankurpshah is my Bitcoin username. You can send me #bitcoin here: https://onename.io/ankurpshah
@ankurpshah
ankurpshah / Questions
Created July 27, 2013 11:14
Questions
Code name of various java versions:
1.2 Playground
1.3 Kestrel
1.4 Merlin
1.5 Tiger
1.6 Mustang
1.7 Dolphin
@ankurpshah
ankurpshah / patternmatching
Created July 27, 2013 10:14
Pattern matching example
package datastructures;
// Possible syntax extensions; won't compile for any version of Java.
public class PatternMatchExample {
public static String match(Object obj) {
switch (obj) {
case EMPTY:
// Is it an empty list?
return "()";
case NonEmptyList(1, 2): // A list with 1 and 2?
return "(1,(2,())";
@ankurpshah
ankurpshah / stmexample
Created July 27, 2013 10:11
STM Example
package stm;
import akka.stm.*;
public class AkkaSTMIntegerCounter {
private final Ref<Integer> ref = new Ref<Integer>(0);
public int counter() {
return new Atomic<Integer>() {
public Integer atomically() {
int inc = ref.get() + 1;
ref.set(inc);
return inc;
@ankurpshah
ankurpshah / akkaexample
Created July 27, 2013 10:07
Akka Actor based concurrency example
package actors;
import akka.actor.*;
import static akka.actor.Actors.*;
import java.util.*;
public class AkkaActorExample {
// server code
static class MemoryActor extends UntypedActor {
final Map<String,Date> seen = new HashMap<String,Date>();
}
public void onReceive(Object messageObject) {
@ankurpshah
ankurpshah / combinatorfunctions
Created July 27, 2013 09:40
Combinator Functions
package datastructures2;
...
public class ListModule {
public static interface List<T> {
...
public
List<T> filter(Function1<T,Boolean> f);
public <T2> List<T2> map(Function1<T,T2> f);
public <T2> T2 foldLeft (T2 seed, Function2<T2,T,T2> f);
public <T2> T2 foldRight (T2 seed, Function2<T,T2,T2> f);