Skip to content

Instantly share code, notes, and snippets.

View jhbabon's full-sized avatar
🦊

Juan Hernández jhbabon

🦊
View GitHub Profile
@bbqtd
bbqtd / macos-tmux-256color.md
Last active December 5, 2024 13:26
Installing tmux-256color for macOS

Installing tmux-256color for macOS

  • macOS 10.15.5
  • tmux 3.1b

macOS has ncurses version 5.7 which does not ship the terminfo description for tmux. There're two ways that can help you to solve this problem.

The Fast Blazing Solution

Instead of tmux-256color, use screen-256color which comes with system. Place this command into ~/.tmux.conf or ~/.config/tmux/tmux.conf(for version 3.1 and later):

@JoeyBurzynski
JoeyBurzynski / 55-bytes-of-css.md
Last active December 3, 2024 05:06
58 bytes of css to look great nearly everywhere

58 bytes of CSS to look great nearly everywhere

When making this website, i wanted a simple, reasonable way to make it look good on most displays. Not counting any minimization techniques, the following 58 bytes worked well for me:

main {
  max-width: 38rem;
  padding: 2rem;
  margin: auto;
}
@franciscoj
franciscoj / vid2gif.sh
Created August 4, 2016 14:50
Transform a video into an animated gif.
#!/bin/sh
# Extracted from: http://blog.pkh.me/p/21-high-quality-gif-with-ffmpeg.html#usage
palette="/tmp/palette.png"
filters="fps=15,scale=640:-1:flags=lanczos"
ffmpeg -v warning -i $1 -vf "$filters,palettegen" -y $palette
ffmpeg -v warning -i $1 -i $palette -lavfi "$filters [x]; [x][1:v] paletteuse" -y $2
@junegunn
junegunn / gist:f4fca918e937e6bf5bad
Last active November 4, 2024 10:33
Browsing git commit history with fzf
# fshow - git commit browser (enter for show, ctrl-d for diff, ` toggles sort)
fshow() {
local out shas sha q k
while out=$(
git log --graph --color=always \
--format="%C(auto)%h%d %s %C(black)%C(bold)%cr" "$@" |
fzf --ansi --multi --no-sort --reverse --query="$q" \
--print-query --expect=ctrl-d --toggle-sort=\`); do
q=$(head -1 <<< "$out")
k=$(head -2 <<< "$out" | tail -1)
@ArtemGr
ArtemGr / system.rs
Last active December 22, 2023 07:08
Read lines from a pipe as soon as they come out (useful for filtering).
#![feature(mpsc_select, box_syntax)]
use std::io;
use std::process::Command;
use std::sync::mpsc::{channel, Receiver, Select};
use std::string::FromUtf8Error;
use std::thread::spawn;
#[derive(Debug)]
enum PipeError {
# Has your OS/FS/disk lost your data?
# cd to the directory containing your project repositories and run the command
# below. (It's long; make sure you get it all.) It finds all of your git repos
# and runs paranoid fscks in them to check their integrity.
(set -e && find . -type d -and -iname '.git' | while read p; do (cd "$(dirname "$p")" && (set -x && git fsck --full --strict)); done) && echo "OK"
# I have 81 git repos in my ~/proj directory and had no errors.
@soveran
soveran / sc
Created June 7, 2013 22:56
Command line reference of HTTP status codes for rc shell.
#!/usr/bin/env rc
if (! ~ $#* 1) {
echo 'Usage: sc <pattern>'
} else {
grep $1: $0
}
# 100: Continue
# 101: Switching Protocols
#!/usr/bin/env ruby
#
# Git commit-msg hook. If your branch name is in the form "username/vod-45-new-feature"
# it automatically adds the prefix "[VOD-45]" to commit
# messages.
#
# Example
# =======
#
# git checkout -b bob/vod-45-some-cool-feature
@karmi
karmi / Gemfile
Last active August 4, 2021 13:53 — forked from rkh/Gemfile
Sinatra + EventSource JavaScript Streaming
source "http://rubygems.org/"
gem "sinatra", "~> 1.3.0"
gem "thin"
@tenderlove
tenderlove / app.ru
Created June 4, 2012 16:39
An adapter for Rack that makes it look like node
##
# Make Rack look like node.
#
# http://youtu.be/Zp91yUH-zAw
#
# Run like this:
#
# $ unicorn -I. app.ru
require 'node_adapter'