Skip to content

Instantly share code, notes, and snippets.

@fardjad
fardjad / bitmeter.service
Last active February 7, 2019 22:17
[bitmeter.service] Modified "/usr/lib/systemd/system/bitmeter.service" file for ArchLinux #archlinux #systemd #bitmeter
[Unit]
Description=Packet Capture Service for BitMeter-OS
Requires=network-online.target
ConditionPathExists=/var/lib/bitmeter/bitmeter.db
After=syslog-ng.target network-online.target
[Service]
ExecStart=/usr/bin/bmcapture
Type=idle
StandardError=syslog
@fardjad
fardjad / ms-aio-media-keyboard-workaround.ahk
Last active February 7, 2019 22:19
[ms-aio-media-keyboard-workaround.ahk] Microsoft AIO Media Keyboard missing keys workaround #autohotkey #windows
/*
* Copyright (c) 2015 Fardjad Davari
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
* deal in the Software without restriction, including without limitation the
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
@fardjad
fardjad / linux-3.10.21-qemu.config
Last active February 7, 2019 22:22
[linux-3.10.21-qemu.config] Linux/arm 3.10.21 Kernel Configuration for QEMU. Apply https://gist.github.com/fardjad/7771673 before using this config. #kernel #arm #linux #qemu #raspberrypi
#
# Linux/arm 3.10.21 Kernel Configuration
#
CONFIG_ARM=y
CONFIG_MIGHT_HAVE_PCI=y
CONFIG_SYS_SUPPORTS_APM_EMULATION=y
CONFIG_HAVE_PROC_CPU=y
CONFIG_STACKTRACE_SUPPORT=y
CONFIG_HAVE_LATENCYTOP_SUPPORT=y
CONFIG_LOCKDEP_SUPPORT=y
@fardjad
fardjad / kernel-3.10.21-armv6-qemu.patch
Last active February 7, 2019 22:23
[kernel-3.10.21-armv6-qemu.patch] Kernel 3.10.21-armv6 Patch for QEMU #kernel #arm #linux #qemu #raspberrypi
Make the "Arm Versatile" board even more versatile, for QEMU, which can
stick weird processors into things that were never meant to receive them.
Based on: http://unicorn.drogon.net/rpi/linux-arm.patch
--- a/arch/arm/mm/Kconfig
+++ b/arch/arm/mm/Kconfig
@@ -71,7 +71,7 @@ config CPU_ARM9TDMI
# ARM920T
config CPU_ARM920T
@fardjad
fardjad / iterm2-keybindings-for-better-navigation.md
Last active February 7, 2019 22:24
[iTerm2 key bindings for better navigation] #iterm2 #macos

⌘→: 0x05

⌘←: 0x01

⌘←Delete: 0x15

⌥→: ^[f

⌥←: ^[b

@fardjad
fardjad / .!php-sample-with-grunt-composer-phpunit-and-continuos-testing
Last active February 8, 2019 09:12
[PHP sample with Grunt, Composer, PHPUnit, and continuos testing] #php #grunt #composer #phpunit
@fardjad
fardjad / find-binary-files-in-git-repo.sh
Created February 8, 2019 10:38
[find-binary-files-in-git-repo.sh] Find binary files in a git repo #git #bash
#!/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 February 18, 2019 12:42
[low-level-async-buffered-read.js] Low-level async buffered read from file with Node.js #nodejs #async #file
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-use-an-insecure-local-docker-registry-with-minikube.md
Last active August 1, 2019 05:18
[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

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 August 28, 2019 17:31
[How to run PhotonOS 3+ on VirtualBox] #virtualbox #photonos

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