Skip to content

Instantly share code, notes, and snippets.

Jose Carrion joselo

Block or report user

Report or block joselo

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
View gist:f529b7f8389053e12c26e5e2bdf72896
# Backup database
docker exec -i APPNAME_db_1 pg_dump -U postgres -C APPNAME_production > /tmp/APPNAME_production.back
# Restore
docker exec -i APPNAME_db_1 psql -U postgres < APPNAME_production.back
# Rename database
docker exec -i APPNAME_db_1 psql -U postgres
ALTER DATABASE name RENAME TO new_name
View gist:08685facf0d651817cd30e7cfd163f38

Useful Vim key bindings

movement

  • 0 - beginning of line
  • ^ - beginning of non-whitespace
  • $ - end of line
  • 9j - move down 9 lines
  • w - move forward by word
  • b - move backward by word
View gist:02dbc19f6f82e1ce2d3d4411cb71d757
rails new . --api --webpack=vue --database=postgresql
gem 'closure_tree', '~> 6.5'
gem 'ransack', github: 'activerecord-hackery/ransack'
gem 'pundit', '~> 1.1'
gem 'rails-i18n', '~> 5.0', '>= 5.0.4'
gem 'rails_12factor', group: :production
gem 'exception_notification', git: 'https://github.com/smartinez87/exception_notification'
@joselo
joselo / gist:c23a8b56e3184e1209d37c67ada56b23
Last active Jun 17, 2017
Dispatch and listen event in polymer
View gist:c23a8b56e3184e1209d37c67ada56b23
// Dispatch
var event = {
bubbles: false,
composed: true,
detail: {
criteria: selectedCriterion
}
}
this.dispatchEvent(new CustomEvent('event', event));
View spacemacs-cheatsheet.txt
`emacs --daemon` to run in the background.
`emacsclient.emacs24 <filename/dirname>` to open in terminal
NOTE: "M-m and SPC can be used interchangeably".
* Undo - `C-/`
* Redo - `C-?`
* Change case: 1. Camel Case : `M-c`
2. Upper Case : `M-u`
3. Lower Case : `M-l`
@joselo
joselo / gist:48adba37d42800339a99c17867821a6b
Created Jan 9, 2017
Install fonts and other stuffs for programming in my archlinux
View gist:48adba37d42800339a99c17867821a6b
yaourt -S ttf-roboto-mono-powerline-git
@joselo
joselo / docker
Last active Dec 2, 2017
Docker Useful Commands
View docker
# Remove unused images
docker rmi -f $(docker images | grep "<none>" | awk "{print \$3}")
# Remove dangling images
docker rmi $(docker images --filter "dangling=true" -q --no-trunc)
# Ejecutar bash dentro de un servicio docker
$ docker-compose exec <service id> bash
View gist:f9772421a10332386f525f583182bbce
Merge audio and video
1) Remove 1 secons of the video to have the same time of the audio,
the total of the video is 01:40:42
ffmpeg -ss 00:00:00 -t 01:40:41 -i video.mp4 -vcodec copy -acodec copy output.mp4
2) Remove the audio from the video
View Dockerfile
FROM ruby:2.2.3
RUN apt-get update -qq
RUN apt-get install -y -qq build-essential
RUN apt-get install -y -qq nodejs
RUN apt-get install -y -qq libpq-dev
ENV APP_HOME /app
ENV BUNDLE_PATH /bundle
ENV BUNDLE_JOBS 5
View gist:19d0557f1841ffacdd14dff357b18e1e
sudo /usr/local/mysql/support-files/mysql.server start
sudo /usr/local/mysql/support-files/mysql.server stop
sudo /usr/local/mysql/support-files/mysql.server restart
You can’t perform that action at this time.