This file contains 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
# - all user* | |
# - all contract* | |
# - all discounts | |
# - all credit_memos | |
# - all product* | |
# - all subscriptions | |
# - all invoice* | |
# - all agent* | |
# - without any agent_result* | |
# - all social_media_trackers |
This file contains 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
puts( | |
((0..9).to_a + %w[a b c d e f]).in_groups_of(4).map do |g| | |
AnalyticsEvent.where(context_scope: :SellingProfile).where('context_id::varchar LIKE ? OR context_id::varchar LIKE ? OR context_id::varchar LIKE ? OR context_id::varchar LIKE ?', "#{g[0]}%", "#{g[1]}%", "#{g[2]}%", "#{g[3]}%").group(:context_id).pluck(:context_id, Arel.sql('ARRAY_AGG(ARRAY[session_id::varchar,user_id::varchar])')).map do |k| | |
calced = Time.now | |
uniq_sessions = k[1].map(&:first).uniq.size | |
uniq_users = k[1].map(&:last).uniq.size | |
[uniq_sessions, "::OUT:: selling profile #{k[0]} with uniq sessions #{uniq_sessions} and uniq users #{uniq_users} (in #{'%.4f' % ((Time.now - calced) * 1000)} ms)"] | |
end |
This file contains 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
#!/usr/bin/env ruby | |
# | |
# reads filenames from stdin and renames them according to contained | |
# exif data | |
# | |
require 'time' | |
require 'yaml' | |
require 'fileutils' |
This file contains 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
#!/bin/bash | |
## | |
# needs these env: | |
# FILENAME_PREFIX: prefix on basename of file to iterate over | |
# DBNAME: psql database name on local machine (or uri) | |
# default: 40 | |
KEEP_BACKUPS=${KEEP_BACKUPS:-40} | |
This file contains 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
#!/bin/bash | |
## | |
# uses this env: | |
# REMOTE_BUCKET: gcs bucket adress prefix (can include foldername) | |
# FILENAME_PREFIX: Filename prefix (prefix on basename) | |
LOCAL_LS="$(tempfile)" | |
REMOTE_LS="$(tempfile)" | |
gsutil ls "$REMOTE_BUCKET$FILENAME_PREFIX*" | cut -d "/" -f5 > "$REMOTE_LS" |
This file contains 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
if RUBY_PLATFORM =~ /darwin/ && !File.exists?(RbConfig::CONFIG["rubyarchhdrdir"]) | |
RbConfig::CONFIG["rubyarchhdrdir"].sub!(RUBY_PLATFORM.split('-').last, Dir.entries(File.dirname(RbConfig::CONFIG["rubyarchhdrdir"])).reject{|d|d.start_with?(".","ruby")}.first.split('-').last) | |
end | |
RbConfig::CONFIG["rubyhdrdir"].gsub!(/^/, '/app/ruby') | |
RbConfig::CONFIG["rubyarchhdrdir"].gsub!(/^/, '/app/ruby') | |
RbConfig::CONFIG["archlibdir"].gsub!(/^/, '/app/ruby') | |
require 'mkmf' |
This file contains 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
FROM debian:bullseye | |
RUN apt-get update &&\ | |
apt-get -y install curl gnupg | |
RUN curl -s "https://www.postgresql.org/media/keys/ACCC4CF8.asc" | apt-key add - &&\ | |
echo "deb http://apt.postgresql.org/pub/repos/apt/ bullseye-pgdg main" > /etc/apt/sources.list.d/pgdg.list &&\ | |
apt-get update &&\ | |
apt-get install -y postgresql-client-13 libpq-dev |
This file contains 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
require 'csv' | |
require 'net/http' | |
require 'optparse' | |
require 'securerandom' | |
## | |
# example csv: | |
# ``` | |
# email;gender;lastname;firstname;role | |
# you@andme.com;other;Some;Name;admin |
This file contains 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
force_delete = ARGV.find { |x| x == '--force-delete' } | |
from_date = Date.new(2021,4,1) | |
filter_item_type = 'BuyingProfile' | |
def lookup_lli(event) | |
LongListItem.find(event.context_id) | |
end | |
AnalyticsEvent.where(context_scope: :LongListItem) |
This file contains 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
#!/usr/bin/env ruby | |
# | |
# script can be run from rails runner like so: | |
# rails r this_file.rb -- <including_directory_path> <included_directory_path> | |
# | |
# for example on a rails concerns setup: rails r thisfile.rb -- app/models app/models/concerns | |
# | |
# rubocop is required to parse the code | |
# |
NewerOlder