Skip to content

Instantly share code, notes, and snippets.

// Calc DPI with JS
function dpLib(debug) {
"use strict";
var div = document.createElement("div");
div.style.width = "1in";
div.style.position = "abolute";
div.style.top = "-100%";
div.style.bottom = "-100%";
document.body.appendChild(div);
//
@shpaker
shpaker / wifi_starter.cmd
Last active January 19, 2018 15:25
Batch file for managing virtual Wi-Fi hotspot in Windows 7+
rem author https://github.com/shpaker
@echo off
:main
echo [1] Start Wi-Fi network
echo [2] Stop Wi-Fi network
echo [3] Restart Wi-Fi network
echo [4] Config Wi-Fi network (require administrator privileges)
echo [0] Exit
@shpaker
shpaker / gist:cb3862a6b4af0b2d077259131fe33a72
Last active February 13, 2019 11:52
Prepare Debian for Docker
# 1
export USERNAME=${USER}
# 2
su root
# 3
apt update && apt install --yes sudo \
apt-transport-https \
ca-certificates \
curl \
gnupg2 \
@shpaker
shpaker / gist:e3c95026e68edf59d136aad620705787
Last active March 11, 2019 15:55
Create user with password
ENCRYPTED_PASSWORD=$(openssl passwd -crypt secure_password) && \
useradd --create-home \
--groups sudo \
--password ${ENCRYPTED_PASSWORD} \
user1
@shpaker
shpaker / keyboard_chars.md
Last active August 8, 2019 11:24
Special keys codes on the Mac keyboard

Special keys codes on the Mac keyboard

Ch Hex Dec Description
⎋ ⎋ Esc
⏎ ⏎ Enter
⌘ ⌘ Command
⌥ ⌥ Option
Control
@shpaker
shpaker / add_allure_environment_property_fixture.py
Last active March 6, 2020 14:10
Implementation of the pytest fixture for adding information to the Environment widget
from os import path
from typing import Any, Callable, Optional
from _pytest.fixtures import SubRequest
from pytest import fixture
ALLURE_ENVIRONMENT_PROPERTIES_FILE = 'environment.properties'
ALLUREDIR_OPTION = '--alluredir'
@shpaker
shpaker / listener.py
Created September 27, 2017 08:08
Robot's listener v3 implementation
""" Robot's listener v3 implementation
For more information see:
http://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#listener-version-3
"""
ROBOT_LISTENER_API_VERSION = 3
def start_suite(suite, result):
""" Called when a test suite starts.
@shpaker
shpaker / userpic_as_gh_generator.py
Last active May 12, 2021 08:32
userpic_as_gh_generator
import random
from typing import List
from jinja2 import Template
SVG_TEMPLATE = Template("""<?xml version="1.0"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg xmlns="http://www.w3.org/2000/svg" width="467" height="462">
{% for y_i, dots in enumerate(dots_data) %}{% for x_i, dot in enumerate(dots) %}
<rect x="{{ x_i * w_size }}"
@shpaker
shpaker / dplib.js
Created July 9, 2021 06:38
Detect the dpi/dpcm/dpmm in your browser
// var dp = new dpLib();
// alert(
// "7 in = " + dp.i(7) + " px \n" +
// "16 cm = " + dp.cm(16) + " px \n" +
// "6 in = " + dp.i2cm(6) + " cm \n" +
// "15 cm = " + dp.cm2i(15) + " in \n"
// );
function dpLib(debug) {
"use strict";
@shpaker
shpaker / habr-radiot-bot.yml
Last active November 28, 2022 16:16
configuration for feedforbot
cache:
type: 'files'
schedulers:
- listener:
type: 'rss'
params:
url: 'https://habr.com/ru/rss/all/all/?fl=ru'
transport:
type: 'telegram_bot'
params: