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
@rhiroyuki
rhiroyuki / peepcode-bright.zsh-theme
Last active March 25, 2017 05:18
Peepcode for dark terminal colors
#
# Based on Geoffrey Grosenbach's peepcode zsh theme from
# https://github.com/topfunky/zsh-simple
#
git_repo_path() {
git rev-parse --git-dir 2>/dev/null
}
git_commit_id() {
" Use Vim settings, rather then Vi settings (much better!).
" This must be first, because it changes other options as a side effect.
set nocompatible
" Load matchit.vim, but only if the user hasn't installed a newer version.
if !exists('g:loaded_matchit') && findfile('plugin/matchit.vim', &rtp) ==# ''
runtime! macros/matchit.vim
endif
" Set neovim to use truecolors
@rhiroyuki
rhiroyuki / gist:0c56c3f4466a6326fa11de11ea793526
Last active September 17, 2018 03:05
How to flash GH60/OK60 hex file into keyboard

Import/create your file in this URL. Then generate the .hex file. https://config.qmk.fm/

Flash your keyboard by pressing the buttom on the back.

To check if it is indeed in flash mode, check it by running $ lsusb it should show the name of the microcontroller in one of the items (in my case ATMEGA32U4)

$ sudo dfu-programmer erase atmega32u4

$sudo groupadd docker $sudo gpasswd -a $USER docker Either do a $newgrp docker or log out/in to activate the changes to groups. Test it $docker run hello-world

Follow the instructions to install docker-compose Better to follow through the below link since it will be more new https://docs.docker.com/compose/install/

https://docs.docker.com/engine/examples/running_ssh_service/#run-a-test_sshd-container
```
FROM ubuntu:16.04
RUN apt-get update && apt-get install -y openssh-server
RUN mkdir /var/run/sshd
RUN echo 'root:screencast' | chpasswd
RUN sed -i 's/PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config
@rhiroyuki
rhiroyuki / crontabs.md
Last active November 21, 2018 14:24
crontab

*nix solution for scheduled tasks

See all cronjobs

$ crontab -l

Edit cronjobs

$ crontab -e

Remove all cronjobs

$ crontab -r

@rhiroyuki
rhiroyuki / dummy.md
Last active November 21, 2018 14:33
dd

Dog Walking

@rhiroyuki
rhiroyuki / redis_stream.md
Created November 28, 2018 13:15
Redis Stream

Memory usage and saving loading times

Because of the design used to model Redis streams, the memory usage is remarkably low. It depends on the number of fields, values, and their lengths, but for simple messages we are at a few millions of messages for every 100 MB of used memory. Moreover, the format is conceived to need very minimal serialization: the listpack blocks that are stored as radix tree nodes, have the same representation on disk and in memory, so they are trivially stored and read. For instance Redis can read 5 million entries from the RDB file in 0.3 seconds. This makes replication and persistence of streams very efficient.

It is planned to also allow deletion of items in the middle. This is only partially implemented, but the strategy is to mark entries as deleted in the entry flag, and when a given ratio between entries and deleted entires is reached, the block is rewritten to collect the garbage, and if needed it is glued to another adjacent block in o

@rhiroyuki
rhiroyuki / pos-clouding.txt
Last active December 1, 2018 17:13
aws elb - ecs - autoscaling
elb
sticky session, connection draining, proxy protocol