Skip to content

Instantly share code, notes, and snippets.

View tarasowski's full-sized avatar
:electron:

Dimitri (Dimi) Tarasowski tarasowski

:electron:
View GitHub Profile
@tarasowski
tarasowski / install-docker.md
Created January 2, 2024 09:31 — forked from npearce/install-docker.md
Amazon Linux 2 - install docker & docker-compose using 'sudo amazon-linux-extras' command

UPDATE (March 2020, thanks @ic): I don't know the exact AMI version but yum install docker now works on the latest Amazon Linux 2. The instructions below may still be relevant depending on the vintage AMI you are using.

Amazon changed the install in Linux 2. One no-longer using 'yum' See: https://aws.amazon.com/amazon-linux-2/release-notes/

Docker CE Install

sudo amazon-linux-extras install docker
sudo service docker start
@tarasowski
tarasowski / cloudwatch-query
Last active December 19, 2023 12:33
cloudwatchgrafana
fields @timestamp, @message
| parse @message '[ERROR]\t*\t*\t*' as errorTimestamp, errorId, errorMessage
| filter @message like '[ERROR]'
| display errorTimestamp, errorMessage
@tarasowski
tarasowski / config.json
Created December 18, 2023 11:48
cloudwatchagent
{
"agent": {
"metrics_collection_interval": 60,
"run_as_user": "cwagent"
},
"logs": {
"logs_collected": {
"files": {
"collect_list": [
{
@tarasowski
tarasowski / server.js
Last active December 12, 2023 10:54
supercalculator
import express from "express"
import { add, divide, multiply, subtract } from "supercalculator"
const app = express();
const port = 3000;
app.use(express.json());
app.post('/add', (req, res) => {
const body = req.body
@tarasowski
tarasowski / median-price-calculator.mjs
Created December 6, 2023 11:43
median-price-calculator.mjs
export const medianPriceCalculator = async (event) => {
let region = event.region;
let medianPrice;
// Define median prices for US, CA and BR
const medianPrices = {
US: 320000.0,
CA: 240000.0,
BR: 260000.0,
};
@tarasowski
tarasowski / calculate.mjs
Created December 6, 2023 08:54
calculate.mjs
export const costCalculator = async (event) => {
try {
// Check if event is null or undefined and throw an error if it is
if (!event) {
throw new Error('Event object is undefined or empty');
}
// Use optional chaining to set default values for properties that may not exist
const { price, size, unit, downPayment, downPaymentAmount } = event ?? {};
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: >
text-processor
Sample SAM Template for text-processor
# More info about Globals: https://github.com/awslabs/serverless-application-model/blob/master/docs/globals.rst
Globals:
Function:
FROM node:lts-alpine
EXPOSE 3000
USER node
RUN mkdir -p /home/node/app
WORKDIR /home/node/app
@tarasowski
tarasowski / bose-ubuntu
Created September 2, 2020 07:28
Pair Bose Ubuntu
How to pair: https://forums.linuxmint.com/viewtopic.php?t=232256
@tarasowski
tarasowski / ubuntu
Last active January 6, 2021 06:14
Ubuntu Keyword
setxkbmap -option lv3:lalt_switch
* https://gist.github.com/jatcwang/ae3b7019f219b8cdc6798329108c9aee
XKBOPTIONS="apple:badmap"
https://askubuntu.com/questions/843590/key-keycode-49-and-key-keycode-94-are-inverted-on-macbookpro-keyboar
setxkbmap setting lost when I switch keyboard layout in Ubuntu 16.04
* https://stackoverflow.com/questions/39877946/setxkbmap-setting-lost-when-i-switch-keyboard-layout-in-ubuntu-16-04
* https://unix.stackexchange.com/questions/99085/save-setxkbmap-settings