Skip to content

Instantly share code, notes, and snippets.

Fernando Basso FernandoBasso

Block or report user

Report or block FernandoBasso

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@rodolfobandeira
rodolfobandeira / to_bool.md
Created Apr 7, 2019
Convert string to boolean in Ruby
View to_bool.md
  def to_bool(string)
    if string == true || string == 1 || string =~ (/(true|1)$/i)
      true
    else
      false
    end
  end
@arturfog
arturfog / gnome-terminal-bold-fonts.sh
Created Jan 2, 2019
disable bold fonts in gnome terminal
View gnome-terminal-bold-fonts.sh
dconf write /org/gnome/terminal/legacy/profiles:/:<id>/allow-bold false
@Yevgnen
Yevgnen / emacs26.sh
Created Jun 3, 2018 — forked from kissge/emacs26.sh
Compile Emacs 26 on Ubuntu 16.04
View emacs26.sh
mkdir emacs
cd emacs
git init
git remote add origin https://github.com/emacs-mirror/emacs.git
git fetch --depth 1 origin emacs-26
git reset --hard FETCH_HEAD
sudo apt install autoconf make gcc texinfo libgtk-3-dev libxpm-dev libjpeg-dev libgif-dev libtiff5-dev libgnutls-dev libncurses5-dev
./autogen.sh
./configure
make
@cheungnj
cheungnj / script.sh
Last active Nov 4, 2019
Convert asciidoc to Github Flavored Markdown
View script.sh
# Adapted from https://tinyapps.org/blog/nix/201701240700_convert_asciidoc_to_markdown.html
# Using asciidoctor 1.5.6.1 and pandoc 2.0.0.1
# Install pandoc and asciidoctor
$ sudo apt install asciidoctor
$ sudo wget https://github.com/jgm/pandoc/releases/download/2.0.0.1/pandoc-2.0.0.1-1-amd64.deb
$ sudo dpkg -i pandoc-2.0.0.1-1-amd64.deb
# Convert asciidoc to docbook using asciidoctor
@bisqwit
bisqwit / textbox.hh
Last active Apr 1, 2019
Abstraction for 2-dimensional text strings with VT100 linedrawing support; and a tree structure visualizer function
View textbox.hh
#include <string>
#include <vector>
#include <algorithm>
/* textbox: Abstraction for 2-dimensional text strings, with VT100 linedrawing support */
/* Copyright (c) 2017 Joel Yliluoma - http://iki.fi/bisqwit/ */
/* License: MIT */
/* Requires a C++17 capable compiler and standard library. */
struct textbox
{
View tsfaq.md

Pseudo-Variadic arguments aka How do I change the return type of a function?

Until https://github.com/Microsoft/TypeScript/issues/5453 is implemented, you'll need to create multiple overloads, one for each number of arguments. For example, this is the type definition of a function which takes a function and returns a function with the same arguments but the result wrapped in a Promise.

declare function wrapPromise<R>(f: () => R): () => Promise<R> 
declare function wrapPromise<A1, R>(f: (a1: A1) => R): (a1: A1) => Promise<R>
declare function wrapPromise<A1, A2, R>(f: (a1: A1, a2: A2) => R): (a1: A1, a2: A2) => Promise<R>
declare function wrapPromise<A1, A2, A3, R>(f: (a1: A1, a2: A2, a3: A3) => R): (a1: A1, a2: A2, a3: A3) => Promise<R>
declare function wrapPromise<A1, A2, A3, A4, R>(f: (a1: A1, a2: A2, a3: A3, a4: A4) => R): (a1: A1, a2: A2, a3: A3, a4: A4) => Promise<R>
// etc. 8 arguments should be enough for everyone :-P
@romainl
romainl / redir.vim
Last active Dec 28, 2019
Redirect the output of a Vim or external command into a scratch buffer
View redir.vim
function! Redir(cmd)
for win in range(1, winnr('$'))
if getwinvar(win, 'scratch')
execute win . 'windo close'
endif
endfor
if a:cmd =~ '^!'
let cmd = a:cmd =~' %' ? substitute(a:cmd, ' %', ' ' . expand('%:p'), '') : a:cmd
let output = system(matchstr(cmd, '^!\zs.*'))
else
@joyrexus
joyrexus / README.md
Last active Jan 20, 2020
collapsible markdown
View README.md

collapsible markdown?

CLICK ME

yes, even hidden code blocks!

print("hello world!")
View formiga.md

A Parábola da demissão da formiga desmotivada

"Todos os dias, uma formiga chegava cedinho ao escritório e pegava duro no trabalho. A formiga era produtiva e feliz.

O gerente marimbondo estranhou a formiga trabalhar sem supervisão. Se ela era produtiva sem supervisão, seria ainda mais se fosse supervisionada. E colocou uma barata, que preparava belíssimos relatórios e tinha muita experiência, como supervisora.

A primeira preocupação da barata foi a de padronizar o horário de entrada e saída da formiga. Logo, a barata precisou de uma secretária para ajudar a preparar os relatórios e contratou também uma aranha para organizar os arquivos e controlar as ligações telefônicas.

O marimbondo ficou encantado com os relatórios da barata e pediu também gráficos com indicadores e análise das tendências que eram mostradas em reuniões. A barata, então, contratou uma mosca, e comprou um computador com impressora colorida. Logo, a formiga produtiva e feliz, começou a se lamentar de toda aquela movimentação de papéis e re

@k-takata
k-takata / bash-completion-slowness-on-msys2.md
Created May 13, 2015
Bash-completion is very slow on MSYS2
View bash-completion-slowness-on-msys2.md

Bash-completion is very slow on MSYS2

Bash-completion is very slow on MSYS2 when the current user is a domain user. This describes the cause and the solutions.

Cause

Expansion of ~* is very slow when you use a domain user. For example:

You can’t perform that action at this time.