You'll learn basics of how to use shell
is interactive and tries to correct your mistakes, it asks questions
######### MY PROMPT START | |
$SHOW_GIT_PROMPT = 0 | |
function get_git_branch { | |
# Because git is crazy slow on my Windows, I need to do sth like below | |
$script = @' | |
import pathlib as p | |
import sys |
You'll learn basics of how to use shell
is interactive and tries to correct your mistakes, it asks questions
#!/usr/bin/env python | |
# NOTE: Put it as your global prepare-commit-msg hook. | |
# Usually at `~/.git-templates/hooks/prepare-commit-msg`. | |
# REMEMBER to make it executable with `chmod +x ~/.git-templates/hooks/prepare-commit-msg`. | |
# | |
# After that all new repositories should have this hook installed. | |
# In existing repos you need to run `git init` to apply this hook. | |
import re |
[run] | |
omit = **/test_*.py |
import time | |
from functools import wraps | |
def log_time_info(logger=None): | |
if logger == None: | |
from logging import getLogger | |
logger = getLogger() |
{ | |
"version": "2.0.0", | |
"tasks": [ | |
{ | |
"label": "Run flake8 on whole project", | |
"type": "shell", | |
"command": "${config:python.pythonPath}", | |
"args": [ | |
"-m", | |
"flake8", |
# Example of handling application config using pydantic https://github.com/samuelcolvin/pydantic | |
# Use python>=3.6 and install pydantic==1.3.1 to run it | |
import unittest | |
from dataclasses import FrozenInstanceError | |
from typing import Optional | |
from pydantic.dataclasses import dataclass | |
from pydantic import ValidationError |
# Theme based on Candy and Bira theme from oh-my-zsh: | |
# https://github.com/robbyrussell/oh-my-zsh/blob/master/themes/bira.zsh-theme | |
# https://github.com/robbyrussell/oh-my-zsh/blob/master/themes/candy.zsh-theme | |
# Some code stolen from oh-my-fish clearance theme: https://github.com/bpinto/oh-my-fish/blob/master/themes/clearance/ | |
# Preview | |
# ✪ pg@liege [18:27:11] /home/pg/.local/share/omf/themes/81e4a75d3f586cbe8417d00711261e9b <master*> | |
# $ rm -rf / # yolo | |
# Some configuration |
function git_tag() { | |
echo -n $(git tag --points-at HEAD) | |
} | |
function git_tag_formatted() { | |
inside_git_repo="$(git rev-parse --is-inside-work-tree 2>/dev/null)" | |
if [ "$inside_git_repo" ]; then | |
if [ -z $(git_tag) ]; then | |
echo -n | |
else |
const | |
path = require('path'), | |
fs = require('fs'); | |
const waitForFileToExist = (filepath, forTime = 5000) => { | |
return new Promise((resolve, reject) => { | |
const | |
filedir = path.dirname(filepath), | |
filename = path.basename(filepath); | |
if (fs.existsSync(filepath)) { |