Skip to content

Instantly share code, notes, and snippets.

@fardjad
fardjad / dsl-lte-auto-switch-setup.md
Last active Aug 30, 2020
[DSL/LTE Auto-switch Setup] #openwrt #dsl #lte #multiwan
View dsl-lte-auto-switch-setup.md

DSL/LTE Auto-switch Setup

Synopsis

This is how I setup my home router to share a 4G/LTE connection at day and switch to a DSL connection overnight.

It also falls back to DSL connection whenever the 4G/LTE connection dies.

Why?

@fardjad
fardjad / doublecmd-explorer-integration.reg
Last active Feb 7, 2019
[doublecmd-explorer-integration.reg] Double Commander Explorer Integration #windows #registry #doublecmd
View doublecmd-explorer-integration.reg
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Drive\shell]
@="open"
[HKEY_CLASSES_ROOT\Drive\shell\open]
[HKEY_CLASSES_ROOT\Drive\shell\open\command]
@="C:\\Program Files\\Double Commander\\doublecmd.exe -C \"%1\""
@fardjad
fardjad / Unity3DObjectDragHandler.cs
Last active Feb 7, 2019
[Unity3DObjectDragHandler.cs] Handles drag and drop for a 3D object in Unity3D #unity #csharp #draganddrop
View Unity3DObjectDragHandler.cs
using UnityEngine;
public class Unity3DObjectDragHandler : MonoBehaviour
{
public Camera camera;
public void Start()
{
}
@fardjad
fardjad / find-binary-files-in-git-repo.sh
Created Feb 8, 2019
[find-binary-files-in-git-repo.sh] Find binary files in a git repo #git #bash
View find-binary-files-in-git-repo.sh
#!/bin/bash
git_files=$(git ls-files)
for git_file in $git_files; do
encoding=$(file --mime-encoding "$git_file")
type=$(echo "$encoding" | awk -F ': ' '{ print $2 }')
if [ "$type" == "binary" ]; then
echo $git_file
fi
@fardjad
fardjad / low-level-async-buffered-read.js
Last active Feb 18, 2019
[low-level-async-buffered-read.js] Low-level async buffered read from file with Node.js #nodejs #async #file
View low-level-async-buffered-read.js
const fs = require("fs");
const EventEmitter = require("events").EventEmitter;
const read = (fileHandle, bufferSize, position, emitter) => {
const buffer = Buffer.alloc(bufferSize);
fs.read(
fileHandle,
buffer,
0,
@fardjad
fardjad / how-to-install-parallels-tools-on-manjaro.md
Last active Aug 28, 2021
[How to Install Parallels Tools on Manjaro] Steps required to install Paralells Tools on Manjaro Linux #linux #manjaro #parallelsdesktop #macos
View how-to-install-parallels-tools-on-manjaro.md

How to Install Parallels Tools on Manjaro

Steps required to install Paralells Tools on Manjaro Linux

Steps

  1. Install Manjaro Linux on a VM (it's recommended to take a snapshot before installing Parallels Tools)

  2. Update the OS

     pacman -Syu
    
@fardjad
fardjad / how-to-install-homebrew-on-manjaro.md
Last active Sep 17, 2021
[How to Install homebrew on Manjaro] Steps required to install homebrew on Manjaro Linux #linux #manjaro #homebrew
View how-to-install-homebrew-on-manjaro.md

How to Install homebrew on Manjaro

Steps required to install homebrew on Manjaro Linux

Steps

  1. Install base-devel

     pacman -Syu # CAUTION: this updates the whole system
     pacman -S base-devel
    
@fardjad
fardjad / how-to-use-an-insecure-local-docker-registry-with-minikube.md
Last active Aug 1, 2019
[How to Use an Insecure Local Docker Registry with Minikube] Steps required to use an insecure docker registry running on localhost with Minikube for development #docker #minikube #development #docker_registry
View how-to-use-an-insecure-local-docker-registry-with-minikube.md

How to Use an Insecure Local Docker Registry with Minikube

Steps

  1. Run a local registry server

  2. Log into the Minikube VM with SSH (minikube ssh)

  3. Make sure GatewayPorts option is set to yes in /etc/ssh/sshd_config (and restart the SSH server if necessary)

  4. Forward the exposed registry port on your host machine to the Minikube VM with SSH:

     ssh -i $(minikube ssh-key) -N docker@$(minikube ip) -R 5000:localhost:5000
    
@fardjad
fardjad / how-to-run-photonos-on-virtualbox.md
Created Aug 28, 2019
[How to run PhotonOS 3+ on VirtualBox] #virtualbox #photonos
View how-to-run-photonos-on-virtualbox.md

How to run PhotonOS 3+ on VirtualBox

Steps

Create the VM

  1. Download the latest OVA (I downloaded the one with UEFI support).

  2. Extract the OVA and grab the VMDK file.

    tar xf photon-*.ova
    
@fardjad
fardjad / minikube-on-wsl2-with-podman.md
Last active Mar 14, 2021
[Minikube on WSL2 with Podman] Tips for running a local development Kubernetes cluster on WSL2 with Podman #wsl2 #minikube #podman #kubernetes #docker
View minikube-on-wsl2-with-podman.md