Skip to content

Instantly share code, notes, and snippets.

@slabad
slabad / mousemover.py
Created September 7, 2022 12:32
mouse mover
import pyautogui
import time
while True:
pyautogui.moveRel(0, 10)
time.sleep(2)
@slabad
slabad / get_rds_tags.py
Last active February 3, 2024 20:45
get_rds_tags
from itertools import chain
import boto3
rds = boto3.client('rds')
tagging = boto3.client('resourcegroupstaggingapi')
# Build a mapping of instance ARNs to details
paginator = rds.get_paginator('describe_db_instances')
instances = {
@slabad
slabad / mysql_test_trans.sql
Last active June 28, 2022 13:07
mysql test trans #mysql
--create database for testing rollback
create database if not exists dmstest;
use dmstest;
create table people(
id int auto_increment
@slabad
slabad / katlegohw.sql
Last active October 26, 2021 12:44
katlegohw
1. Create tables to hold data for your movie collection.
Create table Movies (id int identity primary key,
Title varchar (100),
Director varchar (100),
Runtime smallint, --Consider naming this runtime_minutes (this makes it clear as to the units)
Genre_id int,
Release_Year year);
@slabad
slabad / bash_cheat_sheet.sh
Created September 30, 2021 15:05
Bash Cheat Sheet #bash
#To display the largest folders/files including the sub-directories, run:
du -Sh | sort -rh | head -5
#du command: Estimate file space usage.
#-h : Print sizes in human-readable format (e.g., 10MB).
#-S : Do not include the size of subdirectories.
#-s : Display only a total for each argument.
#sort command : sort lines of text files.
#-r : Reverse the result of comparisons.
@slabad
slabad / kmodiselle_test.sql
Last active September 23, 2021 14:56
kmodiselle_test
1. Create tables to hold data for your movie collection.
Create table Movies (id int identity primary key,
Title varchar (100),
Director varchar (100),
Runtime smallint,
Genre_id int,
Release_Year year);
Create table Genre (id int identity primary key,
@slabad
slabad / pg_index_usage_table.sql
Created September 21, 2021 13:27
Postgres Index Usage #postgres #index
SELECT
c.relname,
indexname,
c.reltuples AS num_rows,
pg_size_pretty(pg_relation_size(quote_ident(c.relname)::text)) AS table_size,
pg_size_pretty(pg_relation_size(quote_ident(indexrelname)::text)) AS index_size,
CASE WHEN indisunique THEN 'Y'
ELSE 'N'
END AS UNIQUE,
idx_scan AS number_of_scans,
@slabad
slabad / gin_index_example.sql
Created September 21, 2021 12:23
gin index example #postgres #psql #index
CREATE INDEX index_notifications_gin_subscriber ON notifications USING gin ((params ->> 'subscriber') gin_trgm_ops) WHERE params -> 'subscriber':: text IS NOT NULL;
@slabad
slabad / mmcelheny_alias
Created September 20, 2021 13:29
mmcelheny alias example #bash #zsh
myaliases = {
# 'grep': 'grep --color=auto --exclude-dir={.bzr,CVS,.git,.hg,.svn}',
# one char shortcuts
'h': 'history show all | less',
'c': 'clear',
# ls shortcuts
'l': 'ls -F',
'la': 'ls -lAfh',
'll': 'ls -lFh',
'ldot': 'ls -ld .*',
@slabad
slabad / get_pg_version_number.sh
Created June 7, 2021 16:38
Get pg Version number #postgres @bash
pg_config --version|grep -oP "(?<=PostgreSQL ).*"