Skip to content

Instantly share code, notes, and snippets.

View sloops77's full-sized avatar

Andres Olave sloops77

  • Thinking Bytes
  • Byron Bay
View GitHub Profile
@sloops77
sloops77 / connect to remote aiven cassandra server
Last active November 3, 2019 10:17
Remote cassandra server with ssl
sudo docker run -it -v "$(pwd)"/aiven.pem:/aiven.pem --env SSL_CERTFILE=/aiven.pem cassandra \
/usr/bin/cqlsh -k [KEYSPACE] -u [USERNAME] -p [PASSWORD] --ssl --cqlversion=3.4.4 [HOST] [PORT]
# to dump a table
mkdir dumps
sudo docker run -it -v "$(pwd)"/dumps:/dumps -v "$(pwd)"/aiven.pem:/aiven.pem --env SSL_CERTFILE=/aiven.pem cassandra \
/usr/bin/cqlsh --execute="COPY table_name TO '/dumps/table_name-dump.csv' WITH HEADERS=true;" \
-k [KEYSPACE] -u [USERNAME] -p [PASSWORD] --ssl --cqlversion=3.4.4 [HOST] [PORT]
# load it
### Keybase proof
I hereby claim:
* I am sloops77 on github.
* I am arolave (https://keybase.io/arolave) on keybase.
* I have a public key ASBIo5koXsa10F_zR1t-vYPzZyOdtlWHl3lErzbZyf8fNQo
To claim this, I am signing this object:
@sloops77
sloops77 / flattener.rb
Created March 13, 2016 09:39
Flattener
arr = [[1,2,[3]],4]
arr.flatten
@sloops77
sloops77 / application.rb
Last active November 10, 2015 15:40
Allows you to share a base connection pool, and reuse the pool in different namespaced use cases. (Caution Heroku biased)
#config/application.rb
...
#sets the DB_POOL env variable so that we can use it when setting up redis and db in the worker server
if Sidekiq.server?
concurrency = ENV['WORKER_CONCURRENCY'] || Sidekiq.options[:concurrency]
sidekiq_admin_threads = 2
poolSize = concurrency + sidekiq_admin_threads
p "setting ENV['DB_POOL']=#{poolSize}"
ENV['DB_POOL'] = poolSize.to_s
end