Skip to content

Instantly share code, notes, and snippets.

@Vladmel1234
Vladmel1234 / k8s-debug
Created September 11, 2022 05:37
K8s debug script
NAMESPACE=my-namespace
cat <<EOF | kubectl apply -n $NAMESPACE -f -
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: debug
spec:
podSelector:
matchLabels:
app: debug
@Vladmel1234
Vladmel1234 / copy-last-commit.zsh
Last active July 29, 2022 09:03 — forked from alexmacarthur/copy-last-commit.zsh
Copies the last commit SHA to your clipboard.
# Copy the last commit in the current branch, or if passed as a parameter, a different branch.
#
# See the blog post documenting the surprisingly lengthly process of building this here:
# https://macarthur.me/posts/building-a-shell-function-to-copy-latest-commit-sha
function clc {
COLOR_GREEN="\033[0;32m"
COLOR_RESET="\033[0m"
[[ -z $1 ]] && BRANCH=$(git rev-parse --abbrev-ref HEAD) || BRANCH=$1
LAST_COMMIT_SHA=$(git rev-parse $BRANCH | tail -n 1)
@Vladmel1234
Vladmel1234 / git_log.md
Created June 9, 2020 07:30 — forked from olivierlacan/git_log.md
My git log custom output aliases
git config --global alias.hist "log --pretty=format:'%h %ad | %s%d [%an]' --graph --date=short"
git config --global alias.lol "log --graph --decorate --pretty=oneline --abbrev-commit --all"
git config --global alias.mylog "log --pretty=format:'%h %s [%an]' --graph"

To check that they've been added correctly, first run git config --list. You should see something like this in the midst of all your other configuration:

alias.hist=log --pretty=format:"%h %ad | %s%d [%an]" --graph --date=short
@Vladmel1234
Vladmel1234 / virtualenvwrapper.md
Created September 4, 2019 11:44 — forked from dongzhuoyao/virtualenvwrapper.md
virtualenvwrapper Cheat Sheet

local setting

PATH=$PATH:~/.local/bin
source /home/tao/.local/bin/virtualenvwrapper.sh
pip install virtualenvwrapper --user #make everything locally!!

vim, zsh is very hard to install locally without sudo permission.

@Vladmel1234
Vladmel1234 / media-query.css
Created March 7, 2019 14:55 — forked from gokulkrishh/media-query.css
CSS Media Queries for Desktop, Tablet, Mobile.
/*
##Device = Desktops
##Screen = 1281px to higher resolution desktops
*/
@media (min-width: 1281px) {
//CSS
@Vladmel1234
Vladmel1234 / полезная хрень.txt
Created December 14, 2017 11:31
полезная хрень
xcode-select --install # Install Command Line Tools if you haven't already.
sudo xcode-select --switch /Library/Developer/CommandLineTools # Enable command line tools
@Vladmel1234
Vladmel1234 / .js
Last active September 16, 2023 08:48
Write to file node
const fs = require('fs');
const { promisify } = require('util');
import _ from 'lodash';
const promisifiedWriteFile = promisify(fs.writeFile);
const main = [
{
// Place your settings in this file to overwrite the default settings
{
"editor.fontSize": 15,
"editor.fontFamily": "Consolas",
"editor.tabSize": 2,
"editor.wordWrapColumn": 80,
"editor.fontLigatures": true,
"editor.snippetSuggestions": "top",
"editor.minimap.enabled": true,
"files.exclude": {
@Vladmel1234
Vladmel1234 / .eslintrc
Created July 19, 2017 07:54
eslint rc work
{
"extends": "eslint-config-airbnb",
"parser": "babel-eslint",
"env": {
"browser": true,
"node": true,
"mocha": true
},
"rules": {
"react/jsx-boolean-value": 0,
@Vladmel1234
Vladmel1234 / swaparrayelements.js
Created June 12, 2017 06:31 — forked from eerohele/swaparrayelements.js
Swap two array elements (JavaScript)
/**
* Swap the elements in an array at indexes x and y.
*
* @param (a) The array.
* @param (x) The index of the first element to swap.
* @param (y) The index of the second element to swap.
* @return {Array} A new array with the elements swapped.
*/
var swapArrayElements = function (a, x, y) {
if (a.length === 1) return a;