Skip to content

Instantly share code, notes, and snippets.

View mkatychev's full-sized avatar
💭
Убейся в праздники! Раб, твои галеры в огне

Mikhail Katychev mkatychev

💭
Убейся в праздники! Раб, твои галеры в огне
View GitHub Profile
@mkatychev
mkatychev / country_calling_properties.json
Last active February 15, 2018 20:26
Country phone number properties JSON. contains ISO ALPHA 2 & 3, international & national prefix, as well as valid number lengths("national_significant_number")
{
"Afghanistan": {
"alpha_3": "AFG",
"alpha_2": "AF",
"numeric_code": "93",
"international_perfix": "0",
"national_prefix": "0",
"national_significant_number": "9 digits",
"nsn_array": [
9
[
{
"country_name": "Afghanistan",
"alpha_3": "AFG",
"alpha_2": "AF",
"numeric_code": "93",
"international_perfix": "0",
"national_prefix": "0",
"national_significant_number": "9 digits",
"nsn_array": [
@mkatychev
mkatychev / auto_importer.js
Created July 23, 2018 10:24
Simple script to import files as variables from a predetermined filepath (quite useful for media folders with tons of pictures and the like)
import fs
const fs = require('fs');
function importFiles(x,y) {
fs.readdir(x, (err, files) => {
files.forEach(file => {
var doc = file
var char = /.+(?=\.\w+)/.exec(file);
if (char !== null) {
from collections import OrderedDict
from markdown_to_json.markdown_to_json import Renderer, CMarkASTNester
from markdown_to_json.vendor import CommonMark
def od_to_d(od):
if type(od) == OrderedDict:
od = dict(od.items())
for k, v in od.items():
od[k] = od_to_d(v)
@mkatychev
mkatychev / rust_book_section_whitelist.txt
Created October 20, 2018 18:02
Rust book reference whitelist
# any line that does not start with '“' and ends with '”' is ignored.
“Add Amir to Sales.”
“Add Sally to Engineering”
“And the rest”
“Blue”
“Foundations of C++”
“Hello, world!”
“Hola”
“If this condition is met, run this block of code. If the condition is not met, do not run this block of code.”
“Ignored”
@mkatychev
mkatychev / powerlineify.sh
Last active February 20, 2019 16:18
powerline patched font for termtosvg
#!/bin/bash
# https://sourcefoundry.org/hack/
cdn_uri="https://cdn.jsdelivr.net/npm/[email protected]/build/web/hack.css"
font_name="Hack"
function powerlineify(){
# https://github.com/chmln/sd
# brew install rustup-init && cargo install sd
sd -i \
"(<style type=\"text/css\".+>)" \
"\${1}@import url(\"$cdn_uri\");" "$1"
package main
import (
"fmt"
)
type Place struct {
name string
location [2]float64
}
@mkatychev
mkatychev / diffignore.sh
Last active October 23, 2019 20:12
Parse A .ignore file for diffing git
#!/usr/bin/env bash
# https://github.com/ggreer/the_silver_searcher/wiki/Advanced-Usage#ignore
# git diff master -- $(diffignore.sh)
DIFFI=''
test -f ".diffignore" || cp ./scripts/.diffignore.base ./.diffignore || exit 1
while read -r ignore;do
@mkatychev
mkatychev / item_fetcher.py
Created December 1, 2020 05:50
item_fetcher
import sys
import requests
search_param=sys.argv[1]
if search_param == "--help":
print("USAGE:\n\t item_fetcher.py <item>")
else:
print(search_param)
item_id_r = requests.get(f"https://api.nexushub.co/wow-classic/v1/search?query={search_param}")
item_id=item_id_r.json()[0]["itemId"]
@mkatychev
mkatychev / usher.go
Created March 2, 2021 23:03
Synchronous output
package main
import (
"errors"
"sync"
)
type QueueEntry struct {
id string
complete bool