HNHacker News
TopNewBestAskShowJobs

_paulc

209 karma · joined November 10, 2013

submissionscomments
_paulc··on Some gripes about nacl
The easiest way to get round the slightly odd build environment for NaCl is to just use TweetNaCl (http://tweetnacl.cr.yp.to/software.html) which just requires you to drop a single .c/.h file into your project - this isn't as performant as the reference code but in most cases this probably doesn't matter. The libsodium implementation seems overly complicated to me for most uses.

The NaCl API is reasonably simple and is fairly easy to wrap (plug - if anyone is looking for an example have a look at jim-nacl [1] which embeds into Jim TCL)

[1] https://github.com/paulchakravarti/jim-nacl

_paulc··on Python idioms I wish I'd learned earlier

    from __future__ import print_function
    import textwrap

    t = """
            Hello there
            This is aligned
    """

    # Need strip to get rid of extra NLs 

    print(textwrap.dedent(t).strip())
_paulc··on DragonFly BSD 4.0 released
What about 2.2.8 ?
_paulc··on Show HN: Hacker News client for Windows Phone
Only just downloaded but looks like a really good app which definitely fills gap, thanks. Liked the ability to swipe between the link and the comments - the only request I would have is to include the ability to switch to a mobile optimsed view of the site (using Readability, Google Mobilizer etc).
_paulc··on Ask HN: Can we talk about FreeBSD vs. Linux?
FreeBSD user since 2.0.5 (1995) - Linux since 0.95

I have always found that FreeBSD has had a much cleaner and more orthogonal feel as a system than any of the Linux distros and was always much more familiar for UNIX 'old hands'. If you come from the school where UNIX systems shouldn't have displays or the frippery associated with PCs and should be interacted with from a terminal you will probably be comfortable with FreeBSD. It shines as a rock-stable server O/S and in most cases trying to use it as a desktop is going to be fairly frustrating - the easiest way round this is not to bother and buy a MacBook Pro.

My view is that in the late 90s early 2000s adoption was impacted fairly significantly by two rather flaky major releases (3.0 & 5.0) where major bits of the system (SMP/Giant lock) were upgraded and took a long time to stabilise. These felt like a step back from the previous rock solid releases (2.2.8 & 4.11). Realistically the next really good release was the 8.0 series but since then the pace of development has really taken off and the 9.0 and 10.0 series are outstanding.

My view is that it is a great choice as a server O/S - with the significant commercial backing as an embedded O/S looks to have a strong future. I know that there will continue to be an interest in getting the desktop bits working but to be honest I think that this is a lost cause and should be dropped (though I acknowledge that the PC-BSD team doesn't agree)

One other point is that there is probably a chunk of the Linux userbase who probably shouldn't try FreeBSD as it really isn't aimed at them.

_paulc··on Ask HN: Can we talk about FreeBSD vs. Linux?
...and /bin/sh has tab completion anyway (set -o emacs)!
_paulc··on Ask HN: Can we talk about FreeBSD vs. Linux?
Really... /bin/sh has always had tab completion:

    set -o emacs
_paulc··on Making sure crypto remains insecure [pdf]
In most cases you only need a handful of functions - crypto_box_keypair/crypto_box/crypto_box_open for public key crypto and crypto_secretbox/crypto_secretbox_open for private key crypto. It is way simpler than any other crypt library I have used.
_paulc··on “The following surprisingly difficult problem was given to my son's Math Circle”
Except that I get a different answer if you do a very simple bruteforce:

    def check(n,am,pm,total):
        for x in range(1,n):
            if (am * x + pm * (n-x)) == total:
                return "AM: %d @ %d / PM %d @ %d" % (x,am,n-x,pm)
        return None


    def solve(total,birds):
        for am in range(1,total):
            for pm in range(1,am):
                result = list(map(lambda n:check(n,am,pm,total),birds))
                if all(result):
                    return result

    print(solve(3500,[10,16,26]))
_paulc··on Making sure crypto remains insecure [pdf]
TweetNaCl (http://tweetnacl.cr.yp.to/software.html) is dead easy use - just drop the .c & .h files into your code.
_paulc··on Scriptable Operating Systems with Lua [pdf]
You should have a look at Squirrel (http://www.squirrel-lang.org/) - it addresses most of the points above but is still very lightweight and easy to embed. The main disadvantage is that the documentation and community is not as well developed as Lua.
_paulc··on Better bash in 15 minutes
Any {Free,Open,Net}BSD system.
_paulc··on Microsoft Offers Office Online apps via Chrome Web Store
If you only use the CLI (using crosh) it works fine.
_paulc··on Simple Dynamic Strings library for C
Excellent news - the Redis source code is a really good source of high quality dependency-free C code and tends to be the first place I look.

Some time ago I forked the SDS code and added a set of additional utility functions around this for a project I was working on at the time (basic file reading, regex, LZF compression, Blowfish encrypt/decrypt, SHA256 etc).

This was from a fairly old SDS version so this looks like a good opportunity to sync up with the library version.

Repository is here: https://github.com/paulchakravarti/sdsutils

_paulc··on Named Pipes in Bash
ls -al | gzip -c | tee out.gz | gzip -dc
← PreviousPage 3 of 3