Skip to content

Instantly share code, notes, and snippets.

View alex-quiterio's full-sized avatar
🌀
using my coding skills to fight for the climate

aIex quiterio alex-quiterio

🌀
using my coding skills to fight for the climate
View GitHub Profile
require 'fileutils'
# Define file type extensions
IMAGE_EXTENSIONS = %w[.jpg .jpeg .png .gif .bmp .tiff]
PDF_EXTENSIONS = %w[.pdf]
AUDIO_EXTENSIONS = %w[.mp3 .wav .ogg .aac .flac]
VIDEO_EXTENSIONS = %w[.mp4 .mkv .mov .avi .wmv]
ORIGIN_FOLDER = "/Users/alex-quiterio/Desktop/triage"
DESTINATION_FOLDERS = {
@alex-quiterio
alex-quiterio / dump_stream_config_failed_queue.sh
Created October 16, 2023 09:07
dump_stream_config_failed_queue.sh
export PORT=9001
export FILE_NAME=new_dump.txt
function get_redis_data() {
KEY_NAME=$1
configID=$(echo HGET $KEY_NAME data | redis-cli -p $PORT | jq '.streamConfigurationId')
configFailedReason=$(echo "HGET $KEY_NAME failedReason" | redis-cli -p $PORT)
echo "===================" >> $FILE_NAME
echo "configId: $configID\nFailedReason:$configFailedReason" >> $FILE_NAME
@alex-quiterio
alex-quiterio / waste-saver-patch-stream-configurations-v2.md
Last active October 21, 2022 14:02
Waste Saver: Patch Waste Stream Configuration

WasteSaver Audit: Update StreamConfiguration endpoint

  • OLD ENDPOINT: PUT /api/store/locations/:org_location_id/streams/:uuid
  • NEW ENDPOINT: PATCH /api/store/locations/:org_location_id/waste-stream-configurations/:uuid

Request payload proposal:

{
  "quantity": 1,

WasteSaver Audit: Create - StreamConfiguration endpoint

  • OLD ENDPOINT: POST /api/store/locations/:org_location_id/streams
  • NEW ENDPOINT: POST /api/store/locations/:org_location_id/waste-stream-configurations

Request payload proposal:

[
  {
@alex-quiterio
alex-quiterio / waste-saver-stream-configurations-v2.md
Last active October 21, 2022 14:03
WasteSaver Audit: Stream Configurations endpoint

WasteSaver Audit: Index - StreamConfiguration endpoint:

  • OLD ENDPOINT: GET /api/store/locations/:org_location_id/streams
  • NEW ENDPOINT: GET /api/store/locations/:org_location_id/waste-stream-configurations

Payload proposal:

{
  "waste_stream_configurations": [
    {
@alex-quiterio
alex-quiterio / postgres-cheatsheet.md
Created May 31, 2022 08:10 — forked from Kartones/postgres-cheatsheet.md
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
@alex-quiterio
alex-quiterio / ecs-run
Created July 15, 2021 05:33 — forked from vcastellm/ecs-run
Run task and wait for result in AWS ECS
#!/usr/bin/env bash
set -e
function usage() {
set -e
cat <<EOM
##### ecs-run #####
Simple script for running tasks on Amazon Elastic Container Service
One of the following is required:
Required arguments:
@alex-quiterio
alex-quiterio / mysql.database.yml
Created April 24, 2021 17:56 — forked from jwo/mysql.database.yml
Sample config/database.yml from Rails. Postgres, MySQL, and SQLite
#
# Install the MYSQL driver
# gem install mysql2
#
# Ensure the MySQL gem is defined in your Gemfile
# gem 'mysql2'
#
# And be sure to use new-style password hashing:
# http://dev.mysql.com/doc/refman/5.0/en/old-client.html
development:
# A web crawler in Ruby
#
# This script provides a generic Spider class for crawling urls and
# recording data scraped from websites. The Spider is to be used in
# collaboration with a "processor" class that defines which pages to
# visit and how data from those pages should be consumed. In this example
# the processor is ProgrammableWeb.
#
# Usage:
# spider = ProgrammableWeb.new
@alex-quiterio
alex-quiterio / gist:c1642b78918da9479439
Last active August 29, 2015 14:28 — forked from josetapadas/gist:f9eec8ca7d9f214f0918
Dynamic single shot media query
var mediaQueryListElement = window.matchMedia("all and (min-width: 666px)");
function call_me(name) {
console.log("És um " + name);
mediaQueryListElement.removeListener(call_me.caller);
}
mediaQueryListElement.addListener(function() {
call_me("sugar");
});