Mini Tips

Find not me

nmap -p 22 192.168.1.100-110 --exclude $(ifconfig | grep "inet addr" | grep -ve 127.0.0.1 | cut -d":" -f 2 | cut -d " " -f 1) ; #FIND SSH NOT ME

nmap  192.168.1.100-110 --exclude $(ifconfig | grep "inet addr" | grep -ve 127.0.0.1 | cut -d":" -f 2 | cut -d " " -f 1) | awk 'BEGIN {} /^Nmap scan.*/ { IP=$5; print IP " up"} /.*open.*/ {print  "                " $1 " " $3}' ; #FIND ANY NOT ME

Save a bag of coal

killall -19 firefox ; # SLEEP FIREFOX

killall -18 firefox ; # WAKE UP FIREFOX

Remover exif from files


$FIND | while read FILE; do
   echo "Processing $FILE";
   exiftool -all= "$FILE";
done

Being $FIND something like:
   ls *.png
   find -iname *.png


Hibernate from command line


dbus-send --system --print-reply \
    --dest="org.freedesktop.UPower" \
    /org/freedesktop/UPower \
    org.freedesktop.UPower.Hibernate

Remove metadata from pdf with java



build.sh
run.bat
run.sh
MANIFEST.MF
lib/
   commons-logging-1.1.jar
   log4j-1.2.13.jar
   pdfbox-1.8.10.jar
metadata/
    ModifyMetadata.java

[run.bat]
java -jar modifyMetadata.jar %1 %2

[run.sh]
java -jar modifyMetadata.jar $1 $2

[build.sh]
javac -cp lib/pdfbox-1.8.10.jar metadata/ModifyMetadata.java
jar cvfm modifyMetadata.jar MANIFEST.MF metadata/ModifyMetadata.class

[MANIFEST.MF]
Manifest-Version: 1.0
Created-By: 1.7.0 (Sun Microsystems Inc.)
Main-Class: metadata.ModifyMetadata
Class-Path: lib/pdfbox-1.8.10.jar lib/commons-logging-1.1.jar lib/log4j-1.2.13.jar


[Metatada.java]

package metadata;

import org.apache.pdfbox.pdmodel.PDDocument;
import org.apache.pdfbox.pdmodel.PDDocumentInformation;

public class ModifyMetadata {
  private ModifyMetadata() { }
  public static void main( String[] args ) throws Exception {
    if( args.length != 2 ) {
      usage();
    } else {
 

      try {
        PDDocument document = PDDocument.load( args[0] );
        if( document.isEncrypted() ) {
          System.err.println( "Error: Cannot modify encrypted document." );
          System.exit( 1 );
        }
        PDDocumentInformation info = document.getDocumentInformation();

        info.setAuthor("Your stamp");
        info.setProducer("Your stamp");
        info.setKeywords("Your stamp");
        info.setCreator("Your stamp");
        info.setSubject("Your stamp");
        info.setTitle("Your stamp");
        document.save( args[1] );
      } finally {
        if( document != null ) {
          document.close();
        }
      }
    }
  }
  private static void usage() {
    System.err.println( "Usage: java metadata.ModifyMetadata " +
      "<input-pdf> <output-pdf>" );
  }
}




Multiple java versions

http://www.proyecto-ciaa.com.ar/devwiki/doku.php?id=repo:configuracion:java

Concatenate outputs


{ process1 & ( process2 | process3; ) }

Shrink virtual disk


remove all the crap like 
   gstreamer*
   thunderbird*

apt-get clean

sudo apt-get install zerofree
reboot
  with shift
advanced options
recovery mode
root
   mount -n -o remount,ro -t ext4 /dev/sda1 /
   zerofree /dev/sda1
   shutdown -h now

usefull post command or actions

VBoxManage clonehd --format input.vmdk output.vdi ; #optional

VBoxManage modifyhd input.vdi --compact


VBoxManage internalcommands sethduuid disk.vmdk

relink output.vmdk as input.vmdk (manually, but there must be a cli way)



Export the appliance

Crop video


mencoder -oac copy -ovc xvid -xvidencopts pass=2:bitrate=12000  planB.ogv -o crop.ogv -ss 00:00:00 -endpos 00:00:25 -vf crop=2000:700:0:0

git lola


[~/.gitconfig]
lol = log --graph --decorate --pretty=oneline --abbrev-commit
lola = log --graph --decorate --pretty=oneline --abbrev-commit --all 

http://blog.kfish.org/2010/04/git-lola.html




No hay comentarios:

Publicar un comentario