Skip to content

Instantly share code, notes, and snippets.

import { CallHandler, ExecutionContext, Injectable, NestInterceptor } from '@nestjs/common';
import { Observable } from 'rxjs';
import { tap } from 'rxjs/operators';
import { StatisticsService } from './statistics.service';
@Injectable()
export class StatisticsInterceptor implements NestInterceptor {
constructor(
private readonly statisticsService: StatisticsService,
@a-h
a-h / buildspec.yml
Last active November 3, 2022 08:31
Build Go with private dependencies on AWS CodeBuild
version: 0.2
env:
parameter-store:
build_ssh_key: "build_ssh_key"
phases:
install:
commands:
- mkdir -p ~/.ssh
@jed
jed / deploy.sh
Last active February 27, 2024 14:56
Using AWS CloudFormation to deploy an edge lambda
#!/bin/sh
aws cloudformation deploy \
--template-file stack.yaml \
--stack-name edge-lambda-test \
--capabilities CAPABILITY_IAM \
--parameter-overrides Nonce=$RANDOM
@danielgehr
danielgehr / Jenkinsfile
Last active October 30, 2023 02:04
Jenkins pipeline template with environment configuration using gitflow
// ***********************
//
// Build and deploy different environments with jenkins pipeline
//
// Merge to develop -> triggers development release
// Merge to master without tag -> triggers staging release
// Merge to master with tag -> triggers staging and production release
// Production release requires manual approval on the jenkins job
//
// Configure jenkins pipeline project to pull tags! By default, tags are not pulled!
Edit '/etc/sysconfig/jenkins' and add 'prefix=/jenkins' to 'JENKINS_ARGS'
**************************************************************************
JENKINS_ARGS="--prefix=/jenkins"
Comment out the default server config in '/etc/nginx/nginx.conf'
and create following file
'/etc/nginx/conf.d/domain.conf'
*************************************************
@mreigen
mreigen / app.js
Last active April 10, 2018 17:38
Goal: 1) To remove the # hash from the url. 2) Shareable on Facebook, twitter... with dynamic meta tags
//AngularJS app
.config( function myAppConfig ($locationProvider) {
$locationProvider.html5Mode(true);
...
}
@kyptov
kyptov / rabbitmq_cheatsheet_ru.md
Last active February 11, 2024 21:18
RabbitMQ Cheat Sheet (russian)

Общие упрощенные понятия. Возможно существуют способы задать другое поведение нежели данное упощенное.

Понятия

  • producer - отправитель, программный код, который отправляет сообщение.
  • consumer - получатель, программный код, который должен получить сообшение.
  • exchange - обменник, функционал RabbitMQ, получает сообщение с заданными параметрами от отправителя и:
    • может сбросить(удалить) сообщение или вернуть отправителю (зависит от атрибутов сообщения),
    • может отправить сообщение в очередь,
    • может отправить сообщение в несколько очередей (сообщение будет скопировано для каждой очереди)
  • queue - очередь, функционал RabbitMQ, хранит все сообщения и раздает их получателям.
  • message - сообщение, содержит атрибуты необходимые RabbitMQ, а также данные для передачи от отправителя к получателю
@DocX
DocX / README.md
Last active September 5, 2023 12:58
Connect to bash inside running ECS container by cluster and service name
@JeffBelback
JeffBelback / docker-destroy-all.sh
Last active December 12, 2023 17:47
Destroy all Docker Containers and Images
#!/bin/bash
# Stop all containers
containers=`docker ps -a -q`
if [ -n "$containers" ] ; then
docker stop $containers
fi
# Delete all containers
containers=`docker ps -a -q`
if [ -n "$containers" ]; then
docker rm -f -v $containers
@dergachev
dergachev / ubuntu-eol.md
Last active December 7, 2023 22:26
What to do when your ubuntu distro is End-of-Life

Let's say you're using Ubuntu 13.04 (Raring Ringtail, released in April 2013) and it just went End-of-Life on you, because it's supported for only 6 months, and the deprecated packages are taken down after 12 months.

You'll probably figure this out the hard way. When you run sudo apt-get update, it will eventually report these errors:

Ign http://archive.ubuntu.com raring-updates/universe Sources/DiffIndex
Err http://security.ubuntu.com raring-security/main Sources
  404  Not Found [IP: 91.189.91.15 80]
Err http://security.ubuntu.com raring-security/universe Sources
  404  Not Found [IP: 91.189.91.15 80]