Skip to content

Instantly share code, notes, and snippets.

@debborafernandess
debborafernandess / headset_bluetooth_linux.md
Last active January 6, 2023 15:14
Conectar headset bluetooth no Linux

Configurar a conexão bluetooth

O que fazer quando um headseat não é listado para conexão bluetooth no Linux.

Instalar pacotes adicionais

  1. Instale os pacotes bluetooth, bluez, bluez-tools e rfkill via terminal:
sudo apt-get install bluetooth bluez bluez-tools rfkill -y
@debborafernandess
debborafernandess / Kotlin Date Iterator.md
Last active January 6, 2023 17:13 — forked from elye/Kotlin Date Iterator
Kotlin Date Iterator
class TestingClass {
    fun testingFunction() {
        for (everyday in this year 2017) {
            // Do something with everyday
            println(everyday.toString())
        }
    }

    private infix fun year(year: Int): DateRange {
@debborafernandess
debborafernandess / vim-heroku.sh
Created December 17, 2020 16:38 — forked from dvdbng/vim-heroku.sh
Run vim in heroku updated 2017
mkdir ~/vim
cd ~/vim
# Staically linked vim version compiled from https://github.com/ericpruitt/static-vim
# Compiled on Jul 20 2017
curl 'https://s3.amazonaws.com/bengoa/vim-static.tar.gz' | tar -xz
export VIMRUNTIME="$HOME/vim/runtime"
export PATH="$HOME/vim:$PATH"
cd -
@debborafernandess
debborafernandess / bulk_lancar_plano_nos.rb
Created July 24, 2019 21:23
Lançar plano para um array de clientes, para chama-los de volta à unidade
people = [Person.where(id: [3, 4])]
plan = Plan.find(18)
people.each do |person|
purchase = person.purchases.last.dup
purchase.microgym = 'nos'
purchase.description = 'Chamar quem se inscreveu e nunca compareceu'
purchase.plan_id = plan.id
purchase.save
end
@debborafernandess
debborafernandess / microgym_cancelled_data.rb
Created April 30, 2019 23:22
Analise do comportamento dos clientes que cancelaram Plano Recorrente em 2019
file = File.open('/tmp/cancel.csv', 'w')
file << "Mes de cancelamento, cliente, Modalidade, Unidade, Compras apos cancelar, Ultimo Plano comprado, Mes da ultima compra"
cancelled = Purchase.cancelled.recurrency.distinct(:person_id).joins(:plan).where("cancelled >= ?", Date.current.beginning_of_year)
cancelled.find_each do |purchase|
person = purchase.person
if person.purchases.where("created_at > ?", purchase.cancelled).exists?
new_purchases = person.purchases.where("created_at >= ?", purchase.cancelled)
We can make this file beautiful and searchable if this error is corrected: It looks like row 10 should actually have 8 columns, instead of 2 in line 9.
ORM-Adapter,Operation benchmark,User CPU time,System CPU time,Total CPU time,Real time,Memory used in kb,Transaction or Not
sequel-mysql,Model Object Creation: 1600 objects,0.536818,0.080193,0.639675,1.156077,6072,No Transaction
activerecord-mysql,Model Object Creation: 1600 objects,0.986834,0.051411,1.058469,1.481707,2436,No Transaction
sequel-mysql,Model Object Creation: 1600 objects,0.375353,0.043466,0.440293,0.640171,264,Transaction
activerecord-mysql,Model Object Creation: 1600 objects,0.638790,0.014195,0.675404,0.780479,0,Transaction
sequel-mysql,Model Object Select: 3200 objects 32 times,0.125732,0.000409,0.145452,0.182796,0,No Transaction
activerecord-mysql,Model Object Select: 3200 objects 32 times,0.841494,0.004042,0.865443,0.903764,5016,No Transaction
sequel-mysql,Model Object Select: 3200 objects 32 times,0.132256,0.000000,0.152481,0.190061,0,Transaction
activerecord-mysql,Model Object Select: 3200 objects 32 times,0.844372,0.003153,0.866892,0.905380,0,Transaction
sequel-mysql,Model Object Select
@debborafernandess
debborafernandess / install-gm-w-librvg.sh
Created January 5, 2018 17:13 — forked from tavinus/install-gm-w-librvg.sh
Installs ImageMagick --with-librsvg on Amazon Linux
# With this I was able to successfuly install everything
# on a x86 (32-bit) instance of Amazon Linux.
#
# You should probably not run this script
# It is a much better idea to use this as an Install guide
# Just follow it down, use your tab and be happy
export PKG_CONFIG_PATH=/usr/lib64/pkgconfig:/usr/lib/pkgconfig
export PATH=/usr/bin:$PATH
export LDFLAGS=-L/usr/lib64:/usr/lib
Steps:
- Na AWS, na instancia do `RDS DB`, ver o DNS da instância do banco
- Pegar no `database.yml` o user e password do banco da aplicação
- Rodar o comando `mysqldump -u user -h 'DNS_DA_INSTANCIA_DO_BANCO' DATABASE -p > dump.sql
- Informar a senha da aplicação quando for exigida a senha do banco.
# Gate ñ está expportando acesso: ?
# Addon não cancela:
# Ver se tem Location::Addon criado para a unidade / addon, muitas vezes no tem, mas tem no PurchaseAddon
# se precisar cancelar manualmente
user = User.find(x) # o solicitante do tkt
cancelling = PurchaseAddonCancelator.new(purchase, addon, user)
cancelling.send :transaction
@debborafernandess
debborafernandess / retry_daily_report_cache.rb
Created September 18, 2017 21:21
Rodar o relatorio diario para as unidades que nao rodaram
str_date = '2017-09-16'
locations_cached_ids = DailyReportCache.where('reference_date = ?', str_date).map &:location_id
active_locations_ids = Location.active.map &:id
location_ids = active_locations_ids - locations_cached_ids
location_ids.each do |location_id|
parsed_date = Date.parse(str_date).strftime('%d/%m/%Y')