Skip to content

Instantly share code, notes, and snippets.

@theothermattm
theothermattm / docker-compose-override-commands.md
Created Feb 20, 2020
Using docker compose with overrides
View docker-compose-override-commands.md

Because I always forget the right order of passing in arguments!

Example up command with background process flag set:

docker-compose -f docker-compose.yml -f docker-compose-override-file.yml up -d myservice name
@theothermattm
theothermattm / docker-compose-cheatsheet.md
Created Dec 6, 2019
docker-compose command cheatsheet
View docker-compose-cheatsheet.md

build everything in the docker-compose.yaml file

docker-compose build

build just one service in docker-compose.yaml file

docker-compose build myservice

run everything in the docker-compose.yaml file

@theothermattm
theothermattm / mysql-dummy-data.sql
Created Aug 20, 2019
Create Dummy Data with MySQL Stored Proc
View mysql-dummy-data.sql
/* based on https://stackoverflow.com/a/17268740/288935 */
CREATE PROCEDURE insert_test_data()
BEGIN
DECLARE i INT default 1;
DECLARE mydate DATE DEFAULT NOW();
SET mydate = DATE_ADD('2017-05-01 00:01:00', INTERVAL FLOOR(RAND() * 700) DAY);
WHILE i < 1000000 DO
INSERT INTO `telemetry_test` (`humidity`, `temperature`, `sql_insert`, `sql_update`)
@theothermattm
theothermattm / install-python-macos.md
Last active Oct 8, 2019
Installing Python so it doesn't suck on MacOS
View install-python-macos.md

Thanks to @kevlarr for this info... Saving it myself for reference.

The easiest way to get started is via pyenv and virtualenv.

  • Install pyenv via brew install pyenv
  • Add eval "$(pyenv init -)" to your bash, etc. profile if you want to enable autocomplete (hint: you do),
  • Install project Python version via pyenv install 3.6.81

1 If you are running Mojave and are having issues building (looking at you, zlib), you likely need to install C header files

@theothermattm
theothermattm / remove-matched-pattern.sh
Created Jul 12, 2019
Sed - remove matched pattern simple script
View remove-matched-pattern.sh
# this chains them to make the regex easier to follow
sed -n -e 's/^${FIRSTPATTERN}//p' test.txt | sed -n -e 's/${SECONDPATTERN}//p'
@theothermattm
theothermattm / node-debugging.md
Created Jun 14, 2019
Debugging w/ Node.js and Chrome
View node-debugging.md

Node debugging with chrome

See this article first.

Use node --inspect

Most of the time it should give you a chrome URL. If not, go to about:inspect in chrome and you should see a target to inspect

Using mocha

View node-ca-certs.md
View engineering-culture-notes.md

Some of the greatest info I've seen on creating a healthy engineering courtesy of Spotify:

Spotify Engineering Culture Part 1

TODO make notes on this one

Spotify Engineering Culture Part 2

  • 0:50 - "We aim to make mistakes faster than anyone else" - Fail Fast and Improve Fast.
  • 1:30 - "Fail Friendly Environment" - Encourage sharing of failures so everyone can learn from them. Some teams have "Fail walls" showing off their failures.
@theothermattm
theothermattm / oracle-health-check.sql
Created Feb 21, 2019
Bash script to check health of an oracle instance
View oracle-health-check.sql
# original source based on: https://github.com/fabiohbarbosa/docker-healthcheck-oracle/blob/master/assets/healthcheck.sh
CHECK=$(${ORACLE_HOME}/bin/sqlplus -s ${HEALTHCHECK_USER}/${HEALTHCHECK_PASSWORD}@localhost/${HEALTHCHECK_SERVICE_NAME} as sysdba <<END
--set pagesize 0 feedback off verify off heading off echo off;
-- the simplest type of health check
--select count(*) from dual;
-- this will check if a
SELECT count(*) FROM V\$INSTANCE where INSTANCE_NAME = 'xe' and DATABASE_STATUS = 'ACTIVE';
exit;
END
@theothermattm
theothermattm / oracle-delete-all-tables.sql
Created Feb 15, 2019
Delete All Tables in an Oracle Schema
View oracle-delete-all-tables.sql
-- https://stackoverflow.com/questions/1690404/how-to-drop-all-user-tables
BEGIN
FOR cur_rec IN (SELECT object_name, object_type
FROM user_objects
WHERE object_type IN
('TABLE',
'VIEW',
'PACKAGE',
'PROCEDURE',
You can’t perform that action at this time.