11 Aug 2016Continue reading →
Just a tiny script containing one sed command to escape input suitable for use with
adb shell input textcommand.
Make it exectuable then move it somewhere on your path :)
Makes it possible to enter complex passwords for example. Example in combination with pass:
adb shell input text $(pass amazon | adb-escape-text)
17 Apr 2015Continue reading →
For a recent project I was wondering what the best way to share node.js code across projects without publishing modules publically to npm.
The node.js ecosystem is all about sharing code publically and it's super easy to do this entirely from the comfort of the command line with
npm publishand friends. It's quite a joy actually.
However, sometimes the code must stay private, but you still want nice modular npm modules. This scenario is less well supported by npm - npm themselves says:
Lots of companies using Node.js love the "many small modules" pattern that is part of the Node culture. However, splitting internal applications and private code up into small modules has been inconvenient, requiring git dependencies or other workarounds to avoid publishing sensitive code to the public registry.
Difficulties related this topic are well discussed:
- https://gist.github.com/branneman/8048520#comment-972519 - this is about 1.5 years worth of discussion on the topic, including some of the key node.js community
I actually found a solution pretty quickly that I'm happy with but I wanted to dig a bit deeper into the alternatives.
26 Oct 2013Continue reading →
I was using Clojure to process github repos for use in libsearch.nicksellen.co.uk and ran into a problem. I had a function that was going through each repository and pulling out the useful information. This is quite time consuming as I use multiple API calls per repository and so I wanted to print some output to show progress.
The problem was that I was only seeing output printed after the entire operation had finished.
I'm quite new to Clojure and there are multiple things that might have been involved:
- Clojure uses lazy sequences in a lot of places - values are only calculated when needed
- in functional languages side effects are kind of special, and writing to
stdoutis a side effect
- I was running the code inside Emacs Live in a Leiningen REPL - that's a lot of layers in which to add behaviour
12 Aug 2013Continue reading →
I've been working on a framework for building apps by describing them as a sequence of connected operations forming a graph. It's an early stage but reasonably functional. It's not publicly available at the moment.
It has some relationship to:
This is a quick overview of a few aspects of it.
11 Jan 2013I'm evolving my data storage policy (personal/work/everything), the first step is categorising my data according to usage patterns. The dimensions I need think about are storage size, access requirements, ability to replace to data if lost, and security sensitivity.Continue reading →
25 Jun 2011Continue reading →
Installing mysql2 (0.2.6) with native extensions /Users/nick/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/site_ruby/1.8/rubygems/installer.rb:533:in `build_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError) /Users/nick/.rvm/rubies/ruby-1.8.7-p334/bin/ruby extconf.rb checking for rb_thread_blocking_region()... no checking for mysql.h... no checking for mysql/mysql.h... no ----- mysql.h is missing. please check your installation of mysql and try again. -----
Ok, so we need the headers
Fortunately you can download MAMP source form their website - this gives you a .dmg with lots of .tar.gz files, you just need the mysql one.
I tried just copying the include directory as it was - but loads of the header files have variables that need replacing.
Let's compile this thing
compilation uses cmake, so ensure you have that first.
tar zxvf mysql-5.5.9.tar.gz cd mysql-5.5.9 cmake . make mkdir /Applications/MAMP/include/ cp -r include/* /Applications/MAMP/include/ cp libmysql/*.dylib /Applications/MAMP/Library/lib
Installing mysql2 (0.2.6) with native extensions Your bundle is complete!
28 Jan 2010Continue reading →
I don't often require this but always forget the command each time. Previously I had used:
| grep Pathname
...but whilst stumbling around I found the much more succinct (and undocumented as far as I can see):
Continue reading →
It turns out the nokogiri build script makes a few too many assumptions:
- it tests for Solaris-ness by checking target_os is solaris2 where on Solaris 10 it is solaris2.10
- it assumes gcc and sets a bunch of invalid CFLAGS such as -Wall
- it doesn't let me specify a custom lib/include directories - it failed to find my iconv because of this (furthermore after adding the paths manually misleadingly it still said it couldn't find them but the problem was the options passed to cc were incorrect)
- further down the line something decided it knew where Sun Studio was. It was wrong. to be fair this probably wasn't nokogiri's fault.
I've ended up using gcc for compiling ruby related things which knocks out problems 2-4.
However I started seeing problems with a vasprintf symbol not found (similar to this problem). The problem is the same as my point 1 above (in ext/nokogiri/extconf.rb line:22):
# ruby -rrbconfig -e "puts Config::CONFIG['target_os']" solaris2.10
It's fixed by this commit
Continue reading →
Have you ever opened a PDF or a Microsoft Word document to see what they're really made of?
It would look a little something like this
Total gibberish to look at. You need to know the secret code to get meaningful content out of them.
This post isn't about the formats, I don't have any special knowledge about them anyway. This is a quick roundup of the tools that can be used to extract text.
Continue reading →
A common thing to expect from a web app is some kind of event feed:
peter liked your photo
joe is also going to see blur next week
your mum returned home
Another common thing is to receive emails when things happen:
your photo has been approved
you are now friends with angie
john sent you a message
22 Dec 2009Continue reading →
I've noticed a few things have a similar pattern of working:
- analyse environment and makes plans (logical orderly "left brain" thinking)
- get immersed in immediate goal, following intuition along the way (more creative "right brain" thinking)
- get lost or confused so goto step 1 (broken brain thinking)
24 Jun 2009In preparation for attempting a double dunwich dynamo (i.e. there and back) I made a web app to track my progress. I've had it on all week so far tracking my progress to and from work to observer how it works. I've noticed a few things:Continue reading →
- it actually works, yay!
- I appear to be able to cycle straight through buildings
- I can't cycle very fast
- this is a gross self inflicted invasion of privacy