Skip to content

Instantly share code, notes, and snippets.

View s3rgeym's full-sized avatar
🏴‍☠️
РОСКОМНАДЗОР - дети шлюх

[object Object] s3rgeym

🏴‍☠️
РОСКОМНАДЗОР - дети шлюх
View GitHub Profile
@s3rgeym
s3rgeym / gist:4f4030a73185311d91170da4b42bd27b
Last active December 29, 2016 22:39
Нестрогое сравнение в JavaScript
/*
s='true,false,null,undefined,0,42,3.14159265359,NaN,Infinity,-Infinity'
a=s.split(',')
for x in a:
b.extend([x, ' \t\n' + x])
if x.upper() != x:
b.append(x.upper())
if x.lower() != x:
b.append(x.lower())
@s3rgeym
s3rgeym / assert.js
Last active March 9, 2018 13:01
JavaScript assert
// Ошибку, генерируюмую console.assert, перехватить не удастся.
class AssertionError extends Error {
constructor(message) {
super(message)
Error.captureStackTrace(this, this.constructor)
}
}
function assert(test, message = 'Assertion failed') {
if (!test) {
(function () {
'use strict'
const QUOTES = ['', "'", '"']
// const THRESHOLD = 0.95
// function levenstein(a, b) {
// const d = (i, j) => 0 === Math.min(i, j) ? Math.max(i, j) : Math.min(d(i - 1, j) + 1, d(i, j - 1) + 1, d(i - 1, j - 1) + (a[i - 1] === b[j - 1] ? 0 : 1))
// return d(a.length, b.length)
// }
// levenstein('kitten', 'sitting')
// function ratio(a, b) {
@s3rgeym
s3rgeym / google_search.py
Created July 9, 2017 00:41
Python Google search results grabber
import random
import re
import sys
from argparse import ArgumentParser
# pip install pyqt5
from PyQt5.QtCore import *
from PyQt5.QtWebEngineWidgets import *
from PyQt5.QtWidgets import *

Шпаргалка по Linux

Терминал

В Ubuntu придется часто использовать терминал. Его можно вызвать сочетанием клавиш Ctr+Alt+T. Важно запомнить, что для большинства команд можно вызвать краткую справку:

<command> -h

Тут все про решениеи проблем с GIT

// https://stackoverflow.com/questions/33106709/chrome-webrequest-doesnt-see-post-data-in-requestbody
// https://developer.chrome.com/extensions/webRequest
const wsUrl = 'ws://localhost:8192/ws'
const requestFilter = { urls: ['<all_urls>'] }
const requests = new Map()
let ws
// -function connect() {
// ws = new WebSocket(wsUrl)
# Сколько включена машина

$ uptime                                    
 14:26:14 up 6 days, 23:20,  1 user,  load average: 1,18, 1,58, 1,88

# Все запущенные серверы, использующие TCP/IP

$ netstat -lnt

Create a new project

poetry new <project-name>

Add a new lib

potry add <library>

Remove a lib

@s3rgeym
s3rgeym / Python Development.md
Last active February 10, 2022 10:01
Разработка на Python и все, что с ней связано

Терминология

Различие между модулем, пакетом, библиотекой и фреймворком

Модуль – это единственный файл с функциями и классами.

Пакет – это два и более модулей. В python файловая структура пакета выглядит так:

package/