Skip to content

Instantly share code, notes, and snippets.

View rhiroyuki's full-sized avatar
🏠
Working from home

Ricardo Eihara rhiroyuki

🏠
Working from home
  • Brazil
View GitHub Profile
# CEDILLA
# replace ć with ç when using US international with dead keys' keyboard layout in Linux
sudo echo "GTK_IM_MODULE=cedilla" >> /etc/environment
sudo echo "QT_IM_MODULE=cedilla" >> /etc/environment
# keyboard layouts
# localect changes the settings that should be used in programs (including Xorg server) started after, while setxkbmap changes keyboard options for the currently running Xorg server. Also setxkbmap allows more fine-grained control, and allows switching between varios layouts during runtime. (https://superuser.com/a/1330439)
# https://wiki.archlinux.org/index.php/Xorg/Keyboard_configuration
# list current keyboard layout
setxkbmap -query
# list available models/options/variants
localectl list-x11-keymap-models
kubectl get pods --all-namespaces
kubectl config get-contexts
kubectl config use-context {some-context-here}
kubectl exec -it --namespace {namespace} {pod-name} bash
kubectl --namespace {namespace} delete pod {pod-name}

Ecto

Getting the first record

In ActiveRecord

User.first

In Ecto

def old_method
100000.times do
sleep(1)
end
end
def new_method
100000.times do
sleep(2)
end

Installing rmagick in old ruby versions on Arch:

$ sudo pacman -S libmagick6 # Make sure it's the most recent updated 6 version.

$ PKG_CONFIG_PATH=/usr/lib/imagemagick6/pkgconfig gem install rmagick -v 2.16.0

Make sure imagemagick6 is in the last version: rmagick/rmagick#785

@rhiroyuki
rhiroyuki / asdf.sh
Last active July 19, 2019 20:27
just shell things
Delete multiple branches with similar name
git branch | grep add-stock-source | xargs git branch -D
From godlygeek/tabular, https://github.com/godlygeek/tabular
To "tabularize":
Select lines then
:'<,>'Tabularize /:
or
:'<,>'Tabularize /:\zs