Skip to content

Instantly share code, notes, and snippets.

View tsertkov's full-sized avatar
🖐️
Say Hello

Aleks Tsertkov tsertkov

🖐️
Say Hello
View GitHub Profile
@tsertkov
tsertkov / README.md
Last active May 26, 2023 10:19
Http response time monitoring script (ruby)

http-monitor.rb

Simple ruby script to monitor http response times over a period of time.

% ruby http-monitor.rb https://google.com 20 3

2023-05-26 12:13:59 : (GET https://google.com) : 1.207913s
2023-05-26 12:14:02 : (GET https://google.com) : 0.102176s
2023-05-26 12:14:05 : (GET https://google.com) : 0.146981s
@tsertkov
tsertkov / README.md
Last active May 17, 2023 14:06
Single-node kubernetes cluster cloud-config

Single-node kubernetes cluster cloud-config

Cloud-config files for setting up k8s single-node cluster with kubeadm on Ubuntu 16.04.3 LTS (Xenial Xerus)

cloud-config.minimal.yaml

Minimal installation of k8s with kubeadm.

cloud-config.full.yaml

@tsertkov
tsertkov / cloud-config
Last active May 28, 2021 05:18 — forked from kacinskas/CoreOS swap
cloud-config file for enabling swap on CoreOS
#cloud-config
coreos:
units:
- name: systemd-sysctl.service
command: restart
- name: create-swap.service
command: start
runtime: true
content: |
@tsertkov
tsertkov / Code.js
Created February 17, 2015 15:39
Google Apps Script save fileBlob splitting it by chunks of given size
/**
* Save file splitting it by chunks of 9M
* @param {Blob} FileBlob blob data to save
* @param {Folder} folder destination folder
* @param {Number} chunkSize
* @return {String}
*/
function saveFileByChunks(fileBlob, folder, chunkSize) {
var
fileName = new Date().getTime(),
@tsertkov
tsertkov / acf-php-to-json.php
Last active February 4, 2020 11:04 — forked from ollietreend/acf-php-to-json.php
Convert Advanced Custom Fields Pro configuration from PHP to JSON.
<?php
/**
* Plugin Name: Convert ACF PHP to JSON
* Description: Convert Advanced Custom Fields Pro configuration from PHP to JSON.
*/
namespace ConvertAcfPhpToJson;
/**
* Add submenu item under 'Custom Fields'
@tsertkov
tsertkov / acf-php-to-json.php
Created January 30, 2020 09:13 — forked from kisabelle/acf-php-to-json.php
Convert ACF Fields Registered by PHP to Importable JSON Format
$groups = acf_get_local_field_groups();
$json = [];
foreach ($groups as $group) {
// Fetch the fields for the given group key
$fields = acf_get_local_fields($group['key']);
// Remove unecessary key value pair with key "ID"
unset($group['ID']);
@tsertkov
tsertkov / javascript-array-tips-and-tricks.md
Last active October 22, 2019 09:30
JavaScript array tips & tricks

JavaScript array tips & tricks

// Array mapping with .from()

Array.from([{ 'key': 1, 'value': 'val1'}, { 'key': 2, 'value': 'val2' }], ({key}) => key)
Array.from([{ 'key': 1, 'value': 'val1'}, { 'key': 2, 'value': 'val2' }], ({value}) => value)

// Get random value from array
@tsertkov
tsertkov / Gpg-agent-setup.md
Last active September 28, 2019 07:50
Setup GPG agent for ssh authentication and more
@tsertkov
tsertkov / modrewrite-htaccess
Created September 9, 2013 16:05
Print mod_rewrite server variables using special mod_rewrite rules exporting internal variables via environment variables and PHP script printing there vars.
RewriteEngine On
# special mod_rewrite variables
RewriteRule .* - [E=MR_SPECIALS_API_VERSION:%{API_VERSION},NE]
RewriteRule .* - [E=MR_SPECIALS_THE_REQUEST:%{THE_REQUEST},NE]
RewriteRule .* - [E=MR_SPECIALS_REQUEST_URI:%{REQUEST_URI},NE]
RewriteRule .* - [E=MR_SPECIALS_REQUEST_FILENAME:%{REQUEST_FILENAME},NE]
RewriteRule .* - [E=MR_SPECIALS_IS_SUBREQ:%{IS_SUBREQ},NE]
RewriteRule .* - [E=MR_SPECIALS_HTTPS:%{HTTPS},NE]