Actualizaciones - page 7

40 flexiones
00:09:59 min
40 kcal

Una imagen del monitor de ordenador junto a una fiambrera con comida.

Martes. Planaso ahí.

Una pulsera.

¡A Pythonear se ha dicho! #PyConES18 #PyConES2018

If you’re working on a Git repository and your team makes exhaustive use of branches, every time you run git fetch, Git will download new commits on those remote branches, even if you don’t plan on having local branches tracking their remote pair. Once those branches are removed by your teammates in your remote repositories, git fetch won’t download new commits for those branches, but it won’t notify you that the branch has been removed either.

If you want to remove remote branches in your local repository that have been already removed from the remote repository, you can run git fetch --prune. This will download new commits from existing or new branches, but also if a branch has been removed from the remote repository, you’ll have that branch removed from your local copy as well.

If you don’t want to forget about prune, you can also configure your Git repository to automatically prune removed branches by running git config remote.origin.prune true. Replace origin with the name of the remote repository you have the setting to have effect on. Every time you run git fetch on that remote, deleted branches will get removed too.

NandGame →

As seen this morning in Hacker News, NandGame looks like a cool game where you have to implement a circuit on each level. You start the game on level 1 without nothing but a NAND gate, and you have to build different logic gates and arithmetical circuits to pass to the next level.

Requires a mouse, don’t know how will it work on touchscreens.

I made a pre-commit hook that forbids committing directly to master or devel branches on Git. This is something that you don’t want to do if you find yourself working under some Git model such as GitFlow or GitHubFlow. Specially if you are using GitFlow. Specially if you are not alone in your project.

Yes, I know that you can fix this after you make the commit by creating a new branch and then moving back the branch pointer for devel or master a few commits back, but I would waste less time if Git actually forbid me to make the commit in first place.


BRANCH=$(git rev-parse --abbrev-ref HEAD)

BOLD=$(tput bold)
YELLOW=$(tput setaf 3)
GRAY=$(tput setaf 8)
RESET=$(tput sgr0)

for branch in $FORBIDDEN_BRANCHES; do
 if [ "$branch" == "$BRANCH"  ]; then
  echo "${BOLD}You are currently in branch ${YELLOW}$BRANCH${RESET}."
  echo "    Committing from this branch would be a bad idea."
  echo "    Would you mind... changing to a different branch first?"
  echo "${GRAY}(Or you know, using the -n flag to bypass this message."
  echo " Hey, don't look at me! I'm a script, not a police officer!)"
  echo $RESET
  exit 1

You can also download the hook as a shell script. I don’t mind. It wouldn’t be that long if I didn’t declare all these variables but, hey, colors!

The hook in action
The hook in action. Note that I can still force the commit if I need or want to by using `git commit -n` (read the docs).

Sometimes I wish we had something like SSHFS but for executable files.

Yes, I’m aware of the ssh [hostname] [command] syntax. But, just like when you mount a remote file system using something like SSHFS or DAVFS, your local applications can interact with that remote directory without them ever noticing files are not actually in your computer (aside from the network latency), I just wish the same could be done with executable files.

You run (or another application runs) ./hello, and that gets translated into ssh foo@ /usr/bin/hello. stdin is piped to the remote server, stdout is piped from the remote server. It doesn’t matter if you are on a Mac and /usr/bin/hello is a Linux ELF binary file, because the file is actually executed on a remote server. A use case for this would be being able to run remote debuggers without having to rely on fancy IDEs that support this feature, such as debugging a remote Node.js or Python script in a server or in a Vagrant box.

I guess the people behind Plan 9 actually had their point.

Always read your PKGBUILDs →

If you don’t read the PKGBUILD file whenever you download something from the AUR repositories, you are exposing yourself to terrible security issues, as the world has recently seen.

Malware was spotted in the AUR repositories of Arch Linux last week. Someone modified the PKGBUILD of a package to add a curl call in the script file, as can be seen here (as long as they don’t purge the blob object from the repository, because they stripped out the commit from the history).

I would file this tip in the same category as “don’t just curl bash pipe stuff you find at GitHub”, but it’s getting late and I don’t have time for entering in the rabbit hole argument of where do we put the limit on trusting the software and the installers we put in our machines.

TIL: Jekyll’s incremental builds do not trigger rebuilds of pages that make use of the site.posts variable, which means that, if you have a page that lists recent posts using site.posts, and you update a post, the page won’t be regenerated. This can be fixed by adding regenerate: true to those pages that you want to always be regenerated on each incremental rebuild.

I make use of incremental builds to speed up the compilation time of my site in development mode, but I also have a lot of feed pages on my site, and it always drove me bonkers that my feed pages were not being regenerated, because apparently I didn’t see this footprint.

Enough with the font smoothing

I seriously condemn websites that change the font smoothing of blocks of text in their CSS styles. I seriously hate font-smoothing, -webkit-font-smoothing and -moz-osx-font-smoothing and I strongly believe that the world would be better if those goddamn’d properties didn’t exist. Ye, I understand that subpixel antialiasing doesn’t make sense on high DPI screens and that HDPI screens are usually better with grayscale scaling. But most websites change the aliasing in awful ways. Why can’t you apply a media query to only change the font smoothing on bigger displays? On my non-HDPI 1080p Dell display, grayscale antialiasing makes me want to rip off my eyes.