Skip to content

Instantly share code, notes, and snippets.

View gist:318489e44a5e36af799566c41ac93366
autocmd BufWritePre * :%s/\s\+$//e
color desert
let mapleader=","
" Fzf mapping replacing ControlP command
nnoremap <C-p> :Files<Cr>
" Fzf mapping for find in files
nnoremap <C-g> :Rg<Cr>
@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"
You can’t perform that action at this time.