Skip to content

Instantly share code, notes, and snippets.

@vitalybe
vitalybe / tab.bash
Last active May 11, 2022 08:14 — forked from bobthecow/tab.bash
Open new Terminal tabs from the command line
#!/bin/bash
#
# Open new Terminal tabs from the command line
#
# Author: Justin Hileman (http://justinhileman.com)
#
# Installation:
# Add the following function to your `.bashrc` or `.bash_profile`,
# or save it somewhere (e.g. `~/.tab.bash`) and source it in `.bashrc`
#
@vitalybe
vitalybe / fav.bat
Last active April 17, 2022 00:18
Favorite folders batch (For Windows)
@setlocal
@echo off
set userChoice=%1
rem The format is:
rem call :condition SHORTCUT FOLDER
call :condition web c:\Git\SecThor\SecWeb\App\
call :condition cloud c:\Git\SecThor\SecCloud\dojo.backend\
call :condition good c:\Users\Vitaly\Dropbox\Projects\goodread-friends\
endlocal
popd
# Generated by Powerlevel10k configuration wizard on 2022-01-30 at 09:33 IST.
# Based on romkatv/powerlevel10k/config/p10k-rainbow.zsh, checksum 53041.
# Wizard options: nerdfont-complete + powerline, small icons, rainbow, unicode,
# 24h time, round separators, sharp heads, flat tails, 2 lines, solid, left frame,
# dark-ornaments, compact, many icons, concise, transient_prompt,
# instant_prompt=verbose.
# Type `p10k configure` to generate another config.
#
# Config for Powerlevel10k with powerline prompt style with colorful background.
# Type `p10k configure` to generate your own config based on it.
@vitalybe
vitalybe / agnoster-vitaly.zsh-theme
Last active November 11, 2021 10:29
Agnoster Prompt - Vitaly
# vim:ft=zsh ts=2 sw=2 sts=2
#
# agnoster's Theme - https://gist.github.com/3712874
# A Powerline-inspired theme for ZSH
#
# # README
#
# In order for this theme to render correctly, you will need a
# [Powerline-patched font](https://github.com/Lokaltog/powerline-fonts).
# Make sure you have a recent version: the code points that Powerline
function App({ date }) {
const [currentDate, setCurrentDate] = useState(new Date());
const [count, setCount] = useState(0);
const prettyDate = useMemo(() => formatDate(currentDate), [currentDate]);
return (
<div className="App">
<h1>Hello CodeSandbox</h1>
<h2>
function formatDate(date) {
const hour = date.getHours();
const minute = date.getMinutes();
const second = date.getSeconds();
return (`${hour}:${minute}:${second}`);
}
const prettyDate = useMemo(() => formatDate(currentDate), [currentDate]);
function App({ date }) {
const [currentDate, setCurrentDate] = useState(new Date());
const [count, setCount] = useState(0);
function updateCount(byValue) {
setCount(count + byValue);
setCurrentDate(new Date());
}
function formatDate() {
@vitalybe
vitalybe / data.json
Last active February 12, 2019 14:19
[
{ "name": "Bandwidth 1", "provider": 48, "user": 240 },
{ "name": "Bandwidth 2", "provider": 10, "user": 80 },
{ "name": "Bandwidth 3", "provider": 50, "user": 75 }
]
safereset = "!f() { \
trap 'echo ERROR: Operation failed; return' ERR; \
echo Making sure there are no changes...; \
last_status=$(git status --porcelain);\
if [[ $last_status != \"\" ]]; then\
echo There are dirty files:;\
echo \"$last_status\";\
echo;\
echo -n \"Enter Y if you would like to DISCARD these changes or W to commit them as WIP: \";\
read dirty_operation;\
@vitalybe
vitalybe / sample.kt
Created March 20, 2017 13:16
Kotlin async sample in Android, including wrapping a legacy callback function
package jp.keita.kagurazaka.sample.coroutine
import android.os.Bundle
import android.support.v7.app.AppCompatActivity
import android.util.Log
import android.widget.Button
import android.widget.Toast
import kotlinx.coroutines.experimental.CommonPool
import kotlinx.coroutines.experimental.android.UI
import kotlinx.coroutines.experimental.async