Showing posts with label FAQ. Show all posts
Showing posts with label FAQ. Show all posts

Wednesday, August 26, 2015

vi / vim FAQ



Replace 'substitution':
:%s/Orig_Text/New_Text/g

% makes it affect all lines (instead of only the current line)
g makes it happen on all occurrences on each line (instead of just the first)

ssh FAQ



Disconnect - Stop ssh shell from timing out, see here:
http://www.howtogeek.com/howto/linux/keep-your-linux-ssh-session-from-disconnecting/

.ssh/config - Use this to remember things for you
An a example:

Host debug1profile
    HostName debug1.fake.com
   User fakeuserNameToLoginAs
   IdentityFile /xxx/keyToUseWithThatHost.pem

With a config like that just do this to login (it grabs all the needed values from the config file)

ssh debug1profile


Wednesday, August 19, 2015

Java FAQ


Remote Debugging, what to add on the command line to allow it:
-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005


Tuesday, August 4, 2015

Port Forwarding FAQ

Port Forwarding FAQ

Work in Progress...



Machine forwards a port from source machine:
ssh -L 8788:localhost:8787 USER_NAME@IP_OF_SOURCE_MACHINE




Maven FAQ

Maven FAQ

Work in Progress...


Documentation, generate it
mvn site

Debug tests
mvn -Dmaven.surefire.debug test

Debug tests with jvm settings
mvn -Dmaven.surefire.debug="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -Xnoagent -Djava.compiler=NONE" test

Dependencies:
mvn dependency:resolve
mvn dependency:tree

Do Not Run Other Phases, just test only:
mvn -Dtest=NameOfTest surefire:test

Effective pom, how to show it:
mvn help:effective-pom

Multiple tests, Run only a limited set of tests:
mvn -Dtest=TestSquare,TestCi*le test

Repo: Search for things in the 'official' repo
https://repository.sonatype.org/#welcome

Single test, Run only a Single test
mvn -Dtest=TestCircle test

References:
http://maven.apache.org/surefire/maven-surefire-plugin/examples/debugging.html
http://maven.apache.org/surefire/maven-surefire-plugin/examples/single-test.html
http://stackoverflow.com/questions/14881730/run-junit-tests-in-maven-without-building-and-copying-files

Docker FAQ

Docker FAQ

Work in progress...


Load a docker image from a tar file:
docker load < TARGET_FILENAME.tar
See Save to find how to make something to load

Remove (delete) ALL existing containers:
docker rm $(docker ps -aq)

Runing from docker shows something like this:
strace: test_ptrace_setoptions_for_all: PTRACE_TRACEME doesn't work: Permission denied

strace: test_ptrace_setoptions_for_all: unexpected exit status 1
Perhaps docker needs to be run with the option --privileged

Save a docker image to a tar file (instead of putting in an archive):
docker save IMAGE_NAME > TARGET_FILENAME.tar
See Load for what to do with a save

Start a bash shell inside a running docker container:
Find the name of the container:
docker ps
or depending how your system is setup:
sudo docker ps
Then with the name (replacing 'crazy_name' in the examples) start interactive bash like this:
docker exec -it crazy_name bash
or:
sudo docker exec -it crazy_name bash

Terms

container (think of this as a running exe)

  • Running instance of an image.
  • It can be actively running and shows up via:
  • docker ps
  • It can be sort of sleeping and shows up when _all_ docker containers are shown via:
  • docker ps -a
  • Can be made of a an image via:
  • docker commit
image (think of this like an exe file on disk)
  • Stored set of stuff that must be run to become a container.
  • Can be seen via
  • docker images
  • A container can be made into an image via:
  • docker commit