Skip to content

Instantly share code, notes, and snippets.

Alex Anenkov alex-anenkov

Block or report user

Report or block alex-anenkov

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View tree.js
'use strict';
class TreeNode {
constructor(index, parent, type) {
this.index = Number(index);
this.parent = parent;
this.type = type;
this.child = [];
}
@alex-anenkov
alex-anenkov / firewallcmd-drop-ip.conf
Created Feb 15, 2019
Action for fail2ban that bans ip by placing it in the drop firewalld zone
View firewallcmd-drop-ip.conf
# Author: Alex Anenkov
[INCLUDES]
before =
[Definition]
actionstart =
actionstop =
actioncheck =
@alex-anenkov
alex-anenkov / pfe
Created Sep 29, 2018
running a command on multiple cluster nodes in parallel
View pfe
#!/bin/bash
# This script is a parallel version of the 'fe' utility.
# Usage: pfe '<command>'
# Author: Alex Anenkov
# Checking arguments
readonly me=$(basename $0)
if [ -z "$1" ] || [ ! -z "$2" ]; then
View uninstall_onedrive.cmd
@echo off
echo.
openfiles > NUL 2>&1
if %errorlevel% NEQ 0 (
echo You are not running as Administrator...
echo This batch cannot do it's job without elevation!
echo.
echo Right-click and select ^'Run as Administrator^' and try again...
echo.
@alex-anenkov
alex-anenkov / check_last_login.sh
Last active Dec 12, 2017
This script displays users who have not logged in for specific days and are members of the specific group
View check_last_login.sh
#!/bin/bash
# This script display users who have not logged in for <days> days
# and are members of <usergroup> group.
#
# Usage: check_last_login.sh <days> <usergroup>
# Example: ./check_last_login.sh 365 student
#
# Author: Alex Anenkov
@alex-anenkov
alex-anenkov / fuck_telemetry.cmd
Last active Jan 6, 2019
Turn Off Telemetry in Windows 10
View fuck_telemetry.cmd
@echo off
echo.
openfiles > NUL 2>&1
if %errorlevel% NEQ 0 (
echo You are not running as Administrator...
echo This batch cannot do it's job without elevation!
echo.
echo Right-click and select ^'Run as Administrator^' and try again...
echo.
@alex-anenkov
alex-anenkov / get_keys.cpp
Last active Mar 7, 2017
Reading all keys names in a Section from a INI file (WinAPI, VisualStudio, C++, Unicode)
View get_keys.cpp
#include <Windows.h>
const int BUFFER_SIZE = 2048;
wchar_t buffer[BUFFER_SIZE];
std::wstring file = L"C:\\file.ini";
GetPrivateProfileString(L"SECTION", NULL, NULL, buffer, BUFFER_SIZE, file.c_str());
// error check
std::vector<std::wstring> key_names;
View Preferences.sublime-settings
{
"hot_exit": false,
"remember_open_files": false,
"show_encoding": true,
"show_line_endings": true,
"fallback_encoding": "Cyrillic (Windows 1251)", //font must support cyrillic
"trim_automatic_white_space": true,
"theme": "Material-Theme.sublime-theme",
"color_scheme": "Packages/Material Theme/schemes/Material-Theme.tmTheme",
@alex-anenkov
alex-anenkov / exec_time.cpp
Last active Jul 14, 2016
Measuring execution time in C++11
View exec_time.cpp
#include <chrono> //C++11
auto start = std::chrono::high_resolution_clock::now();
// do something
auto end = std::chrono::high_resolution_clock::now();
auto time = std::chrono::duration<double, std::milli>(end-start).count();
std::cout << "time: " << time << "ms" << std::endl;
View Ubuntu 16.04 after install script
#!/bin/bash
echo
echo "******************************************"
echo " System install script for ubuntu 16.04"
echo "******************************************"
echo
read -r -p "Do you want to continue installation? [y/N] " response
case $response in
You can’t perform that action at this time.