Skip to content

Instantly share code, notes, and snippets.

View marlosirapuan's full-sized avatar
🏖️
Working from home

Marlos marlosirapuan

🏖️
Working from home
  • João Pessoa, PB - Brazil
  • 18:16 (UTC -03:00)
View GitHub Profile
@marlosirapuan
marlosirapuan / Dockerfile
Last active April 29, 2019 14:39
Dockerfile (Ruby 2.6.2-alpine + yarn + libs + assets precompile)
FROM ruby:2.6.2-alpine
ENV APP_HOME /src/app
ARG app_env
ENV RAILS_ENV $app_env
ENV RAILS_ROOT $APP_HOME
ENV RAILS_SERVE_STATIC_FILES 1
ENV LANG C.UTF-8
ENV PATH /root/.yarn/bin:$PATH
@marlosirapuan
marlosirapuan / fix_postgresql_mojave.md
Last active April 3, 2019 20:53
Fix bug brew install postgresql on macOS Mojave (pg_tblspc, pg_commit_ts etc..)

To fix errors like..

psql: could not connect to server: No such file or directory
	Is the server running locally and accepting
	connections on Unix domain socket "/tmp/.s.PGSQL.5432"?

...

could not open directory "pg_tblspc": No such file or directory
@marlosirapuan
marlosirapuan / CenterWindows.scpt
Created December 26, 2018 16:06
AppleScript: Center Windows on Mac Mojave
set theApp to "Google Chrome"
set windowWidth to 1300
set windowHeight to 950
tell application "Finder"
set screenResolution to bounds of window of desktop
end tell
set screenWidth to item 3 of screenResolution
set screenHeight to item 4 of screenResolution
@marlosirapuan
marlosirapuan / apns.sh
Created November 20, 2018 16:13 — forked from unnamedd/apns.sh
cURL the APNS HTTP/2 API
# Note: You MUST have curl 7.47+ with http/2 support compiled in
curl -v \
-d '{"aps":{"alert":"<message>","badge":42}}' \
-H "apns-topic: <bundle id>" \
-H "apns-priority: 10" \
--http2 \
--cert <certificate file> \
https://api.development.push.apple.com/3/device/<device token>
@marlosirapuan
marlosirapuan / my_app.conf
Created October 1, 2018 18:24
Nginx conf rails app (for SSL LetsEncrypt)
# Example My App
# Deploy on: /home/deploy/apps/myapp (user 'deploy' with root privilegies)
#
# 1) Setup NGINX config below and...
# 2) Install and setup LetsEncrypt:
# 2.1) $ sudo add-apt-repository ppa:certbot/certbot
# 2.2) $ sudo apt-get update
# 2.3) $ sudo apt-get install python-certbot-nginx
# 2.4) $ sudo certbot --nginx -d mysiteapp.com -d www.mysiteapp.com
# 2.5) Choose 2 and ENTER
@marlosirapuan
marlosirapuan / routes.rb
Created May 24, 2018 21:40
Simple catch all routes in Rails 5
Rails.application.routes.draw do
# your routes bla bla
# your root controller
root to: 'home#index'
# at the end
get '*path', to: redirect('404')
end
@marlosirapuan
marlosirapuan / split.sh
Created February 16, 2018 20:33
Split a mp3 file ("MALEFACTOR - Sixth Legion") on macOS
#!/usr/bin/env bash
# Split a mp3 file ("MALEFACTOR - Sixth Legion") on macOS
##
# Install ffmpeg (macOS)
#
# $ brew install ffmpeg
# $ brew link ffmpeg

You can check here for getting the latest version. Change the wget url to download newer versions.

Install

$ wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.4/wkhtmltox-0.12.4_linux-generic-amd64.tar.xz
$ tar -xvf wkhtmltox-0.12.4_linux-generic-amd64.tar.xz
$ cd wkhtmltox/bin/
$ sudo mv wkhtmltopdf /usr/bin/wkhtmltopdf
@marlosirapuan
marlosirapuan / twd_convert.sh
Last active March 2, 2016 00:32
converte arquivos *.jpg das pastas em .pdf
#!/bin/bash
### instala imagemagik
# brew install imagemagick
# convert *.jpg output.pdf
### dentro da pasta
# sh twd_convert.sh .
execute_convert() {
@marlosirapuan
marlosirapuan / gulpfile.js
Created February 26, 2016 16:22 — forked from plasticbrain/gulpfile.js
gulp.js task to deploy code to remote servers
/*******************************************************************************
* Description:
*
* Gulp file to push changes to remote servers (eg: staging/production)
*
* Usage:
*
* gulp deploy --target
*
* Examples: