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 / 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 *
@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) {

Тут все про решениеи проблем с 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 / orm.py
Last active April 26, 2019 12:46
Концепт ORM
class ModelOptions:
...
class ModelMeta(type):
def __new__(mcls, name, bases, attrs):
cls = super().__new__(mcls, name, bases, attrs)
# if name == 'Model':
# return cls
@s3rgeym
s3rgeym / model-user.js
Created May 6, 2019 19:58 — forked from lucasscariot/model-user.js
Composite Primary Key in Sequelize
/*
* Migration
*/
'use strict';
module.exports = {
up: function(queryInterface, Sequelize) {
return queryInterface.createTable('Users', {
firstName: {
type: Sequelize.STRING
},
'use strict';
import Sequelize from 'sequelize';
import bcrypt from 'bcryptjs';
export default class User extends Sequelize.Model {
static init(sequelize) {
return super.init({
username: {
type: Sequelize.STRING,
unique: true,
allowNull: false