This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Setup your log4j ConversionPattern to include a new ApplicationId field | |
log4j.appender.out.layout.ConversionPattern=%d{ISO8601} | %-5.5p | %-16.16t | %-32.32c{1} | %X{ApplicationId} | %m%n | |
# You can now set this value in your java code like this | |
private void setupLogging() { | |
org.apache.log4j.MDC.put("ApplicationId", "XZY321"); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;3-state condition defined as a function | |
(define (3-state | |
value | |
positive-body | |
zero-body | |
negative-body) | |
(cond | |
((zero? value) zero-body) | |
((positive? value) positive-body) | |
(else negative-body))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;put this in your ~/.emacs file | |
;ref: http://community.schemewiki.org/?emacs-tutorial | |
;;; Always do syntax highlighting | |
(global-font-lock-mode 1) | |
;;; Also highlight parens | |
(setq show-paren-delay 0 | |
show-paren-style 'parenthesis) | |
(show-paren-mode 1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
An extremely useful thing to know in emacs is how to discover what keys are bound to which commands on your own. | |
If you know the name of the command -- goto-line. If you type 'C-h w' (Control+h and then w), Emacs will as you "Where is command: ". Type goto-line and hit enter, and it will tell you what keystrokes (if any) are bound to that command. | |
There are a bunch more similar features. 'C-h k' does the inverse -- asks you for a keystroke and then tells you the command it runs; 'C-h b' shows all current keybindings; 'C-h a' will search for a string, so you might type 'C-h a goto' to search for commands with "goto" in the name; 'C-h v' describes variables; 'C-h f' describes functions; etc. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This can help if you have problems with: brew update | |
Don't forget to fetch the origin!!! | |
$ cd /usr/local | |
$ git fetch origin | |
$ git reset --hard origin/master |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;ADD THIS TO INIT.EL | |
;; set the path as terminal path [http://lists.gnu.org/archive/html/help-gnu-emacs/2011-10/msg00237.html] | |
(setq explicit-bash-args (list "--login" "-i")) | |
;; fix the PATH variable for GUI [http://clojure-doc.org/articles/tutorials/emacs.html#osx] | |
(defun set-exec-path-from-shell-PATH () | |
(let ((path-from-shell |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
To keep Excel from dynamically moving the target range for a function, use the $ in front of the col and row references. | |
On a windows machine, you can toggle through the "lock down" methods with the F4 key. | |
A '$' will lock down the reference to an absolute one versus a relative one. You can lock down the column, row or both. Here is a locked down absolute reference for your example. | |
(A1-MIN($A$1:$A$30))/(MAX($A$1:$A$30)-MIN($A$1:$A$30)) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(cd /opt/jboss-fuse && tar c .) | (cd /mnt/lastbackup/jboss-fuse && tar xf -) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$firstName = New-Object System.Windows.Forms.textBox | |
$firstName.add_KeyUp({ $fullName.Text = $firstName.text + " " + $lastName.text}) | |
$lastName = New-Object System.Windows.Forms.textBox | |
$lastName.top += 50 | |
$lastName.add_KeyUp({ $fullName.Text = $firstName.text + " " + $lastName.text}) | |
$fullName = New-Object System.Windows.Forms.textBox | |
$fullName.top += 100 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Count the number of lines in a file | |
cat file.txt | wc -l | |
# Jump to a line with less | |
less +392800g file.txt | |
# View the top of a file (eg. view the column headers of a csv file) | |
head file.txt | |
# Grab the first 8 fields of a delimeted file and save to another |
OlderNewer