Skip to content

Instantly share code, notes, and snippets.

@projectoperations
projectoperations / README.md
Created May 17, 2024 13:05 — forked from gamma/README.md
How to connect a docker container to the docker daemon on a Synology NAS

Note: This originates from: https://forum.synology.com/enu/viewtopic.php?f=258&t=107508&sid=78d911737c5ecea1f9087bdab13612bf&start=15#p478281

Here are steps that I have modified to work for me. This assumes you have a shared folder named "docker" in volume1.

We need to Symlink /var/run/docker.sock to /volume1/docker/docker.sock, because Synology Docker GUI will not be able to run it when it's pointed directly to /var/run/docker.sock. Also the symlink needs to persist after reboot. To make it do so, you will need to create an automated task in your Synology DSM via "Task Scheduler".

  • Go to "Control Panel" > "Task Scheduler".
  • Click "Create" > "Scheduled Task" > "User-defined Script".
  • On the "Create Task: Window, make sure "User:" is selected as "root" and rename the "Task:" to whatever you like.
  • Click "Schedule" tab. Under "Date - Run on the following days", select "Daily". Under "Time - Frequency", select "Every 1 hour(s)" (just to be on the safe side).
@pppoe252110
pppoe252110 / RandomExtension.cs
Last active May 17, 2024 13:06
A random function to determine a random item from a collection with a chance, with the chance being cast to a value between 0 and 1. Example: chance - 0.1 chance - 0.1 chance - 0.2 become chance - 0.25 chance 0.25 chance - 0.5. This makes it possible not to count a certain chance for hundreds of items in a collection
using System;
using UnityEngine;
public static class RandomExtension
{
public static int ProceedValue(float random, RandomData[] data)
{
var cumulativeSumArray = new float[data.Length];
cumulativeSumArray[0] = data[0].chance;
for (int i = 1; i < cumulativeSumArray.Length; ++i)
@rougier
rougier / fractal-dimension.py
Last active May 17, 2024 13:04
Fractal dimension computing
# -----------------------------------------------------------------------------
# From https://en.wikipedia.org/wiki/Minkowski–Bouligand_dimension:
#
# In fractal geometry, the Minkowski–Bouligand dimension, also known as
# Minkowski dimension or box-counting dimension, is a way of determining the
# fractal dimension of a set S in a Euclidean space Rn, or more generally in a
# metric space (X, d).
# -----------------------------------------------------------------------------
import scipy.misc
import numpy as np
@scottslowe
scottslowe / create-ovs-patch-port
Created November 27, 2012 18:42
Commands to create an OVS patch port
ovs-vsctl add-port <bridge name> <port name>
ovs-vsctl set interface <port name> type=patch
ovs-vsctl set interface <port name> options:peer=<peer name>
@morealaz
morealaz / linux-font-config.md
Last active May 17, 2024 12:59
تنظیمات فونت لینوکس

تنظیمات فونت لینوکس

مقدمه

تنظیمات فونت در لینوکس بر عهده برنامه fontconfig میباشد. این برنامه فونتهای سیستم را بر اساس الویت بندیهایی که قابل تنظیم میباشد مرتب میکند و در اختیار سایر برنامه ها قرار می دهد. مشکل اصلی که اکثر کاربران فارسی زبان لینوکس در ارتباط با fontconfig دارند عدم نمایش صحیح حروف فارسی می باشد که معمولا به دو دلیل زیر اتفاق می‌افتد:

  • نصب نبودن فونت مناسب بر روی سیستم که حروف فارسی را ساپورت کند
  • عدم وجود فایل تنظیمات fontconfig برای انتخاب فونت مناسب برای نمایش حروف فارسی
@JamesMessinger
JamesMessinger / IndexedDB101.js
Last active May 17, 2024 12:59
Very Simple IndexedDB Example
// This works on all devices/browsers, and uses IndexedDBShim as a final fallback
var indexedDB = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB || window.shimIndexedDB;
// Open (or create) the database
var open = indexedDB.open("MyDatabase", 1);
// Create the schema
open.onupgradeneeded = function() {
var db = open.result;
var store = db.createObjectStore("MyObjectStore", {keyPath: "id"});
@CodeMyUI
CodeMyUI / a-css-only-carousel-slider.markdown
Created January 14, 2020 23:02
A CSS-only Carousel Slider