Skip to content

Instantly share code, notes, and snippets.

View idooo's full-sized avatar
🇺🇦
...

Alex Shteinikov idooo

🇺🇦
...
View GitHub Profile
// To use this you need to
// 1) Download and enable Basic Auth plugin: https://github.com/WP-API/Basic-Auth
// 2) Install dependencies: "npm i csv-parse wpapi"
const fs = require('fs');
const WPAPI = require('wpapi');
const parse = require("csv-parse/lib/es5");
const PASSWORD = process.env.PASSWORD || "";
const wp = new WPAPI({
@idooo
idooo / cypress_AMI_dependencies_install.sh
Created March 13, 2018 05:27 — forked from rsudip90/cypress_AMI_dependencies_install.sh
Bash script to install cypress.io tool dependencies on ec2 instance (AMI)
#!/bin/bash
# This script installs the dependencies required by cypress.io tool
# on amazon linux AMI as the required dependencies are not easily available.
# e.g., NODE_MODULES_PATH="/home/ec2-user/cypress-example-kitchensink/node_modules"
NODE_MODULES_PATH="{{PLACE_YOUR_NODE_MODULES_PATH_HERE}}"
CYPRESS_DIST_DIR="$NODE_MODULES_PATH/cypress/dist/Cypress"
exitError() {
@idooo
idooo / assume-role.sh
Created December 15, 2017 00:35
STS Assume role script helper
#! /bin/bash
# Requirements:
# brew install jq
#
# Launch:
# Executing script will print environment variables (eg "~/src/assume-role.sh 983056893078 OrganizationAccountAccessRole master")
# Use "." in bash if you want to export them to a current session
# (eg: . ~/src/assume-role.sh 12312312313 OrganizationAccountAccessRole master)
@idooo
idooo / publish-kafka-metrics.sh
Last active October 26, 2023 07:09
Script to publish JMX metrics from Kafka broker to AWS Cloudwatch
#!/usr/bin/env bash
# Kafka utilises JMX to provide an access to some useful data
# This script uses command line JMX client to retrieve those metrics from a Kafka broker
# and publish them to AWS Cloudwatch
# JMX Client: http://crawler.archive.org/cmdline-jmxclient/downloads.html
# Runtime dependencies: Java, AWS CLI, IAM role attached to the instance with permissions
# to put Cloudwatch metrics
@idooo
idooo / start-kafka-node.sh
Last active February 22, 2021 05:57
Startup scripts for Zookeeper and Kafka with self discovery in AWS
#!/usr/bin/env bash
ENVIRONMENT="{{ target_env }}" # Ansible will replace this one
AWS_SERVICE_LOG_GROUP="{{ kafka_log_group_name }}" # Ansible will replace this one (automatically discovered)
AWS_SERVICE_LOG_STREAM=container-logs
DOCKER_CONTAINER="{{ kafka_docker_container }}" # Ansible will replace this one
# Get meta information about instance and its placement
AVAILABILITY_ZONE=`curl http://169.254.169.254/latest/meta-data/placement/availability-zone`
LOCAL_IP=`curl -s http://169.254.169.254/latest/meta-data/local-ipv4`
@idooo
idooo / xvfb
Last active August 29, 2015 14:18 — forked from dmitriy-kiriyenko/console
export DISPLAY=:99
/etc/init.d/xvfb start
# do your selenium tests here
/etc/init.d/xvfb stop
// Basic directive
// ===================================================================================================
class BasicDirective {
constructor(moduleName) {
this.moduleName = moduleName;
}
@idooo
idooo / gist:f5ca8b740a7bfe1287be
Created March 1, 2015 00:05
ES6 classes example for Angular directives
class BasicDirective {
constructor(link, controller) {
if (typeof link !== 'undefined') this.link = link;
if (typeof controller !== 'undefined') this.controller = controller;
}
getClassName() {
var str = this.constructor.toString();
str = str.substr('function '.length);
/// <reference path='../_all.ts' />
module App
{
'use strict';
import ICurrentPosition = App.Services.ICurrentPosition;
export class MapCtrl extends App.Controllers.Basic
{
@idooo
idooo / gist:5ca94adb1676a6355315
Last active August 29, 2015 14:14
simple index.html template
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />