Skip to content

Instantly share code, notes, and snippets.

@zaheeraws
Last active September 18, 2023 07:29
Show Gist options
  • Save zaheeraws/184cc31f69c7abae5001a22fa0359f42 to your computer and use it in GitHub Desktop.
Save zaheeraws/184cc31f69c7abae5001a22fa0359f42 to your computer and use it in GitHub Desktop.

General Guidelines

 CFLAGS="-Wno-error=implicit-function-declaration" RUBY_CONFIGURE_OPTS='--with-readline-dir=/usr/local/opt/readline/' arch -x86_64 rbenv install 2.4.

Update all customers default payment method

Stripe::Customer.list({limit: 100, starting_after: 'cus_MKkKk8kkKKkKkK'}).data.each_with_index do |p,k|
  puts p.id
  # next if k == 0
  x = nil
  if p.invoice_settings.default_payment_method.nil?
    pid = Stripe::PaymentMethod.list('customer': p.id).data.first.id rescue nil
    next if pid.nil?
    x = Stripe::Customer.update(p.id, {invoice_settings: {default_payment_method: pid}} )
  end
  puts "#{p.id}: #{x.nil? ? '' : x.id}"
end
# $2a$11$cPS/FDAECKOA6b5J8LzxZuEEdKCtAbT4JuhYRIE4O8k00jeTvCrZC

Ubuntu Freeup RAM

free -h && sudo sysctl -w vm.drop_caches=3 && sudo sync && echo 3 | sudo tee /proc/sys/vm/drop_caches && free -h
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment