HNHacker News
TopNewBestAskShowJobs

fphilipe

1,088 karma · joined November 8, 2010

http://phili.pe

https://github.com/fphilipe

[ my public key: https://keybase.io/philipe; my proof: https://keybase.io/philipe/sigs/182uf1x4SUnMvtmLchInbgTL0X0b0qcRGe_g2T0KLDo ]

submissionscomments
fphilipe··on Comparing Git Workflows
Re --no-ff, you can flip the behavior so that you need --ff when you really want to fast forward by adding this config:

    [merge]
      ff = no
fphilipe··on A list of PostgreSQL libraries, tools and resources
psql2csv is just a wrapper around what you're describing. The point is that you don't have to write the "boilerplate" when all you need is a single query. Plus, it works nice with stdin and stdout, making it handy for queries stored in a file, or for piping the CSV to another program.
fphilipe··on Rescuing Resque again (2015)
The "again" in the title confused me. I knew that I read an article along these lines a while back so I thought this is yet another one. Turns out it was this post, which is dated October 23, 2015.
fphilipe··on Dear GitHub
My biggest gripe with GitHub has been the notification system. Personally I can't use the web UI for notifications because they bundle multiple notifications per issue. This leads to potentially missed notifications since it is up to me to scan the issue/PR for new comments.

My workaround has been to use email notifications exclusively. I have a Gmail filter that applies a label to all notifications and skips the inbox. Then in my mail client I have a smart mailbox that only shows me unread notifications with that label (or that folder, from an IMAP perspective). The smart mailbox then shows me a counter of unread notifications. This way I don't oversee comments when multiple ones are made in a PR.

Problem 1: No context in these notifications. It would be nice if these emails could show the code in question for diff comments or the entire comments thread.

Problem 2: Now what is really bad with these notification emails is that the link "view it on GitHub" sometimes no longer links to the comment I'm being notified of. This happens when the comment was made on a PR on a line of the diff that no longer exists, as sometimes is the case when new commits are pushed. I then have to go to the main PR page, expand all collapsed "foo commented on an outdated diff" comments and manually search for the comment in order to get the context and be able to reply.

By fixing problem 1, problem 2 would be automatically fixed with it and make my workflow much more productive. Is there anyone else annoyed by this?

fphilipe··on Show HN: Searchkit – React components for elasticsearch
Yes, this! People seem not to know when to use replaceState over pushState. And in my eyes this is a clear candidate for replaceState. (There are also examples the other way around, such as GitHub's PR tabs, drives me insane every time.)
fphilipe··on United Airlines Bug Bounty: An experience in reporting a serious vulnerability
Yes. But the point is that he was able to gain these two bits of information.
fphilipe··on Show HN: A React.js yearly calendar component
That's an interesting way of showing a calendar. Is this common practice? I've never seen this before. I think the only yearly calendar I've seen more often lately is the one used on the GitHub profiles (here's a d3 one: http://bl.ocks.org/mbostock/4063318).
fphilipe··on GNU Guile site redesign
Great redesign. Too bad they didn't bother with higher resolution images as it does look quite blurry on a retina screen. At least the logo could be an SVG.
fphilipe··on Ruby Tricks
One very obscure trick in ruby is the flip-flop operator. Never used it and I probably never will. There's an open issue to get rid of it[1]. Has anyone ever had a real use case for it?

[1]: https://bugs.ruby-lang.org/issues/5400

fphilipe··on Clocks Change Tomorrow [1918] [pdf]
So basically time stood still for an hour instead of, as nowadays, repeating the third hour of the day. I wonder if this was really the case or if it was just an "easier" way to explain it to the average Joe.
fphilipe··on PostgreSQL on the Command Line
csvkit is a great tool, use it everyday. Haven't used the sql2csv tool though. For exporting, I'd say that psql2csv [1], which is mentioned in the article, is still easier to use. It has the same interface as psql, except for an additional argument, the query. And, it doesn't depend on python, which might not be available.

[1]: https://github.com/fphilipe/psql2csv

fphilipe··on PostgreSQL on the Command Line
That's technically possible, but we never did this. I feel like that's going to complicate things once you start doing this.
fphilipe··on PostgreSQL on the Command Line
Thanks Craig, in those 4 years I've been using Postgres extensively your blog posts, talks, newsletter [1], guide [2] have been invaluable learning resources. Now I'm trying to contribute back to the community, too :)

1: http://postgresweekly.com

2: http://www.postgresguide.com

fphilipe··on PostgreSQL on the Command Line
We use the apartment gem pjungwir mentioned. I guess it works well if you have a small number of customers, each with lots of data. The other way around, lots of customers with little data would not scale, I'd say. As with any technique, there's pros and cons.

Pros:

- When you enter a psql session, you `SET search_path TO customer;` and that's it. No customer_id column in any table you have to remember setting in your WHERE clause.

- Same thing for rails console. At the beginning of the session you choose which customer you want to operate on.

- Similar for web requests. You just activate the right customer (e.g. based on subdomain) and that's it. Instead of `current_customer.posts.find(params[:id])` you can now simply do `Post.find(params[:id])`.

- Data is completely separated. It's almost impossible to have a bug causing data to spill from one customer to the other, which is quite high chance when you always have to remember to load data through the current customer.

Cons:

- Number of objects (tables, indexes, sequences) is multiplied by number of customers.

- Adding a new customer requires `pg_dump` to be present as it dumps the public schema (the blueprint), creates a new schema, and loads the dump into that schema.

- Migrations take longer as there are more objects to touch.

In our case, the pros outweigh the cons. One further advantage of the separate schemas is that, in theory, we could at any time start using completely separate databases, one for each customer or just one additional for a much larger customer that's eating up all resources on the DB.

fphilipe··on PostgreSQL on the Command Line
Funny, I just tested those yesterday. And they none of them seemed to work. And I think I had installed the newest version for the test. Anyways, I stand corrected. It's great to see some of these working now as the tab-completion is definitely better than psql's.
fphilipe··on PostgreSQL on the Command Line
Sure, you can use pgcli instead of psql. But it doesn't replace psql. In fact, most tasks described in the article cannot be accomplished with pgcli.

- it can't list schemas with \dn

- it can't list materialized views with \dm

- \dt <star>.users doesn't work as it does in psql, i.e. it just lists all tables due to the * instead of listing users tables in all schemas

- it can't use your editor with \e

- it can't input existing files with \i

- it can't redirect the output with \o

- it can't extract data with \copy

fphilipe··on To Master Vim, Use It Like Language
1. /\Vliteral search

2. C-e and C-y as long as the cursor position doesn't move out of the visible area

fphilipe··on Artificial Neural Networks for Beginners
At times my mechanical engineering courses at university felt like MATLAB tutorials. You had to use it, no way around it. Good luck once you're out of university and want to start your own thing, you won't be able to afford it. The computer science courses in contrast preferred open source tools over proprietary ones.
fphilipe··on Ramda-cli, a jq-like CLI tool for processing data with functional pipelines
Yes, it does. Even if it didn't, it's still confusing I'd say. Why not just call it ramda? Still quite short. Actually, R is the only single letter executable that I can think of. Chances of clashes are ~1/26 :)
fphilipe··on Ramda-cli, a jq-like CLI tool for processing data with functional pipelines
When I saw the example I thought this was using R, the statistical computing tool. But it's this tool itself that has an executable called R. I'd suggest renaming it.
fphilipe··on 14-Year-Old Boy Arrested for Bringing Homemade Clock to School
> Schools are generally very very extra worried about everything these days

Maybe in the US, but where I live, and I guess that's going to be the case in most countries, no one would ever think that this "suitcase" could be a bomb, regardless of the person's appearance. It's saddens me to see a country becoming more and more paranoid and living in fear.

As an example, we used to chase each other in school with BB-guns (here they don't have the orange marker distinguishing them from real guns). When a teacher saw us I'm sure the thought that these could be real never ever crossed their mind.

fphilipe··on Tmux Resurrect – Persists tmux environment across system restarts
By default it only restores a program that is whitelisted, such as vim, man, etc. You could, I guess, tell it to also restore ssh sessions. Here's a guide on how to do that: https://github.com/tmux-plugins/tmux-resurrect/blob/master/d...
fphilipe··on Email Regex that works 99.99%

    .+@.+
Should do the trick
fphilipe··on My Amazon S3 Mistake
Or, if your current branch has an upstream, `git diff @{u}`.
fphilipe··on Show HN: Pi Approximation using Monte Carlo
Nice work. I did a very similar simulation a year ago when I learned about MC in the context of particle filtering in a course about recursive estimation at ETH.

http://bl.ocks.org/fphilipe/6094255

fphilipe··on The US crackdown on not-so-harmless laser strikes
Here's a video of the helicopter covered in laser light: http://youtu.be/S92XUsfI5ng
fphilipe··on OS X Command Line Utilities
The -a flag is also great to open a file in a specific app, e.g. `open -a Safari logo.svg` or `open -a Marked README.md`.
fphilipe··on Xip.io: Wildcard DNS for everyone
You can test your app on mobile devices in the same network without having to mess with the hosts file.
fphilipe··on Has Anyone Ever Flipped Heads 76 Times in a Row?
Try this in Julia for some extra speed:

    best = 0
    i = 0
    while true
        i += 1
        count = 0
        face = 1
        while face == 1
            face = rand(0:1)
            count += face
        end
        if count > best
            best = count
            println("new record: $best in iteration $i")
        end
    end
fphilipe··on Graph.tk
Grapher is such a handy tool. Unfortunately, it hasn't received any updates since its introduction. There are a couple bugs, e.g. when right clicking on an equation in the sidebar, the context menu does not appear properly.
← PreviousPage 4 of 6Next →