Skip to content

Instantly share code, notes, and snippets.

View mayvazyan's full-sized avatar

Michael Ayvazyan mayvazyan

View GitHub Profile
@mayvazyan
mayvazyan / sales-force-id-validator.ts
Last active November 5, 2021 15:05 — forked from knation/salesforceId.js
JavaScript Salesforce ID Check & Expansion
class SalesForceIdValidator {
private ID_REGEX = /^[0-9a-zA-Z]{15}([0-9a-zA-Z]{3})?$/;
private ID_EXPAND_ARRAY = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','0','1','2','3','4','5'];
constructor(private id: string) {}
public IsValid(): boolean {
if (!this.id) {
console.warn('[SalesForceIdValidator] id is empty');
return false;
@mayvazyan
mayvazyan / enable_ssh.sh
Last active December 6, 2020 19:06
./enable_ssh.sh example.com
# Allows to quickly enable access using rsa public key
# Example usage:
# ./enable_ssh example.com
cat ~/.ssh/id_rsa.pub | ssh $1 "mkdir -p ~/.ssh && chmod 700 ~/.ssh && cat >> ~/.ssh/authorized_keys && chmod 600 ~/.ssh/authorized_keys"
cd /usr/share/elasticsearch
sudo bin/plugin install elasticsearch/license/latest
sudo bin/plugin install elasticsearch/watcher/latest
sudo service elasticsearch restart
cinst console2
Install-ChocolateyPinnedTaskBarItem "$env:programfiles\console\console.exe"
cinst notepad2
Set-ExplorerOptions -showHidenFilesFoldersDrives -showProtectedOSFiles -showFileExtensions
cinst TelnetClient -source windowsFeatures
cinst 7zip.commandline
cinst far
cinst displayfusion
@mayvazyan
mayvazyan / elasticdump
Last active January 13, 2016 05:39
elasticdump
sudo apt-get install -y npm
npm install elasticdump
sudo ln -s /usr/bin/nodejs /usr/bin/node
cd node_modules/elasticdump/bin/
./elasticdump --input=http://localhost:9200/.kibana --output=$ --type=data --searchBody='{"filter": { "or": [ {"type": {"value": "dashboard"}}, {"type" : {"value":"visualization"}}, {"type" : {"value":"search"}}] }}' > kibana-exported.json
./elasticdump --input=kibana-config.json --output=http://localhost:9200/.kibana --type=data
@mayvazyan
mayvazyan / logstash
Last active January 13, 2016 04:02 — forked from mivano/logstash
curl -XPUT http://localhost:9200/logstash?pretty -d '{
"template": "logstash*",
"settings": {
"index.refresh_interval": "5s"
},
"mappings": {
"_default_": {
"_all": {
"enabled": true,
"omit_norms": true
@mayvazyan
mayvazyan / Kibana.sh
Last active January 12, 2016 15:02
Kibana.sh
cd /opt
sudo wget https://download.elastic.co/kibana/kibana/kibana-4.3.1-linux-x64.tar.gz
sudo tar -zxvf kibana-4.3.1-linux-x64.tar.gz
sudo mv kibana-4.3.1-linux-x64 kibana
sudo rm kibana-4.3.1-linux-x64.tar.gz
cd /etc/init.d
sudo wget https://raw.githubusercontent.com/akabdog/scripts/master/kibana4_init
sudo update-rc.d kibana4_init defaults 95 10
### Install Oracle Java 8, this means you agree to their binary license!!
cd ~
sudo add-apt-repository -y ppa:webupd8team/java
sudo apt-get update
echo debconf shared/accepted-oracle-license-v1-1 select true | sudo debconf-set-selections
echo debconf shared/accepted-oracle-license-v1-1 seen true | sudo debconf-set-selections
sudo aptitude -y install oracle-java8-installer
### Download and Install ElasticSearch
@mayvazyan
mayvazyan / gist:5554325
Created May 10, 2013 13:16
Stop your console app the nice way
class Program
{
private static readonly AutoResetEvent AutoResetEvent = new AutoResetEvent(false);
static void Main(string[] args)
{
Console.CancelKeyPress += OnCancelKeyPress;
//TODO: do work here
AutoResetEvent.WaitOne();