Skip to content

Instantly share code, notes, and snippets.

View MichalMazurek's full-sized avatar
😁

Michal Mazurek MichalMazurek

😁
View GitHub Profile
{{#each messages }}
<div role="alert"
class="animate-duration-200 animate-ease-in animate-fill-both animate-normal animate-flip-down alert
{{#if (eq alert_type "info")}}alert-info{{/if}}
{{#if (eq alert_type "error" )}}alert-error{{/if}}
{{#if (eq alert_type "success")}}alert-success{{/if}}
{{#if (eq alert_type "warning" )}}alert-warning{{/if}}"
style="margin-bottom: 0.5rem;">
{{#if (eq alert_type "error")}}
--[[
lvim is the global options object
Linters should be
filled in as strings with either
a global executable or a path to
an executable
]]
-- THESE ARE EXAMPLE CONFIGS FEEL FREE TO CHANGE TO WHATEVER YOU WANT
@MichalMazurek
MichalMazurek / init.vim
Last active February 27, 2021 16:56
init.vim
:inoremap <C-e> <C-o>$
:inoremap <C-a> <C-o>0
" https://medium.com/better-programming/setting-up-neovim-for-web-development-in-2020-d800de3efacd
" https://jdhao.github.io/2018/12/24/centos_nvim_install_use_guide_en/#the-difference-between-nvim-and-vim
" curl -fLo ~/.local/share/nvim/site/autoload/plug.vim --create-dirs \
" https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
call plug#begin('~/.local/share/nvim/plugged')
from typing import Dict, List
import aiohttp
import asyncio
import time
JOKE_URL = "http://api.icndb.com/jokes/random"
async def download_joke(session: aiohttp.ClientSession) -> Dict[str, str]:
def _read_private_key(self, tag, f, password=None):
lines = f.readlines()
start = 0
beginning_of_key = "-----BEGIN " + tag + " PRIVATE KEY-----"
while start < len(lines) and lines[start].strip() != beginning_of_key:
start += 1
if start >= len(lines):
raise SSHException("not a valid " + tag + " private key file")
# parse any headers first
...
if not two_factor:
for key_filename in key_filenames:
for pkey_class in (RSAKey, DSSKey, ECDSAKey, Ed25519Key):
try:
key = self._key_from_filepath(
key_filename, pkey_class, passphrase
)
allowed_types = set(
self._transport.auth_publickey(username, key)
)
from typing import Dict, List
def some_func(value: str, data: List = []) -> Dict or List[str]:
data.append(value)
return data
d = some_func("test")
some_func("test2", d)
print(d)
# print only nth column from output
ps ax | awk '{printf "%s\n", $5}'
zsh
ps
tail
awk
# join each line with ","
cat file.txt | awk '{printf (NR>1?",":"") $0}'
import click
from subprocess import run
import os
@click.command()
@click.argument("source_repo", type=str)
@click.argument("source_branch", default="master", type=str)
@click.argument("target_repo", type=str)
@click.argument("target_directory", type=str)
"""
Version retrieving.
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.