Recently I needed a secure way to protect a service with a passphrase. I settled on the solution of using passlib verify that password, and learned along the way the important lesson of never trying to roll your own cryptographic code.
This post is sort of an amalgamation of solutions I’ve found on several blogs, tutorials, and SO posts I’ve used regarding SSH keys. I cover key generation and authentication, removing passwords from keys, and identifying the key finger print.
I had some trouble this weekend figuring out how to open a text file in Angular. My luck turned around when I found this StackOverflow question. The question addressed loading an image, but I was able to fiddle with this Plunker example until I was able to load text files. (Basically, I replaced every instance of “readAsDataURL” in the upload.js file with “readAsText”.)
In order to create your own modules in Node, you attach your own classes or functions to an exports or module.exports object. Then you can access those items in the required module. Suppose we have a file named classes.js. If we wanted to import the ClassX and ClassY classes from that module, then we would add the following lines at the end of the classes.js file:
I had the problem this week of sending Javascript objects over HTTP; although you can easily send objects using JSON, you cannot transmit the object methods. I had intended to build a data structure on the server, send it over to the client where different attributes would be changed, and then send the object back to the server where I had hoped to use the object methods, except the methods did not exist any longer.
Yes, you can do coordinate reference system transformations in Javascript. (I know, I’m shocked also.) I found proj4js on GitHub, which is a port of an older project, PROJ.4. The proj4js library is very easy to use. All you need to do is find the specification strings at spatialrerefence.org of the two projections/datums you are interested in and you’re ready to go.
In this post I’ll provide some code for a general tree data structure in Javascript. I found a lot of packages on npm that provided binary trees, red-black trees, and tries [sic], but nothing that provided a general tree data structure. As with most implementations of data structures that I’ve seen, this implementation defines a Node object, and the large scale structure that we’re interested in, a Tree object. The Node object knows about other Node objects, specifically it’s parent and children. The Tree object is responsible for connecting these nodes in a tree structure. We could use a very, very similar Node object to build a different kind of tree, or a linked list, or a stack, or whatever.
I was interested in performing system calls from Swift, and I found a resource that I had to modify somewhat. I imagine that the language has changed since that post was written. At any rate, here is the working code,
Today I Googled something like “julia lang compiled” for the umpteenth time in several months, and then I remembered that Nimrod existed, except it’s Nim these days, and it might make it to version 1.0 any week now. I decided to look around a bit, and I discovered that the documentation seems to have improved, and the language has gotten more fleshed out. I decided to try two small things I’ve been doing a lot of lately, SSH-ing and HTTP-getting and posting, and see what they look like in Nim.
Sometimes you download something and install it from source, and then you realize you need to uninstall it for whatever reason. First you need cd into the installation directroy, re-install with the --record option, and then use xargs to remove everything [1].