This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
stats = Sidekiq::Stats.new | |
stats.queues | |
stats.enqueued | |
stats.processed | |
stats.failed |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Thread.new do | |
sleep 5 | |
puts "finished" | |
end | |
thread = Thread.new do | |
sleep 5 | |
puts "finished" | |
end | |
thread.join |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Get a DB Console. | |
bundle exec rails dbconsole | |
# Get number of Connections / Used and left | |
select max_conn,used,res_for_super,max_conn-used-res_for_super res_for_normal | |
from | |
(select count(*) used from pg_stat_activity) t1, | |
(select setting::int res_for_super from pg_settings where name=$$superuser_reserved_connections$$) t2, | |
(select setting::int max_conn from pg_settings where name=$$max_connections$$) t3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript:(function(){function c(){var e=document.createElement("link");e.setAttribute("type","text/css");e.setAttribute("rel","stylesheet");e.setAttribute("href",f);e.setAttribute("class",l);document.body.appendChild(e)}function h(){var e=document.getElementsByClassName(l);for(var t=0;t<e.length;t++){document.body.removeChild(e[t])}}function p(){var e=document.createElement("div");e.setAttribute("class",a);document.body.appendChild(e);setTimeout(function(){document.body.removeChild(e)},100)}function d(e){return{height:e.offsetHeight,width:e.offsetWidth}}function v(i){var s=d(i);return s.height>e&&s.height<n&&s.width>t&&s.width<r}function m(e){var t=e;var n=0;while(!!t){n+=t.offsetTop;t=t.offsetParent}return n}function g(){var e=document.documentElement;if(!!window.innerWidth){return window.innerHeight}else if(e&&!isNaN(e.clientHeight)){return e.clientHeight}return 0}function y(){if(window.pageYOffset){return window.pageYOffset}return Math.max(document.documentElement.scrollTop,document.body.scrollTop)}funct |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ln -s /usr/local/opt/readline/lib/libreadline.7.0.dylib /usr/local/opt/readline/lib/libreadline.6.dylib | |
# or if the error is with dyld: Library not loaded: /usr/local/opt/readline/lib/libreadline.7.dylib | |
ln -s /usr/local/opt/readline/lib/libreadline.8.0.dylib /usr/local/opt/readline/lib/libreadline.7.dylib |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ImportJob | |
include Sidekiq::Worker | |
sidekiq_options :queue => :import, :retry => false, :backtrace => true | |
def perform(project_id) | |
# create master batch | |
a = Sidekiq::Batch.new | |
a.description = "Master Batch A" | |
a.on(:success, "ImportJob#on_success", {"step" => "a"}) | |
logger.info "Master Batch A starting #{a.bid}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<link href="data:image/x-icon;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQEAYAAABPYyMiAAAABmJLR0T///////8JWPfcAAAACXBIWXMAAABIAAAASABGyWs+AAAAF0lEQVRIx2NgGAWjYBSMglEwCkbBSAcACBAAAeaR9cIAAAAASUVORK5CYII=" rel="icon" type="image/x-icon" /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://github.com/SamSaffron/memory_profiler | |
https://github.com/schneems/get_process_mem | |
https://github.com/ruby-prof/ruby-prof | |
https://ruby-prof.github.io/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rmdir ../temp #if there's a temp dir, let's remove it | |
mkdir ../temp #now make a new temp dir | |
find . -type d -print0 | while read -d $'\0' subdir; #find all subdirectories | |
do echo $subdir; mkdir ../temp/${subdir// /}; #and recreate them in the temp dir | |
done | |
find . -name "*.wav" -print0 | while read -d $'\0' file; #find all *.wav files to convert | |
do echo $file; # for each file found | |
/Users/rcaragol/Downloads/sox-14.4.2/sox -G "$file" --norm=-1 -b 16 -r 48k -c 1 ../temp/${file// /}; #convert to temp directory and remove spaces from filename | |
done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
searchkick autocomplete: ["name"], | |
settings: { | |
analysis: { | |
analyzer: { | |
searchkick_keyword: { | |
type: "custom", | |
tokenizer: "keyword", | |
filter: ["lowercase", "snowball"] | |
}, | |
default_index: { |