Skip to content

Instantly share code, notes, and snippets.

View caffeinetiger's full-sized avatar

Tony Benavides caffeinetiger

  • Chromatic Ai Swarm
  • Earth
View GitHub Profile
aws iam update-user --user-name <Oldname> --new-user-name <Newname>
aws iam update-group --group-name <Oldname> --new-group-name <Newname>
@caffeinetiger
caffeinetiger / set_default_version_nvm.sh
Last active April 18, 2022 18:32
NVM (Node Version Manager) is a linux application to manager node versions. For installation instructions go [here](https://github.com/nvm-sh/nvm).
nvm alias default <version>
# Example retrieving pod information for pods that have a label 'app' with the value 'my-app'
kubectl get pods -l app=my-app
# Example deleting pods that have a label 'app' with the value 'my-app'
kubectl delete pods -l app=my-app
@caffeinetiger
caffeinetiger / create_user.sql
Last active April 29, 2022 05:23
Related AWS Premium Knowledge Center Document: - [How do I create another master user for my Amazon RDS DB instance that is running MySQL?](https://aws.amazon.com/premiumsupport/knowledge-center/duplicate-master-user-mysql/)
CREATE USER 'master_user'@'%' IDENTIFIED BY 'password';
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, PROCESS, REFERENCES, INDEX, ALTER, SHOW DATABASES, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER ON *.* TO 'master_user'@'%' WITH GRANT OPTION;
@caffeinetiger
caffeinetiger / create_and_update_user_mysql.sql
Last active April 18, 2022 18:30
Snippetse to help create/alter(update) a user in MySQL and grant permissions.
-- Create User
CREATE USER 'username'@'%' IDENTIFIED BY 'somepassword';
-- Update User
ALTER USER 'username'@'%' IDENTIFIED BY 'somepassword';
-- Grant to Specific Schema/DB
GRANT ALL ON some-schema.* TO 'username'@'%';
-- Grant user permissions similiar to master user in RDS
GRANT ALL PRIVILEGES ON `%`.* TO 'username'@'%' WITH GRANT OPTION;
GRANT LOAD FROM S3 ON *.* TO 'username'@'%';
GRANT SELECT INTO S3 ON *.* TO 'username'@'%';
-- Grant statements
GRANT LOAD FROM S3 ON *.* TO 'username'@'%';
GRANT SELECT INTO S3 ON *.* TO 'username'@'%';
-- Replace with appropriate Schema, Table, AWS Region Code, and S3 URI
SELECT * FROM some-schema.some-table INTO OUTFILE S3 's3-some-region-code://some-buck-name/some-prefix' FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n'
@caffeinetiger
caffeinetiger / main.tf
Last active April 18, 2022 18:30
Example of using data resources to get current AWS region and account id
data "aws_region" "current" {}
data "aws_caller_identity" "current" {}
locals {
aws_region = data.aws_region.current.name
aws_account_id = data.aws_caller_identity.current.account_id
}
@caffeinetiger
caffeinetiger / flush_dns_cache.sh
Last active April 18, 2022 18:30
This is a macOS version of ipconfig /flushdns
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
cat /etc/os-release