Skip to content

Instantly share code, notes, and snippets.

@halyph
halyph / App.java
Created June 27, 2012 16:07
Read META-INF/MANIFEST.MF from jar file #java #manifest #read
Manifest mf = new Manifest();
mf.read(Thread.currentThread().getContextClassLoader().getResourceAsStream("META-INF/MANIFEST.MF"));
Attributes atts = mf.getMainAttributes();
System.out.println("Version: " + atts.getValue("Implementation-Version"));
System.out.println("Build: " + atts.getValue("Implementation-Build"));
@halyph
halyph / pom.xml
Created July 21, 2012 09:05 — forked from gordonad/pom.xml
Spring Best Practices Maven Pom
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.gordondickens.sample</groupId>
<artifactId>sample-parent</artifactId>
<version>1.0.0</version>
<packaging>pom</packaging>
@halyph
halyph / run script
Created August 14, 2012 09:07
Notepad++ Ruby script run
cmd /C jruby "$(FULL_CURRENT_PATH)" & pause
cmd /K jruby "$(FULL_CURRENT_PATH)"
@halyph
halyph / gist:3347751
Created August 14, 2012 09:19
#ruby gem install via proxy
oivasiv@IF006 /d/MyProjects/GitHub/gitflow_test2
$ touch README.md
oivasiv@IF006 /d/MyProjects/GitHub/gitflow_test2
$ git init
Initialized empty Git repository in D:/MyProjects/GitHub/gitflow_test2/.git/
oivasiv@IF006 /d/MyProjects/GitHub/gitflow_test2 (master)
$ git add README.md
@halyph
halyph / gist:3369405
Created August 16, 2012 11:18
Add custom #git #commands
  • Add to $PATH variable folder with git related scripts
$ export PATH=$PATH:/d/MyProjects/GitHub/scripts
  • To have command like:
$ git <mycommand>

you should create script with the next naming convention

@halyph
halyph / sample
Created August 16, 2012 13:10
msysgit shell ANSI color echo
$ echo -e "\033[31mCompiling foo.c\033[0m \033[33mCompiling foo.c\033[0m"
@halyph
halyph / gist:3502664
Created August 28, 2012 19:11
#git Setup Line Ending Preferences

for Unix/Mac users:

Execute:

$ git config --global core.autocrlf input

$ git config --global core.safecrlf true
@halyph
halyph / gist:3526022
Created August 30, 2012 10:37
#git set http.proxy
$ git config --global http.proxy http://proxyuser:proxypwd@proxy.server.com:8080
@halyph
halyph / gist:3657075
Created September 6, 2012 14:58
Convert UNIX files to DOS format fot all untracked file in f#git
$ git status --untracked-files=all -s | grep "^??" | cut -c 4- | while read line; do dos2unix -D "${line}"; done