Skip to content

Instantly share code, notes, and snippets.

@xeptore
xeptore / voucher-validator.ts
Last active July 4, 2021 06:05
Voucher Validator Idea Implementation
const enum Gender {
Male = "Male",
Female = "Female",
}
interface Order {
id: string;
date: Date;
totalPrice: number;
customer: {
@xeptore
xeptore / gitlab-runner-cache-s3-policy.md
Created April 6, 2021 06:22
GitLab Runner (Shared) Cache Amazon S3 Bucket Policy

GitLab Runner (Shared) Cache Amazon S3 Bucket Policy

{
  "Version":"2012-10-17",
  "Statement":[
    {
      "Sid":"seems-it-doesnt-matter-much-except-the-uniqueness",
      "Effect":"Allow",
      "Action":[
@xeptore
xeptore / wireguard-ubuntu-20.04-installation.md
Last active April 5, 2021 05:39
Wireguard Ubuntu 20.04 Installation Guide
  1. Install

    sudo apt update
    sudo apt upgrade -y
    sudo apt install wireguard
  2. Configure Server

@xeptore
xeptore / shadowsocks-ubuntu-20.04-installation.md
Last active January 29, 2025 14:33
Shadowsocks Ubuntu 20.04 Installation Guide
  1. Install

    sudo apt update
    sudo apt install shadowsocks-libev
  2. Configure

    sudo vim /etc/shadowsocks-libev/config.json
@xeptore
xeptore / .bashrc
Last active January 20, 2020 19:23
My ~/.bashrc file.
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return ;;
esac
@xeptore
xeptore / software_design.md
Last active October 12, 2019 04:16
Some Quotes and Remarks To Become A Daily Habit

Implementation

  • If an instance of B should be used anywhere an instance of A, the use inheritance. If an instance of B should use an instance of A, use composition/delegation.
  • Use composition/delegation, unless you want substitutability.

Core

  • Be unemotional about designing your software.
  • It is almost impossible to get it right the first time.
  • Defer decisions that are possible to be deferred.

Good Design

@xeptore
xeptore / deadsnakes-ppa-bionic.list
Created May 4, 2019 04:07
Python 3.7 ppa launchpad ubuntu repository
# paste following lines into /etc/apt/sources.list.d/deadsnakes-ppa-bionic.list
deb http://ppa.launchpad.net/deadsnakes/ppa/ubuntu bionic main
deb-src http://ppa.launchpad.net/deadsnakes/ppa/ubuntu bionic main
@xeptore
xeptore / pre-commit
Created April 29, 2019 05:36
ASP .NET Core using statements sort git precommit hook
#!/usr/bin/python3.7
import subprocess
import re
from collections import defaultdict
stagedFiles = subprocess.run(["git", "diff", "--cached", "--name-only", "--diff-filter=ACM"], capture_output=True, text=True).stdout.strip().split("\n")
def sortLines(lines):
d = defaultdict(list)
zipped = [(x[6:x.index(".")], x) for x in lines]
@xeptore
xeptore / CMakeLists.txt
Last active July 5, 2019 11:45
cpp vscode development (cmake, build, and debugging) configurations
cmake_minimum_required (VERSION 3.10)
project (main)
# book.cpp implementing book.h definitions
add_library(Book book.h book.cpp)
add_executable(main main.cpp)
# linking Book library to main
target_link_libraries (main Book)
@xeptore
xeptore / .eslintrc.yml
Last active May 7, 2019 10:03
eslint configurations for React apps
env:
browser: true
commonjs: true
es6: true
node: true
extends:
- eslint:recommended
- airbnb
- plugin:react/recommended
- plugin:import/errors