Instantly share code, notes, and snippets.

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.
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
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.
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",
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