Skip to content

Instantly share code, notes, and snippets.

View akopitsa's full-sized avatar
🏠
Working from home

Andrey Kopitsa akopitsa

🏠
Working from home
View GitHub Profile
@akopitsa
akopitsa / screen.ps1
Created May 3, 2020 12:23 — forked from d3zorg/screen.ps1
This script takes screenshot on all displays and saves it to shared folder. Can be installed to windows services and run with this vbs with no window ("hidden"): set shell = wscript.createobject("wscript.shell") shell.run "powershell -file C:\Windows\screen.ps1",0,false Run once before install to enable execution of powershell script powershell …
[cmdletbinding()]
param(
[string]$Width,
[string]$Height,
[string]$datestamp = "{0:HH/mm/ss/dd/MM/yyyy}" -f (get-date),
[string]$FileName = $env:COMPUTERNAME + "_screen_" + "$datestamp"
)
function Take-Screenshot{
[cmdletbinding()]
@akopitsa
akopitsa / parhttp.py
Created March 12, 2019 17:15 — forked from hoffrocket/parhttp.py
Python parallel http requests using multiprocessing
#!/usr/bin/env python
from multiprocessing import Process, Pool
import time
import urllib2
def millis():
return int(round(time.time() * 1000))
def http_get(url):
import time
import datetime
import asyncio
import aiohttp
domain = 'http://integralist.co.uk'
a = '{}/foo?run={}'.format(domain, time.time())
b = '{}/bar?run={}'.format(domain, time.time())
async def get(url):
@akopitsa
akopitsa / install-kops.sh
Created January 5, 2019 13:34 — forked from yetanotherchris/install-kops.sh
Install Kops and prequisites on Ubuntu
# Install AWS CLI, Kubectl, Kops
sudo apt update
sudo apt install -y awscli
sudo snap install kubectl --classic
curl -LO https://github.com/kubernetes/kops/releases/download/1.7.0/kops-linux-amd64
chmod +x kops-linux-amd64
mv ./kops-linux-amd64 /usr/local/bin/kops
# Setup the AWS profile
aws config
@akopitsa
akopitsa / colors.sh
Created December 5, 2018 12:01 — forked from mavieth/colors.sh
Bash script color output
#!/bin/bash
DARKGRAY='\033[1;30m'
RED='\033[0;31m'
LIGHTRED='\033[1;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
PURPLE='\033[0;35m'
LIGHTPURPLE='\033[1;35m'
@akopitsa
akopitsa / README.md
Created November 22, 2018 16:07 — forked from DocX/README.md
Connect to bash inside running ECS container by cluster and service name
@akopitsa
akopitsa / configure-winrm.ps1
Created November 21, 2018 14:55 — forked from jprichardson/configure-winrm.ps1
Configure WinRM for Vagrant
netsh advfirewall firewall set rule group="remote administration" new enable=yes
netsh advfirewall firewall add rule name="Open Port 5985" dir=in action=allow protocol=TCP localport=5985
winrm quickconfig -q
winrm quickconfig -transport:http
winrm set winrm/config '@{MaxTimeoutms="7200000"}'
winrm set winrm/config/winrs '@{MaxMemoryPerShellMB="0"}'
winrm set winrm/config/winrs '@{MaxProcessesPerShell="0"}'
winrm set winrm/config/winrs '@{MaxShellsPerUser="0"}'
winrm set winrm/config/service '@{AllowUnencrypted="true"}'
@akopitsa
akopitsa / README.md
Created September 11, 2018 19:29 — forked from iMilnb/README.md
AWS Terraform configuration: Stream CloudWatch Logs to ElasticSearch

Rationale

This snippet is a sample showing how to implement CloudWatch Logs streaming to ElasticSearch using terraform. I wrote this gist because I didn't found a clear, end-to-end example on how to achieve this task. In particular, I understood the resource "aws_lambda_permission" "cloudwatch_allow" part by reading a couple of bug reports plus this stackoverflow post.

The js file is actually the Lambda function automatically created by AWS when creating this pipeline through the web console. I only added a endpoint variable handling so it is configurable from terraform.

@akopitsa
akopitsa / gist:76ba6ba42aabae805f8fe5c170e64d41
Created May 22, 2018 16:37 — forked from swade1987/gist:05db366b29ab2c625946
Web.config transformations (Powershell)
function XmlDocTransform($xml, $xdt)
{
if (!$xml -or !(Test-Path -path $xml -PathType Leaf)) {
throw "File not found. $xml";
}
if (!$xdt -or !(Test-Path -path $xdt -PathType Leaf)) {
throw "File not found. $xdt";
}
$scriptPath = (Get-Variable MyInvocation -Scope 1).Value.InvocationName | split-path -parent
@akopitsa
akopitsa / Create-WebConfigTransform.ps1
Created May 22, 2018 16:33 — forked from mpicker0/Create-WebConfigTransform.ps1
This PowerShell script runs a Web.config transformation. Visual Studio must be installed, and MSBuild.exe in your path. This is useful for one-off testing.
<#
.SYNOPSIS
Create a configuration transformation
.DESCRIPTION
This script runs an ASP.NET configuration transformation, given a source
configuration and transformation file. MSBuild.exe is assumed to be in
the path, and Visual Studio 2012 should be installed. Modify the path to
Microsoft.Web.Publishing.Tasks.dll if a different version of Visual Studio
is installed.