Skip to content

Instantly share code, notes, and snippets.

@jbfriedrich
jbfriedrich / nsmb.conf
Last active April 24, 2024 00:39
macOS 11.2 NSMB configuration
# /etc/nsmb.conf - macOS 11.3 - 2021-04-29
#------------------------------------------------------------------------------
# SMB configuration for macOS 11.3 <-> Synology
#------------------------------------------------------------------------------
# Additional information:
# -----------------------
# https://support.apple.com/de-de/HT211927
# https://support.apple.com/en-us/HT208209
# https://apple.stackexchange.com/questions/309016/smb-share-deadlocks-since-high-sierra
# https://photographylife.com/afp-vs-nfs-vs-smb-performance
@fracasula
fracasula / getMp3StreamTitle.php
Last active April 24, 2024 00:38
How to get the MP3 metadata (StreamTitle) from a streaming URL
<?php
/**
* Please be aware. This gist requires at least PHP 5.4 to run correctly.
* Otherwise consider downgrading the $opts array code to the classic "array" syntax.
*/
function getMp3StreamTitle($streamingUrl, $interval, $offset = 0, $headers = true)
{
$needle = 'StreamTitle=';
$ua = 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.110 Safari/537.36';
@wojukasz
wojukasz / keybindings.json
Created March 31, 2023 11:43
VsCode + Vim keybindings and settings - best of both worlds
[
//
// VIM NAVIGATION SHORTCUTS
//
{
// "ctrl+h": Focuses on the left editor group when the text editor is focused, Vim extension is active, and Vim is not in Insert mode.
"key": "ctrl+h",
"command": "workbench.action.focusLeftGroup",
"when": "editorTextFocus && vim.active && vim.mode != 'Insert'"
@cardil
cardil / JEP.md
Last active April 24, 2024 00:34
[Draft] JEP - Change name of imported type (aliasing)

Summary

Change name of imported type (aliasing)

Goals

The goal is to make code more productive and clean in cases where multiple classes with same name must be used in code. It should relief a developers frustration in that

@Webreaper
Webreaper / docker-compose.yml
Last active April 24, 2024 00:28
Sample Docker-compose file which shows how to set up Sonarr, Radarr, Prowlarr, Lidarr, QBittorrent and a VPN container so that all all traffic from the containers is routed through the VPN. Also includes Plex and get_iplayer containers, which are not routed through the VPN.
# Docker compose to set up containers for all services you need:
# VPN
# Sonarr, Radarr, Lidarr, Qbittorrent
# Non-VPN
# Plex, get_iplayer
# Before running docker-compose, you should pre-create all of the following folders.
# Folders for Docker State:
# /volume1/dockerdata. - root where this docker-compose.yml should live
# /volume1/dockerdata/plex - Plex config and DB
# /volume1/dockerdata/sonarr - Sonarr config and DB
@wojteklu
wojteklu / clean_code.md
Last active April 24, 2024 00:28
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

@undoZen
undoZen / README.md
Last active April 24, 2024 00:25
Remesh snippets for VSCode

Remesh snippets for VS Code.

Installation

VSCode

per workspace

  1. cd into you the .vscode directory in your project, mkdir .vscode if this folder does not exists.
  2. wget https://gist.githubusercontent.com/undoZen/d104b2c88086f90165c438b61ef7c99b/raw/typescript.code-snippets
@jboner
jboner / latency.txt
Last active April 24, 2024 00:20
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@ronshapiro
ronshapiro / dagger-android-view.md
Last active April 24, 2024 00:19
dagger.android for views in ~10 minutes

1. You can implement View.getActivity() like this:

public interface ViewWithActivity {
  // Using android-gradle-plugin 3.0, which has the desugar step for default methods on interfaces
  default Activity getActivity() {
    // https://android.googlesource.com/platform/frameworks/support/+/03e0f3daf3c97ee95cd78b2f07bc9c1be05d43db/v7/mediarouter/src/android/support/v7/app/MediaRouteButton.java#276
    Context context = getContext();
    while (context instanceof ContextWrapper) {
      if (context instanceof Activity) {