Skip to content

Instantly share code, notes, and snippets.

@paulociecomp
paulociecomp / log_command.txt
Created January 24, 2019 15:35
Log searcher command to show stack trace with lines
#return the initial line
grep -n 'pattern' file
line_init=57890000
line_end=57890010
sed -n -e "$line_init,$line_end p" -e "$line_end q" filename
@paulociecomp
paulociecomp / Capybara.md
Created November 29, 2018 15:03 — forked from tomas-stefano/Capybara.md
Capybara cheatsheet

Capybara Actions

# Anchor
click_link 'Save'

# Button
click_button 'awesome'

# Both above
@paulociecomp
paulociecomp / change_eb_ruby_version.sh
Created November 9, 2018 20:55 — forked from januszm/change_eb_ruby_version.sh
Change Ruby minor version in AWS Elastic Beanstalk
# Currently (2017/2018) it's not possible to change the Ruby 'minor' version (eg. 2.3 => 2.4) using the web console
# However, it's possible using the 'awscli' tool.
brew install awscli # pip install awscli
aws elasticbeanstalk update-environment \
--solution-stack-name "64bit Amazon Linux 2017.09 v2.6.1 running Ruby 2.4 (Puma)" \
--environment-name "myappenv1" --region "us-east-2"
@paulociecomp
paulociecomp / docker-oracle.sh
Created January 25, 2016 14:00
Script to run container docker to oracle
CONTAINER_NAME="oracle-xe-11g"
SSH_PORT="49160"
if [ "$1" = "run" ]; then
docker run --name $CONTAINER_NAME -d -p $SSH_PORT:22 -p 1521:1521 -p 49162:8080 alexeiled/docker-oracle-xe-11g
elif [ "$1" = "start" ]; then
docker start $CONTAINER_NAME
elif [ "$1" = "stop" ]; then
docker stop $CONTAINER_NAME
elif [ "$1" = "restart" ]; then
public class Test {
@org.junit.Test
public void testTotals() {
assertEquals(0, price(""));
assertEquals(50, price("A"));
assertEquals(80, price("AB"));
assertEquals(115, price("CDBA"));
assertEquals(100, price("AA"));
@paulociecomp
paulociecomp / robot.js
Created December 1, 2012 20:46
vegeta
//FightCode can only understand your robot
//if its class is called Robot
var Robot = function(robot) {
};
Robot.prototype.onIdle = function(ev) {
var robot = ev.robot;
robot.ahead(100);
@paulociecomp
paulociecomp / server.js
Created February 19, 2012 01:01 — forked from jeffrafter/server.js
Twitter OAuth with node-oauth for node.js+express
var express = require('express');
var sys = require('sys');
var oauth = require('oauth');
var app = express.createServer();
var _twitterConsumerKey = "YOURTWITTERCONSUMERKEY";
var _twitterConsumerSecret = "YOURTWITTERCONSUMERSECRET";
function consumer() {