Skip to content

Instantly share code, notes, and snippets.

@mfansler
mfansler / conda.txt
Last active April 24, 2024 00:44 — forked from dataprofessor/conda.txt
Installing mamba on Google Colab
#################################################################################
# INSTALL MAMBA ON GOOGLE COLAB
#################################################################################
! wget -O miniconda.sh https://repo.anaconda.com/miniconda/Miniconda3-py37_4.10.3-Linux-x86_64.sh
! chmod +x miniconda.sh
! bash ./miniconda.sh -b -f -p /usr/local
! rm miniconda.sh
! conda config --add channels conda-forge
! conda install -y mamba
! mamba update -qy --all
/* Numerically solve for the time-dependent Schrodinger equation in 2D,
using the split operator method. To build and run, type:
rustc qm2d_split_op.rs
./qm2d_split_op
This will output a series of bmp images which show each frame of the
simulation.
References:
@othyn
othyn / guide.md
Last active April 24, 2024 00:43
Fix horrendously bad macOS (12.3.1 tested) SMB (Samba) performance on Unraid

Intro

Out of the box, my SMB performance on macOS 12.3.1 would top out at around 20MB/s in short ~5 second bursts, which was absolutely horrendous, slow to navigate in Finder and slugish to interact with.

Since making these changes, I now get sustained ~80-100MB/s+ and instant Finder navigation which is superb and how things should be out-of-the-box (OOTB)!

May 2023 update: As of Ventura, the SMB issues were just horribly inconsistent and hard to maintain. Something in the combination of Unraid, macOS and SMB just doesn't play nice. I ended up binning NFS/SMB all together and heading to a locally hosted Nextcloud instance for file syncing, then using SFTP/Ansible Git flow for editing files within appdata.

Sources

@vasanthk
vasanthk / System Design.md
Last active April 24, 2024 00:42
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
@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