Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@svenlange

svenlange/CLS.md Secret

Last active August 20, 2020 14:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save svenlange/d161f9b1604b9ddf35cf to your computer and use it in GitHub Desktop.
Save svenlange/d161f9b1604b9ddf35cf to your computer and use it in GitHub Desktop.
Command Line Stuff

FIND

Find text in files

find . -type f -print0 | xargs -0 grep -l "test"

Find text in files excluding .svn and target folders

find . -name .svn -prune -o -name target -prune -o -type f -name '*.*' -print0 | xargs -0 grep -l "test"

Delete all files found with the command find

find . -name 'org.eclipse.cdt*' | xargs rm -rf

List subversion status for all folders

find . -maxdepth 1 -type d -print | xargs svn status

*Find a particular class in a bunch of .jar files.

find . -name *.jar | while read jarName; do echo "JAR: " $jarName; jar tf $jarName; done | grep "JAR:\|TheJavaFileIAmLookingFor.class" --color=always

MISC

Create a tar.gz file / -c = create, -v = verbose, -z = gzip, -p = preserve Permissions, -f = use file

tar -pvczf file.tar.gz ./directory

List all open local network ports

lsof -i -n | egrep 'COMMAND|LISTEN'

List all files including seconds (-T)

ls -lhaT

Remove all empty or blank lines (\s is a whitespace)

sed '/^\s*$/d' myFile > tmp
mv tmp myFile

List jar file content

jar tvf file.jar

Ubuntu Windows OEM Key aus BIOS auslesen

sudo xxd /sys/firmware/acpi/tables/MSDM

MAVEN

Maven set versions

mvn versions:set -DnewVersion=1.1.1 -f parent/pom.xml

Generate javadoc and source code jars

mvn clean javadoc:jar source:jar install

Skip tests

mvn install -Dmaven.test.skip=true

Only warn if checksums don't match

mvn clean install -c
mvn clean install --lax-checksums

GIT

Create Tag and push to origin

git tag -l
git tag -a v1.7.4 -m 'Tagged release version 1.7.4'
git push --tags
git show v1.7.4

SUBVERSION

Delete all unversioned files listed with svn

svn st | grep '^?' | awk '{print "\"" substr($0, index($0,$2)) "\""}' | xargs rm -v

Remove subversion lock

svn pd lock-tag
svn ci -m "removed lock"

Revert bad commit

svn merge -r [current_version]:[previous_version] [repository_url]
svn commit -m "Reverting previous commit and going back to revision [previous_version]."

Only show the commits of a certain user

svn log | sed -n '/USERNAME/,/-----$/ p'

VI

Search and replace all

:%s/OLD/NEW/g

Regex

http://docs.oracle.com/javase/6/docs/api/java/util/regex/Pattern.html

String      Search           Replace   Result
Mr.         (Mr)(\.)         \1s\2     Mrs.
return 2;   (return )(.)(;)  $1"$2"$3  return "2";

Replace all Xpand for-loops with Xtend2 for-loops

search: «FOREACH (.*) AS (\w*)(.*?)»
replace with: «FOR $2 : $1 $3»

Replace first occurrence (non eager)

search: xml::id=".*?"

All Java comments

search: /\*(.|[\r\n])*?\*/

Eclipse p2 director

List all plugins contained in a repo

eclipse -noSplash -application org.eclipse.equinox.p2.director -repository <host> -list

Build minimum Xtend Eclipse IDE with Subversion and XML Editor

#!/bin/sh
./eclipse/eclipse \
-noSplash \
-application org.eclipse.equinox.p2.director \
-repository \
http://download.eclipse.org/eclipse/updates/3.8,\
http://download.eclipse.org/modeling/emf/emf/updates/releases/,\
http://download.eclipse.org/modeling/tmf/xtext/updates/composite/releases/,\
http://download.eclipse.org/tools/gef/updates/releases/,\
http://subclipse.tigris.org/update_1.8.x \
-installIU \
org.eclipse.sdk.ide/3.8.2.M20130131-0800,\
org.eclipse.xtext.sdk.feature.group/2.4.1.v201304180855,\
org.tigris.subversion.subclipse.feature.group/1.8.20,\
org.tigris.subversion.clientadapter.feature.feature.group/1.8.4,\
org.tigris.subversion.clientadapter.svnkit.feature.feature.group/1.7.9.1,\
org.eclipse.wst.xml_ui.feature.feature.group/3.4.2.v201211061806 \
-tag InitialState \
-destination /local/langsve/eclipseblah2/ \
-bundlepool /local/langsve/eclipseblah2/ \
-profile SDKProfile \
-profileProperties org.eclipse.update.install.features=true \
-p2.os linux \
-p2.ws gtk \
-p2.arch x86_64 \
-roaming

.bashrc

alias mci='mvn clean install'
alias mcit='mvn clean install -DskipTests'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment