Skip to content

Instantly share code, notes, and snippets.

View rimiti's full-sized avatar
🚀
Focusing

Dimitri DO BAIRRO rimiti

🚀
Focusing
View GitHub Profile
@sergeyzenchenko
sergeyzenchenko / russia-ddos.md
Last active April 16, 2024 15:32
Russia DDOS list
@rimiti
rimiti / ipstack.ts
Last active July 31, 2020 13:17
Typescript implementation of ipstack
import axios, { AxiosResponse } from 'axios';
import { config } from '../config';
import { Sentry } from '../libs/sentry';
/**
* @description Ip Stack API response
*/
interface IIpStackResponse {
latitude: number;
longitude: number;
@rimiti
rimiti / example.js
Created October 1, 2019 15:39
Javascript: Creating a custom javascript error
export class RequestError extends Error {
constructor(message, meta = {}) {
super();
this.message = message;
this.meta = meta;
}
}
@rimiti
rimiti / sentry.js
Created October 1, 2019 14:26
Example to capture a Sentry exception
const Sentry = require('@sentry/node');
Sentry.init({ dsn: process.env.SENTRY_DSN, environment: 'staging' });
Sentry.captureException(new Error('Test from local'));
@jeffposnick
jeffposnick / service-worker.js
Created September 20, 2019 00:56
Example of InjectManifest in Workbox v5
// Add any other logic here as needed.
import { CacheableResponsePlugin } from 'workbox-cacheable-response/CacheableResponsePlugin';
import { CacheFirst } from 'workbox-strategies/CacheFirst';
import { createHandlerForURL } from 'workbox-precaching/createHandlerForURL';
import { ExpirationPlugin } from 'workbox-expiration/ExpirationPlugin';
import { NavigationRoute } from 'workbox-routing/NavigationRoute';
import { precacheAndRoute } from 'workbox-precaching/precacheAndRoute';
import { registerRoute } from 'workbox-routing/registerRoute';
@rimiti
rimiti / 🙈❤️.png
Last active July 26, 2023 11:52
Raccoon﹠Monkey lover ❤️
🙈❤️.png
@rimiti
rimiti / index.js
Created April 23, 2019 15:55
Loop: running promises in sequential.
/**
* @description Runs getUser() in sequential.
* @return {Promise<void>}
*/
async function example() {
for (let i = 0; i < 10; i++) {
await getUser();
}
}
@hadrienblanc
hadrienblanc / git-submodules.md
Last active December 9, 2023 01:13
Git submodules cheatsheet

Git Submodules cheatsheet

Why having a submodule ?

With git you can add a submodule to a repository. A submodule is another repository inside a repository.

How to create a submodule ?

git submodule add git@github.com:my_account/my_submodule.git path_to_my_submodule
@npearce
npearce / install-docker.md
Last active April 19, 2024 12:35
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
@rimiti
rimiti / upload-to-s3-steam.js
Created November 20, 2018 10:28
NodeJS - Upload local (file) image to AWS S3 from stream with public access.
const AWS = require('aws-sdk');
const fs = require('fs');
AWS.config.update({ accessKeyId: 'ACCESSKEYID', secretAccessKey: 'SECRETACCESSKEY', region: 'eu-west-3'});
const fileStream = fs.createReadStream('/path/to/your/image.png');
fileStream.on('error', function (err) {
if (err) { throw err; }
});