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 / parser.js
Last active October 23, 2016 21:15
spbkit lessons parser
var express = require('express');
var request = require('request');
var iconv = require('iconv-lite');
var cheerio = require('cheerio');
var lessons = [];
var app = express();
app.get('/', function(req, res){
@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 {
@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 / 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 / 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 / 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 / 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) {
export default {
name: "FetchApi",
props: {
method: {
type: String,
required: true
},
endpoint: {
type: String,
required: true
@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: {
@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