Skip to content

Instantly share code, notes, and snippets.

View korolr's full-sized avatar
:shipit:
¯\_(ツ)_/¯

Alexsey Ramzaev korolr

:shipit:
¯\_(ツ)_/¯
View GitHub Profile
import click
from selenium import webdriver
import time
from selenium.webdriver.chrome.options import Options
@click.command()
@click.option("--login", default="login", help="You login on github.com")
@click.option("--passwd", default="pass", help="You password on github.com")
@click.option("--search", default="git", help="Search rep in girhub by update")
@korolr
korolr / elm-dmy-fr.md
Created August 14, 2019 12:18 — forked from rlefevre/elm-dmy-fr.md
Elm using elm.dmy.fr proxies

Disclaimer: These proxies and instructions are not from the Elm team. I'm just a community member..


Here is how to use the proxies:

Packages documentation

Two options:

1. Browse elm.dmy.fr instead of package.elm-lang.org

@korolr
korolr / translit.py
Last active May 9, 2019 19:56
translit.py
import os
from sys import argv
def latinizator(letter, dic):
for i, j in dic.items():
letter = letter.replace(i, j)
return letter
legend = {
' ':'_',
@korolr
korolr / main.hs
Created February 17, 2019 17:22
BurlywoodPlasticApi created by korolr - https://repl.it/@korolr/BurlywoodPlasticApi
sum2 :: Integer -> (Integer, Integer)
sum2 0 = (0,1)
sum2 x = let
a = if x < 0 then x * (-1) else x
b = (+) (div a 10) (a `mod` 10)
c = if a < 10 then a else 2
in (b, c)
main :: IO ()
main = print $ sum2 (-39)
@korolr
korolr / main.hs
Created February 17, 2019 14:03
BurlywoodPlasticApi created by korolr - https://repl.it/@korolr/BurlywoodPlasticApi
import Data.Char
twoDigits2Int :: Char -> Char -> Int
twoDigits2Int x y = read $ x:y:[] :: Int
main :: IO ()
main = print $ twoDigits2Int '4' '2'
from selenium import webdriver
import time
def main():
driver = webdriver.Firefox()
driver.get("https://www.allbestbets.com/arbs")
time.sleep(0.7)
with open('index.html', 'w') as f:
f.write(driver.page_source)
@korolr
korolr / index.ts
Created December 11, 2018 19:09 — forked from vvakame/index.ts
TypeScript + Redux なアレ(React+Redux 3日やってみはじめて期限に間に合わないと判断し作業をやめた人なので信頼性があるかは申し訳ないですが謎です…
import { createStore, applyMiddleware, combineReducers } from "redux";
import thunk from "redux-thunk";
import { userReducer, UserAction, UserState } from "./user";
import { handshakeReducer, HandShakeAction, HandshakeState } from "./handshake";
import { productInfoReducer, ProductInfoAction, ProductInfoState } from "./product";
import { circleReducer, CircleAction, CircleState } from "./circle";
export const store = createStore(combineReducers({
user: userReducer,
@korolr
korolr / A Nuxt.js VPS production deployment.md
Created November 19, 2018 10:12 — forked from DreaMinder/A Nuxt.js VPS production deployment.md
Deployment manual for a real-world project built with nuxt.js + koa + nginx + pm2

Example of deployment process which I use in my Nuxt.js projects. I usually have 3 components running per project: admin-panel SPA, nuxt.js renderer and JSON API.

This manual is relevant for VPS such as DigitalOcean.com or Vultr.com. It's easier to use things like Now for deployment but for most cases VPS gives more flexebillity needed for projects bigger then a landing page.


Let's assume that you have entered fresh installation of Ubuntu instance via SSH. Let's rock:

1.Initial setup.

Redux WebSocket Middleware: Example

This Gist provides some code examples of how to implement WebSocket stream handling using a Redux middleware. Please be aware that this is only provided as an example and that critical things like exception handling have not been implemented.

A more complete version has been packaged, tested, and is available on GitHub as redux-websocket. This library has also been published to npm at @giantmachines/redux-websocket.

Middleware

This module represents the foundation of the middleware and implements the ideas presented above. The exported function is used during the creation of the Redux store (see the following snippet).

@korolr
korolr / tokens.md
Created September 2, 2018 08:53 — forked from zmts/tokens.md
Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication

Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication

Preconditions:

В данной заметке рассматривается работа JWT с симметичным алгоритмом шифрования (HS256/HS384/HS512)

Основы:

Аутентификация(authentication, от греч. αὐθεντικός [authentikos] – реальный, подлинный; от αὐθέντης [authentes] – автор) - это процесс проверки учётных данных пользователя (логин/пароль). Проверка подлинности пользователя путём сравнения введённого им логина/пароля с логином/паролем, сохранённым в базе данных пользователей.

Авторизация(authorization — разрешение, уполномочивание) - это проверка прав пользователя на доступ к определенным ресурсам.