Skip to content

Instantly share code, notes, and snippets.

View alekssamos's full-sized avatar
🎯
Focusing

alekssamos

🎯
Focusing
View GitHub Profile
@alekssamos
alekssamos / gist:ae83d888ba16afc4f4dd41714f419ada
Created January 9, 2018 11:40 — forked from sonnyt/gist:8585696
JavaScript Check If Element Has Class
function hasClass(element, className) {
return element.className && new RegExp("(^|\\s)" + className + "(\\s|$)").test(element.className);
}
var myDiv = document.getElementById('MyDiv');
hasClass(myDiv, 'active');
// OR
@alekssamos
alekssamos / TEST.BAS
Last active April 21, 2018 11:40
Школа Информатика Тест 1 V2
CLS
locate 1, 30 : PRINT "Тест про компьютеры."
10 locate 2, 20 : PRINT "Начать? 1 да, 0 нет"
INPUT "", x
IF x = 0 THEN : END
IF x <> 1 THEN : GOTO 10
y = 0
PRINT "При ответе используйте соответствующую варианту цифру"
PRINT "без лишних символов и знаков"
# my KEYBOARD CONFIGURATION FILE by Alex33
# Consult the keyboard(5) manual page.
XKBMODEL="pc105"
XKBLAYOUT="us,ru"
XKBVARIANT=","
XKBOPTIONS="grp:alt_shift_toggle,grp_led:scroll"
BACKSPACE="guess"
@alekssamos
alekssamos / edit_f.php
Created June 20, 2019 21:03
Beget bug file update (touch)
<?php
// Любой скрипт любым скриптом.
/* я нашёл, из за touch. Ну почему так происходит, если данные уже обновлены? Сервер хранит старые копии для возможного отката? Хотя нет. Возможно, это просто кэш, основанный на дате изменения файла. Но все равно, где же тогда хранятся данные после уже изменение скрипта? */
$f = "f.php";
$time = @filemtime($f);
file_put_contents($f, "\n echo '".rand(111, 9999)."';", FILE_APPEND) or exit("error!");
echo 'file updated. Changes will be applied in ~ 40 minutes. Check <a href="'.$f.'?'.uniqid().'">here</a>';
@touch($f,$time,$time);
@alekssamos
alekssamos / cookiefunctions.js
Created June 25, 2019 02:30
convenient functions for working with cookies in js. I found on the site javascript ru, I have been using for more than 5 years. I like.
function getCookie(name) {
var matches = document.cookie.match(new RegExp(
"(?:^|; )" + name.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g, '\\$1') + "=([^;]*)"
))
return matches ? decodeURIComponent(matches[1]) : undefined
}
function setCookie(name, value, props) {
props = props || {}
var exp = props.expires
if (typeof exp == "number" && exp) {
@alekssamos
alekssamos / 1px.md
Created July 12, 2019 11:34 — forked from hughker/1px.md
base64 1px Gray GIF
<!-- 1px Transparent -->
<img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7">

<!-- 1px Gray -->
<img src="data:image/gif;base64,R0lGODlhAQABAIAAAMLCwgAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==">

<!-- 1px Black -->
<img src="data:image/gif;base64,R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBADs=">
@alekssamos
alekssamos / install_rhvoice.sh
Last active February 6, 2023 01:24
Script for auto install speech synt RHVoice for Gnome-Orca screen reader
#!/bin/bash
# https://www.shellhacks.com/ru/bash-test-if-file-exists/
# https://habr.com/ru/company/ruvds/blog/325928/
# http://qaru.site/questions/41427/how-to-check-if-a-file-contains-a-specific-string-using-bash
# http://blog.richim.org/2011/10/bash.html
# Check the script is being run by root
if [ "$(id -u)" != "0" ]; then
echo "This script must be run as root"
@alekssamos
alekssamos / vk_online_checker_bot.py
Last active April 18, 2022 04:10
Telegram Bot check online or offline user VK
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import time, sys, os, os.path, re, sqlite3, json
from threading import Timer
om_th=None
## if sys.version_info.major == 2:
## print("REQUIRED PYTHON 3+")
## sys.exit(1)
if sys.argv[-1].lower() == "stop" and os.path.isfile("vkonline.pid"): (os.kill(int(open("vkonline.pid").read()), -9),
@alekssamos
alekssamos / ng.html
Last active November 24, 2019 22:06
NVDA REMOTE LINK GENERATOR
<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="UTF-8">
<title>Генератор ссылок NVDAREMOTE</title>
<style>
// http://pauljadam.com/demos/title-keyboard.html
// edited
input[title]:focus:after { content:attr(title);
background-color: black;
@alekssamos
alekssamos / SqliteStore.php
Last active September 22, 2024 11:17 — forked from erikeldridge/SqliteStore.php
a simple key/val store using php & sqlite3
<?php
// a simple key/val store using php & sqlite3
// license: http://gist.github.com/375593
// edited by alekssamos
/* Added multithreading: https://habr.com/ru/articles/204438/ */
class SqliteStore {
protected $db;
public function __construct($tableName, $filePath = 'db.sqlite') {