Skip to content

Instantly share code, notes, and snippets.

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

Ildar Manzhikov manzhikov

🏠
Working from home
View GitHub Profile
@manzhikov
manzhikov / bitbucket-pipelines.yml
Created March 2, 2019 17:50 — forked from tstrohmeier/bitbucket-pipelines.yml
AWS ECS: Script for creating a new revision of a task definition and update a service
# enable Docker for your repository
options:
docker: true
pipelines:
branches:
development:
- step:
# python image with aws-cli installed
@manzhikov
manzhikov / capybara_fill_stripe_elements.rb
Last active August 26, 2019 21:55 — forked from iloveitaly/capybara_fill_stripe_elements.rb
Fill in a Stripe Elements (https://stripe.com/docs/elements) credit card field using capybara
def fill_stripe_elements(card: '4242424242424242', expiry: '1234', cvc: '123', postal: '12345')
using_wait_time(10) {
frame = find('#card-element > div > iframe')
within_frame(frame) do
card.to_s.chars.each do |piece|
find_field('cardnumber').send_keys(piece)
end
find_field('exp-date').send_keys expiry
find_field('cvc').send_keys cvc
@manzhikov
manzhikov / Capybara.md
Created March 16, 2020 13:30 — forked from tomas-stefano/Capybara.md
Capybara cheatsheet

Capybara Actions

# Anchor
click_link 'Save'

# Button
click_button 'awesome'

# Both above
@manzhikov
manzhikov / LaTeXMathML.js
Created August 1, 2020 20:45
LaTeXMathML.js
/*
LaTeXMathML.js
==============
This file, in this form, is due to Douglas Woodall, June 2006.
It contains JavaScript functions to convert (most simple) LaTeX
math notation to Presentation MathML. It was obtained by
downloading the file ASCIIMathML.js from
http://www1.chapman.edu/~jipsen/mathml/asciimathdownload/
and modifying it so that it carries out ONLY those conversions
@manzhikov
manzhikov / .irbrc
Created January 7, 2021 17:32 — forked from swanson/.irbrc
.irbrc color coding Rails console by environment
# Add color coding based on Rails environment for safety
if defined? Rails
banner = if Rails.env.production?
"\e[41;97;1m #{Rails.env} \e[0m "
else
"\e[42;97;1m #{Rails.env} \e[0m "
end
# Build a custom prompt
@manzhikov
manzhikov / clean.md
Created April 8, 2021 22:47 — forked from Kevinrob/clean.md
Clean up microk8s registry
registry=localhost:32000
repositories=$(curl ${registry}/v2/_catalog)
for repo in $(echo "${repositories}" | jq -r '.repositories[]'); do
  echo $repo
  tags=$(curl -sSL "http://${registry}/v2/${repo}/tags/list" | jq -r '.tags[]')
  for tag in $tags; do
    echo $tag
    curl -v -sSL -X DELETE "http://${registry}/v2/${repo}/manifests/$(
 curl -sSL -I \
@manzhikov
manzhikov / iterm2.md
Created May 11, 2021 22:44 — forked from squarism/iterm2.md
iterm2 cheatsheet

Tabs and Windows

Function Shortcut
New Tab + T
Close Tab or Window + W (same as many mac apps)
Go to Tab + Number Key (ie: ⌘2 is 2nd tab)
Go to Split Pane by Direction + Option + Arrow Key
Cycle iTerm Windows + backtick (true of all mac apps and works with desktops/mission control)
@manzhikov
manzhikov / db_backup.sh
Created June 1, 2021 14:39 — forked from hackedunit/db_backup.sh
Backup PostgreSQL dump to Microsoft Azure Blob Storage
#!/bin/bash
# Requires azure-cli to be installed
source $HOME/.profile
if [ "${POSTGRES_HOST}" = "" ]; then
if [ -n "${POSTGRES_PORT_5432_TCP_ADDR}" ]; then
POSTGRES_HOST=$POSTGRES_PORT_5432_TCP_ADDR
POSTGRES_PORT=$POSTGRES_PORT_5432_TCP_PORT
{
"Total": 17,
"Attachments": [
{
"FileName": "invoice.jpg"
}
],
"LineItems": [
{
"Description": "Sugar",
time_namelookup: %{time_namelookup}s\n
time_connect: %{time_connect}s\n
time_appconnect: %{time_appconnect}s\n
time_pretransfer: %{time_pretransfer}s\n
time_redirect: %{time_redirect}s\n
time_starttransfer: %{time_starttransfer}s\n
----------\n
time_total: %{time_total}s\n