Skip to content

Instantly share code, notes, and snippets.

@mr4torr
mr4torr / attachment_concern.rb
Last active March 18, 2019 22:28
Simple Form: input with preview image / Concern per paperclip = seo friendly and easy remove file
#
# save file: app/models/concerns/attachment_concern.rb
#
# Example:
# -------------------------------------
# add Model ------------
# has_attached_file :picture, styles: {
# medium: "600x315#",
# thumb: "160x160>"
# }
" Specify a directory for plugins
" - For Neovim: ~/.local/share/nvim/plugged
" - Avoid using standard Vim directory names like 'plugin'
call plug#begin('~/.vim/plugged')
Plug 'ryanoasis/vim-devicons'
" Make sure you use single quotes
" Shorthand notation; fetches https://github.com/junegunn/vim-easy-align
@mr4torr
mr4torr / test multiple caracteres
Last active March 7, 2019 17:23
Teste para inserção em um textarea com múltiplos caracteres especias
câmera é @ssim 3ªº° geração? "vou ver e te aviso à manhã" 5% de hülse's #sextou
R$50 reais toma aqui! 02/12/1989 |matriz| brave\new\world potencia¹²³ ¢25 to de mal ¬¬
Testando – !@#$%¨&*()_+=-0¹²³£¢¬§ é É Á Ó Í Ú é ú ó t ž š ä ö ü ß é ë æ ø € $ ¶ @ : ; /
€ ‚ ƒ „ … † ‡ ˆ ‰ Š ‹ Œ Ž ‘ ’ “ ” • – — ™ š › œ ž Ÿ ] ' " € ‚ ƒ „ … † ‡ ˆ ‰ Š ‹ Œ Ž ‘ ’
“ ” • – — ™ š › œ ž Ÿ
@mr4torr
mr4torr / netvirtua_netcombo-config-ssh.md
Last active December 8, 2022 18:38
NET não libera a porta 22 e impede de acessar por ssh github/bitbucket

Usar ssh do github e do bitbucket com wifi do netcombo /netvirtua

A NET só libera o uso de qualquer porta, como a porta 22 de ssh, para pessoa jurídica em seus novos planos (desde 2016).

Para conseguir usar o github ou bitbucket por ssh com plano de internet da NET para pessoa física, é necessário:

Criar o arquivo ~/.ssh/config e adicionar:

Host github.com
# Entrar no servidor e fora da pasta do projeto
$ cd /home/webmaster/
$ mkdir repository && cd repository
$ mkdir site.git && cd site.git
$ git init --bare
$ cd hooks
$ vim post-receive
@mr4torr
mr4torr / letsencrypt_2017.md
Created January 30, 2018 12:03 — forked from cecilemuller/letsencrypt_2020.md
How to setup Let's Encrypt for Nginx on Ubuntu 16.04 (including IPv6, HTTP/2 and A+ SLL rating)

How to setup Let's Encrypt for Nginx on Ubuntu 16.04 (including IPv6, HTTP/2 and A+ SLL rating)

There are two main modes to run the Let's Encrypt client (called Certbot):

  • Standalone: replaces the webserver to respond to ACME challenges
  • Webroot: needs your webserver to serve challenges from a known folder.

Webroot is better because it doesn't need to replace Nginx (to bind to port 80).

In the following, we're setting up mydomain.com. HTML is served from /var/www/mydomain, and challenges are served from /var/www/letsencrypt.

@mr4torr
mr4torr / theme-one-dark-monokai.json
Last active October 2, 2017 04:27
Theme Dark VS Code
{
"name": "Themer Dark",
"type": "dark",
"colors": {
"focusBorder": "#F92672",
"foreground": "#ABB2BF",
"widget.shadow": "#282C3466",
"selection.background": "#282C34",
"errorForeground": "#AE81FF",
"button.background": "#AE81FF",
require 'mina/bundler'
require 'mina/rails'
require 'mina/git'
require 'mina/rvm'
set :user, 'root'
set :domain, '111.111.111.111'
set :deploy_to, '/home/rails/project-rails'
set :repository, 'repository-git'
set :shared_paths, ['config/database.yml', 'log', 'tmp', 'public/system']
# Entrar no servidor e fora da pasta do projeto
$ cd /home
$ mkdir repo && cd repo
$ mkdir site.git && cd site.git
$ git init --bare
$ cd hooks
$ vim post-receive
description "nginx http daemon"
author "George Shammas <georgyo@gmail.com>"
start on (filesystem and net-device-up IFACE=lo)
stop on runlevel [!2345]
env DAEMON=/etc/nginx/sbin/nginx
env PID=/var/run/nginx.pid
expect fork