Skip to content

Instantly share code, notes, and snippets.

View anders0l's full-sized avatar

Andrei Solovev anders0l

View GitHub Profile
@anders0l
anders0l / linkify-editor-state.ts
Last active February 26, 2021 06:49
Mutate Draft-js editor state to add new link entity with draft-js-linkify-plugin
import { EditorState, Modifier, SelectionState, ContentBlock } from 'draft-js'
import * as linkifyIt from 'linkify-it'
const linkify = linkifyIt()
// tslint:disable-next-line:no-var-requires
linkify.tlds(require('tlds'))
const findLinks = (
contentBlock: ContentBlock,
callback: (firstIndex: number, lastIndex: number, href: string) => void
@anders0l
anders0l / index.js
Created October 4, 2018 09:28 — forked from jeka-kiselyov/index.js
CloudWatch to AWS Lambda to Slack Channel Alerts and Charts. Posts CloudWatch Alerts via SNS topic via Lambda function to Slack channel. And draws charts for CPUUtilization metrics(both for EC2 abd RDS).
////// Save as index.js and upload it to Lambda as zip archive with node_modules directory. After:
////// npm install aws-cloudwatch-chart
////// npm install request
////// no need to upload aws-sdk module
////// Don't forget to change API keys here.
////// License: MIT
////// Docs:
@anders0l
anders0l / kubernetes_commands.md
Created October 1, 2018 10:15 — forked from edsiper/kubernetes_commands.md
Kubernetes Useful Commands
@anders0l
anders0l / remove-all-from-docker.sh
Created July 27, 2018 11:58 — forked from beeman/remove-all-from-docker.sh
Remove all from Docker
# Stop all containers
docker stop `docker ps -qa`
# Remove all containers
docker rm `docker ps -qa`
# Remove all images
docker rmi -f `docker images -qa `
# Remove all volumes
@anders0l
anders0l / post-merge
Created November 18, 2017 10:21 — forked from sindresorhus/post-merge
git hook to run a command after `git pull` if a specified file was changed.In this example it's used to run `npm install` if package.json changed and `bower install` if `bower.json` changed.Run `chmod +x post-merge` to make it executable then put it into `.git/hooks/`.
#!/usr/bin/env bash
# MIT © Sindre Sorhus - sindresorhus.com
# git hook to run a command after `git pull` if a specified file was changed
# Run `chmod +x post-merge` to make it executable then put it into `.git/hooks/`.
changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)"
check_run() {
echo "$changed_files" | grep --quiet "$1" && eval "$2"