jasonl99

Joined 12 years ago

Karma
110
Submissions
34
Member since
Dec 10
[ my public key: https://keybase.io/jasonl99; my proof: https://keybase.io/jasonl99/sigs/ywEkMgK-gBylvQgMx3uzXHyNxzFFyk4krDj_Jm8QqhY ]
View on Hacker News

Recent submissions

Comment · 4 years ago
I've been playing around with crystal for years, and absolutely love it (I'm a full-time ruby dev using Sequel as an ORM). I wish I had more time to spend with crystal. Kemal (referenced above) is really good, and excellent with websockets.

That said, I started playing around with the Marten framework and while it's really new, it's an amazingly good start. I absolutely love the way that models automatically create migrations. Using Sqlite as a default is good for probably 99% of uses cases, and absolutely good for learning the framework (Sqlite itself is amazingly powerful).

I've been wondering what new shiny toys I was going to play around with over vacation during the holidays, and I now have my answer :).

Comment · 5 years ago
“The reasonable man adapts himself to the world: the unreasonable one persists in trying to adapt the world to himself. Therefore all progress depends on the unreasonable man.”

― George Bernard Shaw, Man and Superman

I've always used this as an excuse for what might be considered being weird (at least that's what my family tells me).

Comment · 5 years ago
Comment · 5 years ago
I agree, and I can't believe more people haven't mentioned it here. I am not going to rehash what anyone can read at the linked site, but it seems like an absolutely great project, and seems to be flying under everyone's radar.
Comment · 6 years ago
I tried Strava, but it just wasn't detailed enough for me. I ended up finding smashrun.com. Granted it's only for running, but it's phenomenal. I've been a subscriber for years now, and I can't say enough positive things about it.
Comment · 6 years ago
One thing I've found useful when listing tables that you can't exactly remember the name, you can use wildcards.

\dt cust*

will list all tables that start with "cust". It works with other commands as well (like \l).

Also, I like to split my terminal using tmux, and have a neovim editor in one pane, psql in the other. I just keep doing "\i file_name.sql" as I perfect the query.

I definitely agree wholeheartedly about pspg. They even have a FoxPro theme, which has a special place in my heart :).

Comment · 6 years ago
I can't figure out how to get it configured as a pager (in postgres). I've been using pspg set in my .psqlrc.

I changed it to \setenv PAGER 'vd' and I just get a big chunk of text with no ability to navigate columns. How are you doing it with mysql?

Comment · 7 years ago
Comment · 7 years ago
I actually started binding my CAPSLOCK key to F5, and I have F5 set as a tmux attention key, but I've never had too much problem with left pinky finger hitting escape..

A side benefit of this is that F5 is mapped to refresh for a lot of apps (Firefox, for one) so I can hit capslock to refresh a page.

Comment · 7 years ago
Living in Florida, and being married to a wife who considers the presence of cockroaches a dealbreaker for living together, I've managed to keep a roach-free home for several years now without _too_ much effort.

I use this as one part of a multi-pronged approach, dusting around areas they would need to cross to get into the house. It's super-cheap and lasts a long time.

It does need to stay relatively dry, though. When I've needed to repair drywall on occasion, I dust a bunch in the opening figuring it will basically last forever and not get wet.

I also use a bait with boric acid placed in various random areas. I also use a product that slowly emits a vapor in closed areas that basically neuters any roaches that get near it (for places like under the sink). Finally I used Home Defense spray around the outside.

I treat the condo once every three months, and it takes about 30 minutes. I've seen maybe two cockroaches in the past few years, and both were belly-up.

Comment · 7 years ago
It's actually towards the middle of the article I linked (in italics). Search for "So what ARE they worried about? I wrote a little story to show you"
Comment · 7 years ago
Comment · 7 years ago
Comment · 8 years ago
There's a really cool way to do this that I learned about with ruby here https://gist.github.com/O-I/3e0654509dd8057b539a

Here's a quick demo class that shows the technique. It's amazingly simple.

class Demo EXAMPLE = { "75%" => 0.75, "15%" => 0.15, "9%" => 0.09, "1%" => 0.01 }

  def self.sample(choices = EXAMPLE)
    choices.max_by { |_, weight| rand ** (1.0 / weight) }.first
  end

  def self.show(samples: 10000)
    items = samples.times.map {sample}
    items.each_with_object(Hash.new(0)) do |item, counts|
      counts[item]+=1
    end.sort_by(&:last).reverse.to_ h
  end
end

# Demo.show # => {"75%"=>7480, "15%"=>1525, "9%"=>901, "1%"=>94}

Edit: Sorry for the bad formatting. I added a gist:

https://gist.github.com/jasonl99/25d3c922d73f10a75fe228c2de3...

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton