Skip to content

Instantly share code, notes, and snippets.

View pecavalheiro's full-sized avatar

Pedro Cavalheiro pecavalheiro

View GitHub Profile
@pecavalheiro
pecavalheiro / Convert .mov or .MP4 to .gif.md
Created March 8, 2024 13:23 — forked from SheldonWangRJT/Convert .mov or .MP4 to .gif.md
Convert Movie(.mov) file to Gif(.gif) file in one command line in Mac Terminal

This notes is written by Sheldon. You can find me with #iOSBySheldon in Github, Youtube, Facebook, etc.

Need

Convert .mov/.MP4 to .gif

Reason

As a developer, I feel better to upload a short video when I create the pull request to show other viewers what I did in this PR. I tried .mov format directly got after finishing recording screen using Quicktime, however, gif offers preview in most web pages, and has smaller file size.

This is not limited to developer, anyone has this need can use this method to convert the files.

@pecavalheiro
pecavalheiro / gist:44e5823e36c9785770ae7ffb45fb5d96
Last active July 23, 2023 17:42
Set up NFS in Linux -> Mac
# some tips: https://wiki.archlinux.org/title/NFS/Troubleshooting#Unable_to_connect_from_OS_X_clients
sudo apt install nfs-kernel-server
sudo chmod 777 /my/shared/dir
# edit /etc/exports and add:
/my/shared/dir <client ip address>(rw,sync,all_squash,subtree_check,insecure,anonuid=0,anongid=100,crossmnt,fsid=0)
sudo exportfs -a && sudo systemctl restart nfs-kernel-server
arch -arch x86_64 gem install pg -- --with-pg-config=/Applications/Postgres.app/Contents/Versions/14/bin/pg_config
@pecavalheiro
pecavalheiro / gist:9a3abe91a9d68f3474d15f9db641fc48
Created February 1, 2022 10:57
Ignore files with Ag + fzf
export FZF_DEFAULT_COMMAND='ag --hidden --ignore .ignore -g ""'
@pecavalheiro
pecavalheiro / thinkfan-install-steps-thinkpad-p15
Last active May 2, 2021 17:32
Lenovo Thinkpad P15 Fan Control with Thinkfan
Based on https://www.thinkwiki.org/wiki/How_to_control_fan_speed
Steps:
- Install Thinkfan https://github.com/vmatare/thinkfan
- Add `options thinkpad_acpi fan_control=1` to `/etc/modprobe.d/thinkpad_acpi.conf` (Debian Bullseye, testing)
- Add the following content to `/etc/thinkpad.conf`
# All core sensors + ACPI
sensors:
@pecavalheiro
pecavalheiro / gist:7c1699e8749d020d58c17b81da4f3113
Created April 20, 2021 13:38
Load firmware from USB during Debian installation
Download the Debian firmware package corresponding to your hardware (ex. https://packages.debian.org/sid/firmware-iwlwifi)
Open the data archive inside it and put the content of `lib/firmware/` into the root directory of your FAT USB device
Insert the USB device if the installer asks for it, switch via Ctrl+Alt+F2 to a virtual terminal and mount your device to `/lib/firmware/`, e.g. by using mount `/dev/sdb1 /lib/firmware`
@pecavalheiro
pecavalheiro / rspec_templates_copy.rake
Last active February 5, 2021 15:09
Generate RSpec templates for customization
# create rake task with the following content
namespace :spec do
namespace :templates do
# desc "Copy all the templates from rspec to the application directory for customization. Already existing local copies will be overwritten"
task :copy do
generators_lib = File.join(Gem.loaded_specs["rspec-rails"].full_gem_path, "lib/generators")
project_templates = "#{Rails.root}/lib/templates"
default_templates = { "rspec" => %w{controller helper integration mailer model observer scaffold view} }
@pecavalheiro
pecavalheiro / custom_plan.rb
Last active February 5, 2021 15:10 — forked from jerelmiller/custom_plan.rb
Zeus Test Console
# frozen_string_literal: true
require 'zeus/rails'
class Pry::Pager
def best_available
NullPager.new(pry_instance.output)
end
end
@pecavalheiro
pecavalheiro / rubocop.rb
Created September 20, 2018 12:23 — forked from brandonweiss/rubocop.rb
RuboCop hack for inline-disabling cops
#!/usr/bin/env ruby
def with_captured_stdout
old_stdout = $stdout
$stdout = StringIO.new
yield
$stdout.string
ensure
$stdout = old_stdout
end
@pecavalheiro
pecavalheiro / gist:bb44f6d60e4d4d6153cd8bf36f7494bd
Created January 9, 2017 17:06
Clear docker diff (/var/lib/docker/aufs/diff)
# remove exited container.
docker ps -a|grep Exit|cut -d' ' -f 1|xargs docker rm
# remove images as possible that has no name/tag
docker images -a|grep '^<none>'|tr -s ' '|cut -d' ' -f 3|xargs docker rmi