Skip to content

Instantly share code, notes, and snippets.

Avatar

Otavio Medeiros otaviomedeiros

  • VNDA e-commerce
  • Florianópolis
View GitHub Profile
@otaviomedeiros
otaviomedeiros / .env
Last active Nov 19, 2021
Ruby on Rails with Sidekiq and docker compose
View .env
PORT=3000
REDIS_PORT=6379
SIDEKIQ_REDIS_URL=redis://redis:6379/0
APP_DATABASE_HOST=database
APP_DATABASE_PORT=5432
APP_DATABASE_NAME=app_development
APP_DATABASE_USERNAME=postgres
APP_DATABASE_PASSWORD=postgres
@otaviomedeiros
otaviomedeiros / webpack.config.js
Created May 5, 2017
Webpack build with code splitting
View webpack.config.js
var path = require('path');
var webpack = require('webpack');
var CopyWebpackPlugin = require('copy-webpack-plugin');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
var baseCSS = new ExtractTextPlugin({ filename: "base.css" });
var vendorCSS = new ExtractTextPlugin({ filename: "[name].css", allChunks: true });
var VENDOR = [
"angular",
"angular-aria",
@otaviomedeiros
otaviomedeiros / gist:e015b25d10c367fd63d1
Created Mar 21, 2016
Elastic search indexing - Products
View gist:e015b25d10c367fd63d1
# ------- PRODUCTS
# mappings
PUT connectere
{
"settings": {
"analysis": {
"analyzer": {
"ngram_analyzer": {
"tokenizer": "ngram_tokenizer",
"filter": [
@otaviomedeiros
otaviomedeiros / gist:4f604a39c9f5bf0e50f6
Last active Aug 29, 2015
Workaround for devise sign in when using flash responder
View gist:4f604a39c9f5bf0e50f6
# initializer to use when config.responders.flash_keys = [ :success, :error ]
module Responders
module FlashResponder
alias_method :original_set_flash_message?, :set_flash_message?
private
def set_flash_message?
View gist:11296173
sudo apt-get install x11vnc
x11vnc -display :1
View gist:11228971
sudo apt-get install xdotool
# check java version on firefox
xdotool search --name "Verify Java Version" windowactivate --sync mousemove --window %1 500 350 click 1
# click on run button of java security warning
xdotool search --name "Security Information" windowactivate --sync mousemove --window %1 410 290 click 1
# SCREENSHOT, needs imagemagick
import -window root screenshot.png
@otaviomedeiros
otaviomedeiros / gist:11228918
Created Apr 23, 2014
java import cef certificates
View gist:11228918
# import certificates
sudo keytool -import -alias cef.addtrustexternalcaroot -keystore "/usr/lib/jvm/java-8-oracle/jre/lib/security/cacerts" -file "/home/otavio/certificados/AddTrustExternalCARoot" -storepass changeit
sudo keytool -import -alias cef.comodorsacertificationauthority -keystore "/usr/lib/jvm/java-8-oracle/jre/lib/security/cacerts" -file "/home/otavio/certificados/COMODORSACertificationAuthority" -storepass changeit
sudo keytool -import -alias cef.comodorsaorganization -keystore "/usr/lib/jvm/java-8-oracle/jre/lib/security/cacerts" -file "/home/otavio/certificados/COMODORSAOrganizationValidationSecureServerCA" -storepass changeit
# list imported certificates
sudo keytool -list -keystore "/usr/lib/jvm/java-8-oracle/jre/lib/security/cacerts" -storepass changeit | grep cef
@otaviomedeiros
otaviomedeiros / gist:11228831
Created Apr 23, 2014
selenium firefox profile
View gist:11228831
profile = Selenium::WebDriver::Firefox::Profile.new
profile['browser.download.dir'] = "#{Rails.root.to_s}/tmp"
profile['browser.download.folderList'] = 2
profile['browser.helperApps.neverAsk.saveToDisk'] = "text/ofx,application/ofx,application/x-ofx"
profile['pdfjs.disabled'] = true
profile['plugin.state.java'] = 2 # plugin java always active
View gist:11228764
# ff plugins
ls /usr/lib/mozilla/plugins/
# pode ser aqui tambem
ls /usr/lib/firefox-addons/plugins
# ff config
cat ~/.mozilla/firefox/<something>.default/prefs.js
# estar uma config para o ff
View gist:11228626
# x server
Xvfb :1 -screen 0 1024x768x24 &
# seta display para o firefox achar o xvfb
export DISPLAY=:1 # export to /etc/profile
# mostra o processo
jobs
# mata o processo