Hacker Newsnew | past | comments | ask | show | jobs | submit | cerved's favoriteslogin

Here's an interesting bit of...abuse :) Since Bash is effectively stringly-typed, it can be used as a functional programming language, with pipes similar to function composition.

e.g.: wtfp.sh

    #!/usr/bin/env bash

    map() {
      local fn="$1"

      local input
      while read -r input; do
        "${fn}" "${input}"
      done
    }

    reduce() {
      local fn="$1"
      local init="$2"

      local input
      local output="${init}"

      while read -r input; do
        output="$("${fn}" "${output}" "${input}")"
      done

      echo "${output}"
    }

    filter() {
      local fn="$1"

      local input
      while read -r input; do
        "${fn}" "${input}" && echo "${input}"
      done
    }

    add() {
      echo $(( $1 + $2 ))
    }

    increment() {
      echo $(( $1 + 1 ))
    }

    square() {
      echo $(( $1 * $1 ))
    }

    even() {
      return $(( $1 % 2 ))
    }

    sum() {
      reduce add 0
    }

    map increment | map square | filter even | sum
...then:

    $ printf "%s\n" 1 2 3 4 5 | ./wtfp.sh
    56

And I have one that unifies _both_ to `clip` so you can put the same command in both sides of the pipe, e. g. to turn a line-delimited blob on your clipboard to a space-separated one:

    clip | tr '\n' ' ' | clip
https://github.com/svieira/dotfiles/blob/a3654d6a194e3689978...

    # Use clipboard in shell pipelines
    # clip | xargs echo           # uses pbpaste
    # ps -A | grep search | clip  # uses pbcopy
    clip() {
      [ -t 0 ] && pbpaste || pbcopy
    }

If you need to run tmux in git bash, this worked for me:

1. Installs msys2 (which includes pacman package manager) # can be done separately from your git installation

2. pacman -S tmux # install tmux to msys2 within msys2

3. Copy tmux.exe and msys-event-2-1-7*.dll from msys2 to C:\Program Files\Git\usr\bin # may be a different version msys-event

4. Uninstall msys2! This was important to me because I found edge cases where msys2 did not honor directory links as "not msys files" and it borked things. YMMV


You think all the existing search engineers haven't thought of using the domain age for the signal and tried it yet? And if you did, you think SEO people wouldn't figure it out and take advantage of it? This cycle of adversarial game on this particular signal has already gone through the full cycle - https://www.searchenginejournal.com/ranking-factors/domain-a...

And what makes you think search engines don't take quantity and breadth of content ? And, why do you think SEO won't be able to take advantage of that ?

Most people commenting and lamenting about search quality need to understand how much of search quality is an adversarial game, that neither side (search engine vs SEO people who want to manipulate the result in their favor) can win decisively forever. And generally it's not for the lack of trying the quality hasn't improved as much - it's just some areas it's more difficult to make progress due to more money spent on making it difficult for the search engines.

What I am most disappointed about Google and search engines in general isn't so much about ranking simplistic things like generic recipe or product reviews and stuff like that - most recipes for general items are all similar, and product review is inherently commercial that reviews always have been biases (short of using Consumer Reports, almost all magazine review articles are biases and influenced by manufacturers). What I am most disappointed is the lack of improvements in UI and retrieval/recall. Interactive UI that can narrow down search space iteratively and interactively so that I can describe what I want in more precise way is lacking. Where is the virtual librarian that I can talk to to narrow down what I want in a step by step way ? Instead of a single search query being the only input, why shouldn't search engine ask for clarifications and let users more precisely describe what they want ? Human languages and human brain just don't produce a single phrase to describe what we want - it takes sentences and questioning back and forth to determine what we want, and we often need more input to realize and describe what we actually want. And all search engines have failed to provide such an interface. And my bet is that whoever can crack that would beat all other search engines, since users can give better, higher quality input for the search to find.


Totally possible, I've following helper in my .zshrc

  # fshow - git commit browser
  fshow() {
    git log --graph --color=always HEAD \
        --format="%C(auto)%h%d %s %C(blue)(%aN) %C(black)%C(bold)%cr" "$@" |
    fzf --ansi --no-sort --reverse --tiebreak=index --bind=ctrl-s:toggle-sort \
        --bind "j:down,k:up,q:abort,ctrl-m:execute:
                  (grep -o '[a-f0-9]\{7\}' | head -1 |
                  xargs -I % sh -c 'git show --color=always % | less -R') << 'FZF-EOF'
                  {}
  FZF-EOF"
  }

Don't forget to use Partial Indexes on jobs/tasks tables with queries like WHERE status = 'pending'

More: https://use-the-index-luke.com/sql/where-clause/partial-and-...


MySQL and Microsoft SQL server also support SKIP LOCKED.

Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: