Skip to content

Instantly share code, notes, and snippets.


Fran Casas franciscoj

View GitHub Profile
franciscoj / Makefile
Created April 17, 2022 16:47
Run go test, using grc for colorizing, make and vim-test
View Makefile
# Build the test command allowing to overwrite some of the options.
TEST_FLAGS?=-v -race -count 1 -timeout 3s
.PHONY: test
franciscoj /
Created April 18, 2020 21:08
Tail but in aprox 30 lines of Rust
// This is not at all like tail. Will fail in many scenarios but it was funny to write it :)
use std::fs::File;
use std::io::prelude::*;
use std::io::{BufReader, SeekFrom};
use std::thread::sleep;
use std::time::Duration;
fn main() {
let file_name = "some_file.log";
let file = File::open(file_name.clone()).unwrap();
View gist:63004b5eb919e9ef018a0954d07ea622
irb(main):001:0> h =[])
=> {}
irb(main):002:0> h[:hello] << :fran
=> [:fran]
irb(main):003:0> h[:hallo] << :andreas
=> [:fran, :andreas]
irb(main):004:0> h
=> {}
irb(main):005:0> h[:asdf]
=> [:fran, :andreas]
View traefik.config.toml
# Config for a dev app with rails + webpacker
rule = "Host(``) && PathPrefix(`/sockjs-node`)"
service = "webpack-dev-server"
entrypoints = ["https"]
priority = 2
franciscoj / docker-compose.yml
Last active June 5, 2021 18:45
Docker for local dev reverse proxy
View docker-compose.yml
version: '3'
image: traefik:v2.0 # The official Traefik docker image
network_mode: host # Allows traefik to talk to your host machine
- "80:80"
- "443:443"
- "8080:8080" # The Web UI
View no_focus.rb
# If a spec in the suite is marked with focus on the CI it will fail.
RSpec::Matchers.define :have_no_focus do
match { |ex| !ex.metadata[:focus] }
RSpec.configure do |config|
config.before(:each) do |example|
franciscoj / fira-code.conf
Last active October 28, 2018 12:01
Use Fira Code everywhere as monospace
View fira-code.conf
<!-- ~/.config/fontconfig/fira-code.conf -->
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<match target="pattern">
<test qual="any" name="family"><string>monospace</string></test>
<edit name="family" mode="assign" binding="same"><string>Fira Code</string></edit>
franciscoj / example.ex
Created October 5, 2018 08:17
Remove last line feed from multiline string in elixir
View example.ex
content = """
assert content == "hello!\n"
content = """
franciscoj / unicodeces.vim
Last active April 17, 2018 12:49
Unicode things for Vim
View unicodeces.vim
" A couple of nice things your vim can use when you're dealing with unicode text.
" Taken from
" Highlight all non ascii characters
syntax match nonascii "[^\x00-\xFF]"
highlight nonascii guibg=Red ctermbg=2
" Find any non ascii character
nnoremap <leader>na /[^\x00-\xFF]<CR>
franciscoj /
Created December 21, 2017 11:39
Get the resolution from a list of images
for file in *.png; do identify $file | awk '{print $1, $3}'; done