↓ Skip to main content

Programming

Replace BSD grep with GNU grep

·170 words·1 min
If annoyed with: # ➜ ~ echo $PATH | tr ':' '\n' /usr/local/opt/coreutils/libexec/gnubin /Library/Java/JavaVirtualMachines/jdk1.7.0_55.jdk/Contents/Home/bin /opt/ant/bin /opt/groovy/bin /opt/gradle/bin /Users/miro/bin /usr/local/bin /usr/bin /bin /usr/sbin /sbin /usr/local/bin /opt/X11/bin /usr/texbin # YEs I am using GNU core utils but grep is not there # The issue ➜ ~ grep --version grep (BSD grep) 2.5.1-FreeBSD Here is the receipt

Keepass-Node install

·455 words·3 mins
See https://github.com/gesellix/keepass-node ➜ keepass-node git:(master) pwd /Users/miro/src/PLG/keepass-node Install # ➜ keepass-node git:(master) ✗ sudo npm install Password: > dejavu@0.4.4 postinstall /Users/miro/src/PLG/keepass-node/node_modules/keepass.io/node_modules/dejavu > node bin/post_install.js Saving runtime configuration in /Users/miro/src/PLG/keepass-node/node_modules/keepass.io/.dejavurc > keepass.io@1.0.5 install /Users/miro/src/PLG/keepass-node/node_modules/keepass.io > (node-gyp rebuild 2>&1) || (echo 'DO NOT WORRY ABOUT THESE MESSAGES. KEEPASS.IO WILL FALLBACK TO SLOWER NODE.JS METHODS, SO THERE ARE NO LIMITATIONS EXCEPT SLOWER PERFORMANCE.'; exit 0) \ Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo. Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo. gyp ERR! build error gyp ERR! stack Error: `make` failed with exit code: 69 gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:267:23) gyp ERR! stack at ChildProcess.emit (events.js:98:17) gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:810:12) gyp ERR! System Darwin 13.4.0 gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" gyp ERR! cwd /Users/miro/src/PLG/keepass-node/node_modules/keepass.io gyp ERR! node -v v0.10.31 gyp ERR! node-gyp -v v1.0.1 gyp ERR! not ok DO NOT WORRY ABOUT THESE MESSAGES. KEEPASS.IO WILL FALLBACK TO SLOWER NODE.JS METHODS, SO THERE ARE NO LIMITATIONS EXCEPT SLOWER PERFORMANCE. chai-as-promised@4.1.1 node_modules/chai-as-promised underscore@1.7.0 node_modules/underscore q@1.0.1 node_modules/q compression@1.1.0 node_modules/compression ├── bytes@1.0.0 ├── on-headers@1.0.0 ├── vary@1.0.0 ├── debug@2.0.0 (ms@0.6.2) ├── compressible@2.0.0 (mime-db@1.0.3) └── accepts@1.1.1 (negotiator@0.4.8, mime-types@2.0.2) chai@1.9.2 node_modules/chai ├── assertion-error@1.0.0 └── deep-eql@0.1.3 (type-detect@0.1.1) express@4.9.5 node_modules/express ├── merge-descriptors@0.0.2 ├── utils-merge@1.0.0 ├── fresh@0.2.4 ├── cookie@0.1.2 ├── escape-html@1.0.1 ├── range-parser@1.0.2 ├── cookie-signature@1.0.5 ├── media-typer@0.3.0 ├── vary@1.0.0 ├── finalhandler@0.2.0 ├── parseurl@1.3.0 ├── methods@1.1.0 ├── serve-static@1.6.3 ├── path-to-regexp@0.1.3 ├── depd@0.4.5 ├── qs@2.2.4 ├── debug@2.0.0 (ms@0.6.2) ├── on-finished@2.1.0 (ee-first@1.0.5) ├── etag@1.4.0 (crc@3.0.0) ├── proxy-addr@1.0.3 (forwarded@0.1.0, ipaddr.js@0.1.3) ├── send@0.9.3 (destroy@1.0.3, ms@0.6.2, mime@1.2.11) ├── type-is@1.5.2 (mime-types@2.0.2) └── accepts@1.1.1 (negotiator@0.4.8, mime-types@2.0.2) mocha@1.21.4 node_modules/mocha ├── diff@1.0.7 ├── growl@1.8.1 ├── commander@2.0.0 ├── mkdirp@0.3.5 ├── debug@2.0.0 (ms@0.6.2) ├── jade@0.26.3 (commander@0.6.1, mkdirp@0.3.0) └── glob@3.2.3 (inherits@2.0.1, graceful-fs@2.0.3, minimatch@0.2.14) body-parser@1.9.0 node_modules/body-parser ├── bytes@1.0.0 ├── media-typer@0.3.0 ├── raw-body@1.3.0 ├── depd@1.0.0 ├── qs@2.2.4 ├── iconv-lite@0.4.4 ├── on-finished@2.1.0 (ee-first@1.0.5) └── type-is@1.5.2 (mime-types@2.0.2) coveralls@2.11.2 node_modules/coveralls ├── lcov-parse@0.0.6 ├── log-driver@1.2.4 ├── request@2.40.0 (json-stringify-safe@5.0.0, forever-agent@0.5.2, aws-sign2@0.5.0, oauth-sign@0.3.0, stringstream@0.0.4, tunnel-agent@0.4.0, qs@1.0.2, node-uuid@1.4.1, mime-types@1.0.2, tough-cookie@0.12.1, form-data@0.1.4, http-signature@0.10.0, hawk@1.1.1) └── js-yaml@3.0.1 (esprima@1.0.4, argparse@0.1.15) istanbul@0.3.2 node_modules/istanbul ├── abbrev@1.0.5 ├── which@1.0.5 ├── nopt@3.0.1 ├── wordwrap@0.0.2 ├── once@1.3.1 (wrappy@1.0.1) ├── async@0.9.0 ├── resolve@0.7.4 ├── mkdirp@0.5.0 (minimist@0.0.8) ├── fileset@0.1.5 (minimatch@0.4.0, glob@3.2.11) ├── esprima@1.2.2 ├── escodegen@1.3.3 (estraverse@1.5.1, esutils@1.0.0, source-map@0.1.40, esprima@1.1.1) ├── handlebars@1.3.0 (optimist@0.3.7, uglify-js@2.3.6) └── js-yaml@3.2.2 (esprima@1.0.4, argparse@0.1.15) googleapis@1.0.14 node_modules/googleapis ├── async@0.9.0 ├── multipart-stream@1.0.0 (inherits@2.0.1, sandwich-stream@0.0.4) ├── request@2.40.0 (json-stringify-safe@5.0.0, aws-sign2@0.5.0, forever-agent@0.5.2, oauth-sign@0.3.0, stringstream@0.0.4, tunnel-agent@0.4.0, qs@1.0.2, node-uuid@1.4.1, mime-types@1.0.2, form-data@0.1.4, tough-cookie@0.12.1, http-signature@0.10.0, hawk@1.1.1) └── gapitoken@0.1.3 (jws@0.0.2) keepass.io@1.0.5 node_modules/keepass.io ├── async@0.9.0 ├── nan@1.2.0 ├── xml2js@0.4.4 (sax@0.6.0, xmlbuilder@2.4.4) └── dejavu@0.4.4 (amdefine@0.0.8, mout@0.4.0) ➜ keepass-node git:(master) Kinda weird to ignore errors, but anyway …

Git bit of the day

·505 words·3 mins
Question from email: # how do I merge 1 file from master -> LIVE Answer # You cannot. Merge operation creates new commit that has 2 or more parents and will always join full histories of the branches. You can however: replicate all changes done in single commit to different branch - this is “cherry pick” take state of single file from different branch into current branch How to replicate all changes done in single commit to different branch - “cherry pick” # Say you have latest commit in master that contains change to two files you need.

Few gitbits

·326 words·2 mins
Show branches and tags in log # git log –oneline –decorate Even better - all branches with graph # git log –oneline –decorate –all –graph Highlight words instead of lines # git diff –word-diff HEAD~~~ HEAD~~

ATG + JBoss rant

·472 words·3 mins
Symptoms # restarting after kill -9 of CSC instance does not succeed. The server never starts, the WAR files are not deployed properly, socket 8080 is open but nobody answers (not even with wget on localhost). The exception: # "main" prio=10 tid=0x0000000051a39000 nid=0x30fb in Object.wait() [0x00002b5df9d6c000] java.lang.Thread.State: TIMED_WAITING (on object monitor) at java.lang.Object.wait(Native Method) - waiting on <0x00000007e36ae9d0> (a atg.service.lockmanager.ClientLockEntry) at atg.service.lockmanager.ClientLockEntry.acquireWriteLock(ClientLockEntry.java:399) - locked <0x00000007e36ae9d0> (a atg.service.lockmanager.ClientLockEntry) at atg.service.lockmanager.ClientLockManager.acquireWriteLock(ClientLockManager.java:1137) at atg.repository.search.indexing.ConfigStatePersister.acquireLock(ConfigStatePersister.java:1844) at atg.repository.search.indexing.ConfigStatePersister$IndexingReadLockedTransactionAction.doWithTransaction(ConfigStatePersister.java:2083) at atg.repository.search.indexing.ConfigStatePersister.releaseAllConfigurations(ConfigStatePersister.java:1545) at atg.repository.search.indexing.ConfigStatePersister.performAction(ConfigStatePersister.java:1775) at atg.nucleus.Nucleus.performPostStartupActions(Nucleus.java:4336) at atg.nucleus.Nucleus.performPostStartupActions(Nucleus.java:4323) at atg.nucleus.Nucleus.<init>(Nucleus.java:954) at atg.nucleus.Nucleus.<init>(Nucleus.java:717) at atg.nucleus.Nucleus.startNucleusCheckLicense(Nucleus.java:4144) at atg.nucleus.servlet.NucleusServlet.initBigEarNucleus(NucleusServlet.java:1234) at atg.nucleus.servlet.NucleusServlet.init(NucleusServlet.java:443) at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1048) - locked <0x0000000781734f48> (a org.apache.catalina.core.StandardWrapper) at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:950) - locked <0x0000000781734f48> (a org.apache.catalina.core.StandardWrapper) at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4122) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4417) - locked <0x0000000781733e18> (a org.apache.catalina.core.StandardContext) at org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeployInternal(TomcatDeployment.java:321) at org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeploy(TomcatDeployment.java:145) at org.jboss.web.deployers.AbstractWarDeployment.start(AbstractWarDeployment.java:461) - locked <0x0000000780878058> (a org.jboss.web.tomcat.service.deployers.TomcatDeployment) at org.jboss.web.deployers.WebModule.startModule(WebModule.java:118) - locked <0x0000000780878038> (a org.jboss.web.deployers.WebModule) at org.jboss.web.deployers.WebModule.start(WebModule.java:97) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:157) at org.jboss.mx.server.Invocation.dispatch(Invocation.java:96) at org.jboss.mx.server.Invocation.invoke(Invocation.java:88) at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264) at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:668) at org.jboss.system.microcontainer.ServiceProxy.invoke(ServiceProxy.java:206) at $Proxy38.start(Unknown Source) at org.jboss.system.microcontainer.StartStopLifecycleAction.installAction(StartStopLifecycleAction.java:42) at org.jboss.system.microcontainer.StartStopLifecycleAction.installAction(StartStopLifecycleAction.java:37) at org.jboss.dependency.plugins.action.SimpleControllerContextAction.simpleInstallAction(SimpleControllerContextAction.java:62) at org.jboss.dependency.plugins.action.AccessControllerContextAction.install(AccessControllerContextAction.java:71) at org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51) at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348) at org.jboss.system.microcontainer.ServiceControllerContext.install(ServiceControllerContext.java:297) at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1652) at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:938) at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082) at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:988) at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:826) at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:556) at org.jboss.system.ServiceController.doChange(ServiceController.java:688) at org.jboss.system.ServiceController.start(ServiceController.java:460) at org.jboss.system.deployers.ServiceDeployer.start(ServiceDeployer.java:163) at org.jboss.system.deployers.ServiceDeployer.deploy(ServiceDeployer.java:99) at org.jboss.system.deployers.ServiceDeployer.deploy(ServiceDeployer.java:46) at org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer.internalDeploy(AbstractSimpleRealDeployer.java:62) at org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer.deploy(AbstractRealDeployer.java:55) at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:179) at org.jboss.deployers.plugins.deployers.DeployersImpl.doDeploy(DeployersImpl.java:1454) at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1172) at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1193) at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1225) at org.jboss.deployers.plugins.deployers.DeployersImpl.install(DeployersImpl.java:1113) at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348) at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1652) at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:938) at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082) at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:988) at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:826) at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:556) at org.jboss.deployers.plugins.deployers.DeployersImpl.process(DeployersImpl.java:789) at org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeployerImpl.java:699) at org.jboss.system.server.profileservice.repository.MainDeployerAdapter.process(MainDeployerAdapter.java:117) at org.jboss.system.server.profileservice.repository.ProfileDeployAction.install(ProfileDeployAction.java:70) at org.jboss.system.server.profileservice.repository.AbstractProfileAction.install(AbstractProfileAction.java:53) at org.jboss.system.server.profileservice.repository.AbstractProfileService.install(AbstractProfileService.java:403) at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348) at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1652) at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:938) at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082) at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:988) at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:778) at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:543) at org.jboss.system.server.profileservice.repository.AbstractProfileService.registerProfile(AbstractProfileService.java:308) at org.jboss.system.server.profileservice.ProfileServiceBootstrap.start(ProfileServiceBootstrap.java:256) at org.jboss.bootstrap.AbstractServerImpl.start(AbstractServerImpl.java:461) at org.jboss.Main.boot(Main.java:221) at org.jboss.Main$1.run(Main.java:556) at java.lang.Thread.run(Thread.java:662) What is going on: # In the run of deployment, JBoss is starting context, hands over control to NucleusServlet init. Nucleus is trying to get write access lock and hangs there forever, while WAR deployment and all subsequent deployment never completes.

ATG Groovy TDD

·63 words·1 min
Got it working. It is a bit rough around the edges, but functional. The two components http://localhost:8080/dyn/admin/nucleus/thinkwrap/twatg/script/GroovyDemoScript/ http://localhost:8080/dyn/admin/nucleus/thinkwrap/twatg/script/GroovyScriptRunner/ The are not started via Initial, but that is not a problem. The script tested: class ThatsGroovyDude implements com.thinkwrap.twatg.script.RunnableScript { atg.nucleus.Nucleus nuc = atg.nucleus.Nucleus.getGlobalNucleus(); public String run() { String s = ""; nuc.configPathNames.each { s += "${it}\n" } return "Hello World!\n\n" + s; } }

Folder action to autorename screenshots

·55 words·1 min
Move the location of the screenshots # I do not want to have ~/Desktop polluted with files. Thus mkdir -p ~/Documents/Screenshots defaults write com.apple.screencapture location ~/Documents/Screenshots killall SystemUIServer Test the screenshot - it does it Automator based auto-rename # Create Folder action for ~/Documents/Screenshots

Binding DashDoc with editors and Eclipse

·235 words·2 mins
If you use DashDoc (see http://kapeli.com/dash), it can be integrated with editor or Eclipse to allow automatically find selected text in Dash documentation sets: Sublime Text # This is easy - there is DashDoc plugin - https://sublime.wbond.net/packages/DashDoc The plugin is OS-X specific, because the DashDoc is Start Package Control (Cmd-Shift-P) select Install Package (type Install) select DashDoc The Ctrl-H does the search

Endeca start scripts - Oracle way

·242 words·2 mins
I have ported the Oracle VM style management scripts into the Loyalty VM. The scripts are in the loyalty-endeca Git repo, originally in eVoucher branch but also merged into edc [tkuser@vm-lo1-hpr-ma endeca]$ ls -1 total 28 dev-check-environment.sh* dev-deploy-endeca-app.sh* dev-endeca-environmet.ini* dev-remove-endeca-app.sh* endeca-control* endeca-vars.txt* README.md* RewardsEndc/ dev-endeca-environmet.ini # This is environment setting script. ### MUST BE SOURCED IN source dev-endeca-environmet.ini ## or . dev-endeca-environmet.ini ## NEVER ./dev-endeca-environmet.ini endeca-control # Main script that manages three components of the system named:

Sublime text macro to insert timestamp

·64 words·1 min
Sublime text macro to insert timestamp # platform-edc $ cat ~/Library/Application\ Support/Sublime\ Text\ 2/Packages/User/time_stamp.py import sublime_plugin from datetime import datetime class TimeStampCommand(sublime_plugin.TextCommand): def run(self, edit): # formatting options at http://docs.python.org/2/library/datetime.html#strftime-strptime-behavior stamp = datetime.now().strftime("%Y-%m-%d_%H:%M:%S") # 2013-07-18 14:54:23 for r in self.view.sel(): if r.empty(): self.view.insert(edit, r.a, stamp) else: self.view.replace(edit, r, stamp) platform-edc $ Documentation - see