Skip to content

Instantly share code, notes, and snippets.

View istarkov's full-sized avatar
💭
I need snow, now!

Ivan Starkov istarkov

💭
I need snow, now!
View GitHub Profile
108.61.178.34
console.log('=====================test.js======================');
console.log('=====================test.js======================');
console.log('=====================test.js======================');
window.addEventListener('load', function () {
console.log('=====================test.js======================');
});
@istarkov
istarkov / .zshrc
Last active October 6, 2023 05:41
.zshrc pass function
pass() {
local input
read -r input
print -n "\e[1A\e[K"
local var=$(echo $input | sed 'y/[!"№%:,.;йцукенгшщзхъёфывапролджэячсмитьбюЙЦУКЕНГШЩЗХЪЁФЫВАПРОЛДЖЭЯЧСМИТЬБЮ/~!@#$%^&*qwertyuiop[]\\asdfghjkl;\''zxcvbnm,.QWERTYUIOP{}|ASDFGHJKL:"ZXCVBNM<>/')
echo -n "$var"
read -r input
print -n "\e[1A\e[K"
}
// Intent to test n8n endpoints locally
resource "random_id" "playground_tunnel_secret" {
byte_length = 35
}
resource "cloudflare_tunnel" "playground" {
provider = cloudflare.main
account_id = local.cloudflare_account_id
@istarkov
istarkov / services.md
Created May 5, 2023 05:57
Services I would probably use someday
@istarkov
istarkov / .zshrc
Created April 25, 2023 06:49
Get bw password by exact name, fix of this https://github.com/bitwarden/clients/issues/3366
# https://github.com/bitwarden/clients/issues/3366
# Usage:
# bwget <item-name>
# to get any org password
# bwget <item-name> null
# to get self password
bwget() {
local pwd
local count
# by default search inside any organisation
@istarkov
istarkov / .zshrc
Last active April 17, 2023 06:06
gitclean alias
# gitclean allows to work with multiple origins, cleans all deleteded aliases
alias gitclean="(git remote | xargs git remote prune) && git branch -vv | egrep '('\$(git remote | xargs | sed -e 's/ /|/g')')/.*: gone]' | awk '{print \$1}' | xargs git branch -D"
@istarkov
istarkov / icu.ts
Created November 4, 2021 11:41
icu.pegjs
/*Parses ICU messages format https://messageformat.github.io/messageformat/guide/
like
{from} - {to} {results, plural,
one { # result }
many { # results }
} text {vr} rmm
{s, select,
man { He is "#"#"#" }
woman { She is # }
}

Challenge

You have a json file with following structure (example)

[
  { 
    "id": 1,
    "title": "Hello",
 "description": "World"
@istarkov
istarkov / rollup-plugin-relay.js
Last active March 3, 2022 01:20
Fast and dirty rollup relay plugin (for use in vite + sveltekit)
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
export default function relay() {
return {
name: 'relay',
transform(code) {
// Use indexOf as its probably ;-) faster
if (code.indexOf('graphql`') > -1) {
const re = /graphql`[^`]+(?<type>query|fragment|mutation)\s+(?<name>[\w_-\d]+)[^`]+`/gm;
let imports = [];