Skip to content

Instantly share code, notes, and snippets.

@y0ngb1n
y0ngb1n / docker-registry-mirrors.md
Last active May 6, 2024 05:24
国内的 Docker Hub 镜像加速器,由国内教育机构与各大云服务商提供的镜像加速服务 | Dockerized 实践 https://github.com/y0ngb1n/dockerized

Docker Hub 镜像加速器

国内从 Docker Hub 拉取镜像有时会遇到困难,此时可以配置镜像加速器。Docker 官方和国内很多云服务商都提供了国内加速器服务。

Dockerized 实践 https://github.com/y0ngb1n/dockerized

配置加速地址

Ubuntu 16.04+、Debian 8+、CentOS 7+

@wojteklu
wojteklu / clean_code.md
Last active May 6, 2024 05:24
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@natyusha
natyusha / Naty's FFXIV Endwalker Add-ons, Plugins and Mods.md
Last active May 6, 2024 05:23
All the third party add-ons, plugins and mods I use for FFXIV.

Last Updated: Patch 6.58

The program which most people use for parsing in FFXIV and several other MMOs. For an open source alternative consider using IINACT though configuring it won't be covered here.

Options

  • Main Table Encounters
    • General
      • Uncheck: Number of seconds to wait after the last combat action to begin a new encounter.
      • Uncheck: Number of seconds to wait after the last combat action to pause the encounter duration.

Plugins

@arshednabeel
arshednabeel / vicsek.py
Last active May 6, 2024 05:22
A minimal implementation of the Vicsek model in ~50 lines of code
import numpy as np
from tqdm import trange
def get_neighbour_matrix(x, L, R):
dx = np.subtract.outer(x[:, 0], x[:, 0])
dy = np.subtract.outer(x[:, 1], x[:, 1])
dx[dx > (L / 2) ** 2] -= (L / 2) ** 2
dy[dy > (L / 2) ** 2] -= (L / 2) ** 2
pair_dist = dx ** 2 + dy ** 2
@antonycourtney
antonycourtney / DiamondExample.md
Last active May 6, 2024 05:21
A real world example of recombinant / diamond wiring and feedback with RxJS

A realistic RxJS app with diamond wiring

Consider the following user interface (inspired by Strava) for looking at time-series charts of network data:

esnet-estes-charts

Notes on this interface and my Rx implementation of it:

  • Each chart (stacked vertically) charts a different metric (latency, packet loss and throughput) but over the same time period.
  • As the user moves the mouse left and right on any chart, the vertical line (called the tracker) moves to track the mouse position on all charts. The number displayed in the gray box on the right is the value underneath the tracker for that metric.
@ohanhi
ohanhi / joy-of-composition.md
Last active May 6, 2024 05:21
The Joy of Composition - Why stateless rendering is pure bliss

This is a proposal for a lightning talk at the Reactive 2015 conference.

NOTE: If you like this, star ⭐ the Gist - the amount of stars decides whether it makes the cut!

The Joy of Composition

Why stateless rendering is pure bliss

React just got stateless components, meaning that they are in essence pure functions for rendering. Pure functions make it dead simple - even fun - to refactor your views

@kpuputti
kpuputti / fold.js
Last active May 6, 2024 05:20
Functional acrobatics using folds in JavaScript.
/*eslint-env es6 */
// Inspired by the paper "A tutorial on the universality and
// expressiveness of fold" by Graham Hutton (available at
// http://www.cs.nott.ac.uk/~gmh/fold.pdf), implementing some generic
// list handling functions in JavaScript in terms of `fold`.
// Personally I had an enlightnening moment when I realised the
// beautiful interplay of cons lists and foldr during the FP101x
// Haskell course. JavaScript's syntax doesn't make this very apparent
@axefrog
axefrog / scope.js
Last active May 6, 2024 05:20
An idea for scoping Cycle.js child components/dialogues in the context of their parent. Any driver can optionally supply a scope() function, which returns a scoped instance of itself. A driver can also supply an unscope() function which returns a transformed instance of its associated sink. Anything that is scope-unaware is preserved.
function runInScope(main, sources, context, ...args) {
if(!main) {
throw new Error('A "main" function must be supplied, which will be called in scope and from which a (sinks) object will be returned');
}
if(!sources) {
throw new Error('A source drivers object must be supplied, to which scoping can be applied');
}
if(!context) {
throw new Error('A scope context object must be supplied, either as a string, or as an object of key/value pairs');
}
@KarthickSudhakar
KarthickSudhakar / kvm_export_import.sh
Last active May 6, 2024 05:20
Bash script to import and export KVM virtual machine
#!/usr/bin/env bash
# ----------------------------------------------------------------------------------------------------
# AUTHOR : KARTHICK S
# PURPOSE : THIS SCRIPT WILL EXPORT/IMPORT THE CONFIG AND VM DISK.
#
# usage:
# export function will take care of exporting the necessary for all VM. Run as "<scriptname.sh> export"
# import function will take care of importing the necessary for all VM. Run as "<scriptname.sh> import"
#
@attilaking
attilaking / emailValidate.js
Created May 20, 2020 10:39
[Validate email] email validations #email #validate
function ValidateEmail(mail) {
if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(mail)) {
return (true)
}
//alert("You have entered an invalid email address!")
return (false)
}