Skip to content

Instantly share code, notes, and snippets.

View pointofpresence's full-sized avatar
🏠
Working from home

ReSampled pointofpresence

🏠
Working from home
View GitHub Profile
@pointofpresence
pointofpresence / backdrop-filter blur.css
Last active March 31, 2024 20:20
CSS: Размытие заднего плана с backdrop-filter: blur()
/* чтобы размыть под layer CSS (например, для модалок) */
backdrop-filter: blur(7px);
@pointofpresence
pointofpresence / simple http web server.py
Last active March 31, 2024 20:51
simple http web server
#! /usr/bin/env python3
from http.server import BaseHTTPRequestHandler, HTTPServer
import logging
import sys
COLOR = "\033[1;32m"
RESET_COLOR = "\033[00m"
class S(BaseHTTPRequestHandler):
def _set_response(self):
@pointofpresence
pointofpresence / mouse and keyboard automation.py
Last active March 31, 2024 14:35
Python: Эмуляция клавиатуры и мыши в Windows
# импортируем модули для работы с windows оберткой
import win32api, win32con, win32gui
import time, win32com.client
 
#функция клика в определенном месте
def click(x,y):
    # сначала выставляем позицию
    win32api.SetCursorPos((x,y))
    time.sleep(0.2)
    # а потом кликаем (небольшая задержка для большей человечности)
@pointofpresence
pointofpresence / utils.js
Created December 19, 2022 11:19
Простой шаблонизатор с трок ES6
/**
* Простой шаблонизатор строк
*/
const formatString = (template, params = {}) => {
const names = Object.keys(params);
const vals = Object.values(params);
return new Function(...names, `return \`${template}\`;`)(...vals);
};
@pointofpresence
pointofpresence / openInFileExplorer.js
Last active March 31, 2024 12:39
Node.js: Как открыть файл в менеджере файлов?
// Try the following, which opens a File Explorer window on the computer running Node.js:
require('child_process').exec('start "" "c:\\test"');
@pointofpresence
pointofpresence / 1672591592.pb
Last active March 31, 2024 14:55
Created with Copy to Gist
IsDevTools ! #True
; Websocketclient by Netzvamp
; Version: 2016/01/08
DeclareModule WebsocketClient
Declare OpenWebsocketConnection(URL.s)
Declare SendTextFrame(connection, message.s)
Declare ReceiveFrame(connection, *MsgBuffer)
Declare SetSSLProxy(ProxyServer.s = "", ProxyPort.l = 8182)
Enumeration
@pointofpresence
pointofpresence / StyledConsoleLog.js
Created January 16, 2023 06:12
Styled console.log()
console.log('%c[MESSAGES.SCHEDULE at ]', 'color: blue;font-weight:bold')
def get_page(url):
ua = r'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.50 Safari/537.36'
exe = r'C:\Program Files\Google\Chrome\Application\chrome.exe'
args = f'"{exe}" --headless --disable-gpu --dump-dom --user-agent="{ua}" "{url}"'
sp = subprocess.Popen(args, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
out, err = sp.communicate()
print(err, 'error') if err else None
return out.decode('utf-8') if out else ''
@pointofpresence
pointofpresence / quoteOfTheDay.js
Created February 21, 2023 08:38
Quote of the day
const dtNow = new Date();
const intTZOffset = dtNow.getTimezoneOffset() * 60000; // automatically adjust for user timezone
const intNow = dtNow.getTime() - intTZOffset;
const intDay = Math.floor(intNow / 86400000); // The number of 'local' days since Jan 1, 1970
const randomIndex = intDay % QuotesData.length;
const item = QuotesData[randomIndex];