Skip to content

Instantly share code, notes, and snippets.

View KhorAMus's full-sized avatar

Albert Khoroshun KhorAMus

  • UrFU
  • Ekaterinburg
View GitHub Profile
@KhorAMus
KhorAMus / TooltipRemover.js
Last active January 19, 2024 14:43
Tempermonkey script for deleting tooltips. It deletes simple tooltips by clearing title attribute in all elements.
// ==UserScript==
// @name TooltipRemover
// @namespace http://tampermonkey.net/
// @version 2024-01-17
// @description Removing all simple (title) tooltips
// @author Albert KhorAMus Khoroshun
// @match *://*/*
// @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant none
// ==/UserScript==
+-----------------------------------------------------------------------------------+
| *** Exercises *** |
+-----------------------------------------------------------------------------------+
| Assuming this table: |
| |
| CREATE TABLE employee ( |
| emp_id INTEGER PRIMARY KEY, |
| emp_name VARCHAR(30) |
| } |
| |
1-ЫЙ ЗАПРОС
Исходный код:
from webob import Request, Response
environ = {
"SERVER_NAME": "httpbin.org",
"SERVER_PORT": "80",
"PATH_INFO": '/ip',
'REQUEST_METHOD': "GET",
'SCRIPT_NAME': '',
В 17-ой строке мы вставляем в ответ кодировку, иначе при обращении к полю text объекта Response
выбросится ошибка: AttributeError: You cannot access Response.text unless charset is set. Обращение к нему происходит в функции print.
@KhorAMus
KhorAMus / exercise 2.5
Last active March 26, 2016 11:17
exercise 2.5
Программа для отправки:
import requests
payload = {
"github": "MyNickName",
"Name": "MyName",
"Surname": "MySurname"
}
resp = requests.post('http://httpbin.org/post',
headers={
@KhorAMus
KhorAMus / exercise 2.3
Last active March 26, 2016 10:22
exercise 2.3
Сперва проделаем все запросы с помощью библиотеки socket языка python 3.4.4
1 запрос-ответ
import socket
message_to_send = b'''GET /ip HTTP/1.1
Host: httpbin.org
Accept: */*
@KhorAMus
KhorAMus / exercise 2.2.
Last active March 19, 2016 04:44
Exercise 2.2
Отправляем запрос с использованием python 3.4.4 и библиотеки socket
Исходный код программы:
import socket
message_to_send = b'''GET /news/ HTTP/1.1
Host: www.e1.ru
User-Agent: Mozilla/5.0 (X11; U; Linux i686; ru; rv:1.9b5) Gecko/2008050509Firefox/3.0b5
Accept: text/html
Connection: close
@KhorAMus
KhorAMus / Exercise 1.3
Last active March 16, 2016 10:34
Exercise 1.3 и 1.4
1 запрос/ответ
telnet httpbin.org 80
Trying 54.175.219.8...
Connected to httpbin.org.
Escape character is '^]'.
GET /ip HTTP/1.1
Host: httpbin.org
Accept: */*
@KhorAMus
KhorAMus / Exercise 1.2
Created February 27, 2016 12:13
Exercise 1.2
khoramus@khoramus-VirtualBox:~$ telnet e1.ru 80
Trying 212.193.163.6...
Connected to e1.ru.
Escape character is '^]'.
GET /news HTTP/1.1
Host: e1.ru
User-Agent: Mozilla/5.0 (x11; U; Linux i686; ru;rv:1.9b5)G
Firefox/3.0b5
Accept: text/html
Connection: close