Skip to content

Instantly share code, notes, and snippets.

Luciano Sousa lucianosousa

Block or report user

Report or block lucianosousa

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
@lucianosousa
lucianosousa / events_helper.rb
Created Aug 22, 2019
sorbet or not sorbet?
View events_helper.rb
# Old file start
module EventsHelper
def user_is_owner?(model)
user_signed_in? && model.user == current_user
end
end
# Old file end
View gist:9f46346e5858a3efabf9
$ lein repl
Mar 18, 2016 7:24:39 PM org.apache.http.impl.execchain.RetryExec execute
INFO: I/O exception (java.net.SocketException) caught when processing request to {s}->https://repo1.maven.org:443: java.security.NoSuchAlgorithmException: Error constructing implementation (algorithm: Default, provider: SunJSSE, class: sun.security.ssl.SSLContextImpl$DefaultSSLContext)
Mar 18, 2016 7:24:39 PM org.apache.http.impl.execchain.RetryExec execute
INFO: Retrying request to {s}->https://repo1.maven.org:443
Mar 18, 2016 7:24:39 PM org.apache.http.impl.execchain.RetryExec execute
INFO: I/O exception (java.net.SocketException) caught when processing request to {s}->https://repo1.maven.org:443: java.security.NoSuchAlgorithmException: Error constructing implementation (algorithm: Default, provider: SunJSSE, class: sun.security.ssl.SSLContextImpl$DefaultSSLContext)
Mar 18, 2016 7:24:39 PM org.apache.http.impl.execchain.RetryExec execute
INFO: Retrying request to {s}->https://repo1.maven.org:443
Mar 18, 2016 7:24:39 PM org.
View gist:00ca3aebb254395eb0dc
function OffersController($scope, $sce) {
activate();
function activate() {
$('.selectpicker').selectpicker({
style: 'btn-info',
size: 4
});
}
}
View benchmark1.rb
require 'active_support'
require 'active_record'
require 'benchmark/ips'
ActiveRecord::Base.establish_connection(
adapter: 'mysql2',
encoding: 'utf8',
reconnect: true,
pool: 25,
host: 'localhost',
@lucianosousa
lucianosousa / benchmark2.rb
Last active Jan 15, 2016
Second benchmark for AR queries
View benchmark2.rb
require 'active_support'
require 'active_record'
require 'benchmark/ips'
ActiveRecord::Base.establish_connection adapter: 'sqlite3', database: ':memory:'
ActiveRecord::Base.connection.instance_eval do
create_table(:customers) { |c| c.string :name }
end
class Customer < ActiveRecord::Base; end
View gist:82cd3ed636f6cd6ce918
https://github.com/DamirSvrtan/fasterer
https://github.com/codeclimate/codeclimate
https://github.com/metricfu/metric_fu
View gist:f914cbde9aa63703cd17
#! /bin/sh
### BEGIN INIT INFO
# Provides: nginx
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: nginx init.d dash script for Ubuntu <=9.10.
# Description: nginx init.d dash script for Ubuntu <=9.10.
### END INIT INFO
View gist:ab8548660249b1e8871a
* * * * * /bin/bash -l -c 'sh /home/ec2-user/scripts/monitor.sh postgresql93 redis-server nginx memcached >> /var/log/cron 2>&1'
* * * * * /bin/bash -l -c 'sleep 30; sh /home/ec2-user/scripts/monitor.sh postgresql93 redis-server nginx memcached >> /var/log/cron 2>&1'
@lucianosousa
lucianosousa / gist:e6d8353ce0abe38f6ae1
Created May 31, 2015
check if sidekiq is running
View gist:e6d8353ce0abe38f6ae1
#!/bin/bash
echo "starting check sidekiq"
process=`cat /path-to/sidekiq.pid`
processConfirmation=`ps aux | awk '{print $2 }' | grep $process`
if [ -z $processConfirmation ]
then
echo "oops! not running... restarting sidekiq"
@lucianosousa
lucianosousa / gist:f11de784eec44fcd5f4d
Created May 31, 2015
check if service is running
View gist:f11de784eec44fcd5f4d
#!/bin/bash
commands=("$@")
echo "starting monitor check"
for command in "${commands[@]}"; do
if [ $command == "postgresql93" ]
then
check="postmaster"
You can’t perform that action at this time.