Skip to content

Instantly share code, notes, and snippets.

View DKepov's full-sized avatar
💭
🏡 Working

Dmitriy Kepov DKepov

💭
🏡 Working
View GitHub Profile
@DarkGhostHunter
DarkGhostHunter / log-levels.csv
Last active March 12, 2022 04:38
Log levels table
Property / Log Level Debug Info Notice Warning Error Critical Alert Emergency
Disposable X
Statistical X X X X X X X
Relevant X X X X X X
Undersired X X X X X
Unstable X X X X
Stateful X X X
Unsecure X X
Unfixable X
type SubscribedEvent = (...args) => any;
class EventObserver {
public events: SubscribedEvent[] = [];
subscribe(fn: SubscribedEvent) {
this.events.push(fn)
}
unsubscribe(fn: SubscribedEvent) {
/**
* Класс Singleton предоставляет метод getInstance, который позволяет клиентам
* получить доступ к уникальному экземпляру одиночки.
*/
class Singleton {
private static instance: Singleton;
/**
* Конструктор Singleton должен быть приватный, чтобы кто-нибудь случайно не создал
* объект через оператор new.
@albe-rosado
albe-rosado / ubuntu-nm-wiregard.sh
Created May 8, 2021 22:42
Command to install Ubuntu Wireguard network manager plugin
# instal dependencies
sudo apt install wireguard git dh-autoreconf libglib2.0-dev intltool build-essential libgtk-3-dev libnma-dev libsecret-1-dev network-manager-dev resolvconf
# clone repo and build
git clone https://github.com/max-moser/network-manager-wireguard
cd network-manager-wireguard
./autogen.sh --without-libnm-glib
./configure --without-libnm-glib --prefix=/usr --sysconfdir=/etc --libdir=/usr/lib/x86_64-linux-gnu --libexecdir=/usr/lib/NetworkManager --localstatedir=/var
@ahmedash95
ahmedash95 / README.md
Created March 4, 2020 23:42
Laravel Eloquent Collection set relations

Usage

// Instead Of

$categories = Category::all();

$products = Products::all();

$products->each(function($product) use ($categories) {
@CrabAss
CrabAss / firefox-x11.md
Last active March 9, 2023 12:39
How to remotely run Firefox on Ubuntu Server 18.04

How to remotely run Firefox on Ubuntu Server 18.04

My environment

  • Ubuntu Server 18.04 on my local Hyper-V (on Windows 10 Pro 19H2)
  • SSH client: Xshell 6

Procedure

Configure X11 Forwarding

@daopk
daopk / git-config-http-version.md
Last active May 8, 2024 07:05
Fix error : RPC failed; curl 92 HTTP/2 stream 0 was not closed cleanly: PROTOCOL_ERROR (err 1)
git config --global http.version HTTP/1.1
git config --global http.postBuffer 157286400
// This injects a box into the page that moves with the mouse;
// Useful for debugging
async function installMouseHelper(page) {
await page.evaluateOnNewDocument(() => {
// Install mouse helper only for top-level frame.
if (window !== window.parent)
return;
window.addEventListener('DOMContentLoaded', () => {
const box = document.createElement('puppeteer-mouse-pointer');
const styleElement = document.createElement('style');
@iPublicis
iPublicis / trelloinstall.sh
Last active April 21, 2023 17:44
Install Trello Linux Client
#!/bin/bash
# Your system should be 64 bits and check if the last version at https://github.com/danielchatfield/trello-desktop/ is 0.19
# If the current version is not 0.19 change the file name below accordingly
wget https://github.com/Racle/trello-desktop/releases/download/v0.2.0/Trello-linux-0.2.0.zip -O trello.zip
sudo mkdir /opt/trello
sudo unzip trello.zip -d /opt/trello/
sudo ln -sf /opt/trello/Trello /usr/bin/trello
echo -e '[Desktop Entry]\n Version=1.0\n Name=Trello Desktop\n Exec=/usr/bin/trello\n Icon=/opt/trello/resources/app/static/Icon.png\n Type=Application\n Categories=Application' | sudo tee /usr/share/applications/trello.desktop
@owencm
owencm / blob-to-image.js
Created January 12, 2019 18:01
Convert a blob to an image with JavaScript (e.g. to render blob to canvas)
const blobToImage = (blob) => {
return new Promise(resolve => {
const url = URL.createObjectURL(blob)
let img = new Image()
img.onload = () => {
URL.revokeObjectURL(url)
resolve(img)
}
img.src = url
})