Skip to content

Instantly share code, notes, and snippets.

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

Nikita Bayev drugoi

🏠
Working from home
  • Bereke Bank
  • Almaty, Kazakhstan
View GitHub Profile
const orders = [];
const fetchOrders = async (next = 1) => {
const response = await fetch(
`https://arbuz.kz/api/v1/order/list?page=${next}&limit=10`,
{
headers: {
accept: "application/json, text/plain, */*",
},
referrer: "https://arbuz.kz/ru/profile",
referrerPolicy: "strict-origin-when-cross-origin",
@drugoi
drugoi / post-to-jira.sh
Created December 23, 2020 10:22
Script for Gitlab CI to post comment about build to JIRA
#!/bin/bash
# Find something like UKK-0000 in variables
# NOTE: Script will use only first match to post comment (head -1)
COMMIT_TICKET=$(echo $CI_COMMIT_MESSAGE | grep -e '[A-Z]\+-[0-9]\+' -o | head -1)
DESCRIPTION_TICKET=$(echo $CI_COMMIT_DESCRIPTION | grep -e '[A-Z]\+-[0-9]\+' -o | head -1)
BRANCH_TICKET=$(echo $CI_COMMIT_REF_NAME | grep -e '[A-Z]\+-[0-9]\+' -o | head -1)
# Check is variables not empty
if [[ -n "$COMMIT_TICKET" || -n "$BRANCH_TICKET" || -n "$DESCRIPTION_TICKET" ]]; then
@drugoi
drugoi / scope-count.py
Last active September 26, 2022 05:38
Collect scope from commitlint
import csv
# before: git log --pretty=format:%s | grep -E '^(\w+)\((\w+|\*)\)' > commits.log
def logFileToList(logFilename):
resList = []
with open(logFilename) as f:
for s in f:
resList.append(s)
return resList
@drugoi
drugoi / kazakh-regex.js
Created November 20, 2019 11:39
Regex for kazakh and russian characters
const regex = /^[а-яА-ЯёЁa-zA-Z\u04D8\u04D9\u04B0\u04B1\u0406\u0456\u04A2\u04A3\u0492\u0493\u04AE\u04AF\u049A\u049B\u04E8\u04E9\u04BA\u04BB]$/g;
const download = (fileName, mimeType, fileData) => {
if (window.navigator.msSaveOrOpenBlob === undefined) {
const e = document.createElement('a');
const href = `data:${mimeType};base64,${fileData}`;
e.setAttribute('href', href);
e.setAttribute('download', fileName);
document.body.appendChild(e);
e.click();
document.body.removeChild(e);
} else {
@drugoi
drugoi / serve.py
Created October 9, 2017 09:36 — forked from chrisbolin/serve.py
Python SimpleHTTPServer for Static Serving (React / Angular / Ember) in HTML5 mode (a la mod_rewrite)
'''
Taken from:
http://stackoverflow.com/users/1074592/fakerainbrigand
http://stackoverflow.com/questions/15401815/python-simplehttpserver
'''
import SimpleHTTPServer, SocketServer
import urlparse, os
PORT = 3000

Keybase proof

I hereby claim:

  • I am drugoi on github.
  • I am drugoi (https://keybase.io/drugoi) on keybase.
  • I have a public key ASAyOaGk9HZ29Q7b7aPGLC2S33RGHMJtfJUaE6zFHONBqQo

To claim this, I am signing this object:

@drugoi
drugoi / count-layers-psd.js
Created June 9, 2017 05:59
Script for counting layers in PSD file.
var totalProgress = 0 // I assume this is defined eleswhere but is needed for the scriptler
function layerCounter(inObj) { // recursive function to count layers
totalProgress += inObj.artLayers.length;
for (var i = 0; i < inObj.layerSets.length; i++) {
totalProgress++;
layerCounter(inObj.layerSets[i]); // recursive call to layerCounter
}
return totalProgress;
}
@drugoi
drugoi / social-hosts
Created December 6, 2016 06:46
My hosts file for social shabbat
# BEGIN SHABBAT BLOCK
0.0.0.0 twitter.com
:: twitter.com
0.0.0.0 vk.com
:: vk.com
0.0.0.0 facebook.com
:: facebook.com
0.0.0.0 www.facebook.com
:: www.facebook.com
0.0.0.0 api.twitter.com
@drugoi
drugoi / detect-lang.js
Created July 15, 2016 05:16
Get prefered language
navigator.languages ? navigator.languages[0] : (navigator.language || navigator.userLanguage)