Skip to content

Instantly share code, notes, and snippets.

View belozerskiy's full-sized avatar
🏠
Working from home

Michael B. belozerskiy

🏠
Working from home
View GitHub Profile
@belozerskiy
belozerskiy / env.md
Created March 16, 2024 13:23
Environment Linux variable

ENV

  • .bashrc - файл переменных конкретного пользователя. Загружается каждый раз, когда пользователь создает терминальный сеанс, то есть проще говоря, открывает новый терминал. Все переменные окружения, созданные в этом файле вступают в силу каждый раз когда началась новая терминальная сессия.

  • .bash_profile - вступают в силу каждый раз когда пользователь подключается удаленно по SSH. Если этот файл отсутствует система будет искать .bash_login или .profile.

  • /etc/environment - создания, редактирования и удаления каких-либо переменных окружения на системном уровне. Переменные окружения, созданные в этом файле доступны для всей системы, для каждого пользователя и даже при удаленном подключении.

  • /etc/bash.bashrc - Системный bashrc. Этот файл выполняется для каждого пользователя, каждый раз когда он создает новую терминальную сессию. Это работает только для локальных пользователей, при подключении через интернет, такие переменные не будут видны.

  • /etc/profile - Системный файл prof

@belozerskiy
belozerskiy / wireguard.conf
Created March 11, 2024 13:12 — forked from nealfennimore/wireguard.conf
Wireguard VPN - Forward all traffic to server
# ------------------------------------------------
# Config files are located in /etc/wireguard/wg0
# ------------------------------------------------
# ---------- Server Config ----------
[Interface]
Address = 10.10.0.1/24 # IPV4 CIDR
Address = fd86:ea04:1111::1/64 # IPV6 CIDR
PostUp = iptables -A FORWARD -i wg0 -j ACCEPT; iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE; ip6tables -A FORWARD -i wg0 -j ACCEPT; ip6tables -t nat -A POSTROUTING -o eth0 -j MASQUERADE # Add forwarding when VPN is started
PostDown = iptables -D FORWARD -i wg0 -j ACCEPT; iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE; ip6tables -D FORWARD -i wg0 -j ACCEPT; ip6tables -t nat -D POSTROUTING -o eth0 -j MASQUERADE # Remove forwarding when VPN is shutdown
@belozerskiy
belozerskiy / LazyHydrate.vue
Created April 27, 2022 20:09 — forked from areknawo/LazyHydrate.vue
Vue 3 lazy hydration component
<script lang="ts">
import { defineComponent, onMounted, PropType, ref, watch } from "vue";
type VoidFunction = () => void;
const isBrowser = () => {
return typeof window === "object";
};
export default defineComponent({
props: {
export default {
name: "FetchApi",
props: {
method: {
type: String,
required: true
},
endpoint: {
type: String,
required: true
@belozerskiy
belozerskiy / dep.js
Last active February 13, 2021 17:57
Very simple dependency tracker system like in vue.js
function Dependency(name, value, cb = null) {
this.name = name
this.value = value
this.callback = cb
}
function DependencyTracker() {
this._stack = [];
this.add = function(dep) {
@belozerskiy
belozerskiy / playground_1.dart
Created March 25, 2020 11:26
play with dart 1
import 'dart:async';
class Range {
final StreamController _controller = StreamController();
final int from;
final int to;
int seconds;
@belozerskiy
belozerskiy / pagination.js
Last active October 15, 2018 20:53
pagination with offset - example: 1...45[6]78...10
// example show in string, this script can be adopted to any other output format
const first = 1 // firs item
const current = 5 // current item
const last = 10 // total items
// init offsets
let startLeftOffset = 1
let endLeftOffset = 1
@belozerskiy
belozerskiy / LinkedList.js
Created March 21, 2018 19:04
Linked list for interview
class Entity {
constructor(item){
this.item = item || null;
this.next = null;
}
}
function LinkedList() {
this.head = new Entity();
@belozerskiy
belozerskiy / mac-php-composer-setup.md
Last active February 21, 2017 11:33 — forked from tomysmile/mac-php-composer-setup.md
Setup PHP Composer using Brew
@belozerskiy
belozerskiy / grid.css
Created February 19, 2017 23:24
Full height flexbox grid template
* {
margin: 0;
padding: 0;
}
*:before, *:after{
box-sizing: border-box;
}
body {