Skip to content

Instantly share code, notes, and snippets.

View dubrousky's full-sized avatar

Aliaksandr Dubrouski dubrousky

View GitHub Profile
@dubrousky
dubrousky / irq_balance_habrahabr.sh
Last active August 29, 2015 14:27 — forked from pavel-odintsov/irq_balance_habrahabr.sh
irq_balance_habrahabr.sh
#!/bin/bash
# from http://habrahabr.ru/post/108240/
ncpus=`grep -ciw ^processor /proc/cpuinfo`
test "$ncpus" -gt 1 || exit 1
n=0
for irq in `cat /proc/interrupts | grep eth | awk '{print $1}' | sed s/\://g`
do
f="/proc/irq/$irq/smp_affinity"
@dubrousky
dubrousky / BoundedMailboxDirectConsumer.scala
Created November 1, 2016 01:38 — forked from krasserm/BoundedMailboxDirectConsumer.scala
Akka consumer actors best practices
class BoundedMailboxDirectConsumer extends Actor with Consumer {
import akka.dispatch._
import akka.util.duration._
// Create a bounded mailbox for this consumer actor with a capacity of 10
self.dispatcher = Dispatchers.newThreadBasedDispatcher(self, 5, 100.milliseconds)
// instruct how the route should be customized during route creation (definition)
onRouteDefinition { rd: RouteDefinition =>
// on exception attempt max 3 redeliveries with a delay of 1000 ms
@dubrousky
dubrousky / example.py
Created November 22, 2016 09:30 — forked from AlexPutin/example.py
World of Tanks remote REPL console for interactive debugging
from mods.remote import create_terminal
from gui import SystemMessages
def add_info(text):
SystemMessages.pushMessage(text, type=SystemMessages.SM_TYPE.Information)
def add_warning(text):
SystemMessages.pushMessage(text, type=SystemMessages.SM_TYPE.Warning)
@dubrousky
dubrousky / gist:fd832c9506009fe2e813adb178706106
Created December 7, 2016 11:42 — forked from carlspring/gist:6762356
TeamCity REST API Commands
@dubrousky
dubrousky / dtrace-on-rust
Created July 8, 2019 16:06 — forked from bcantrill/dtrace-on-rust
DTrace on Rust. This shows running dtrace(1M) on a simple Rust program. Rust is running in a 64-bit LX-branded zone on SmartOS, an illumos derivative. Running stock (alpha) Rust and latest SmartOS.
root@1eec2cd3-2cba-e416-e1b6-845b715b736c:~# uname -a
Linux 1eec2cd3-2cba-e416-e1b6-845b715b736c 3.13.0 BrandZ virtual linux x86_64 x86_64 x86_64 GNU/Linux
root@1eec2cd3-2cba-e416-e1b6-845b715b736c:~# rustc -Vv
rustc 1.0.0-nightly (44a287e6e 2015-01-08 17:03:40 -0800)
binary: rustc
commit-hash: 44a287e6eb22ec3c2a687fc156813577464017f7
commit-date: 2015-01-08 17:03:40 -0800
host: x86_64-unknown-linux-gnu
release: 1.0.0-nightly
root@1eec2cd3-2cba-e416-e1b6-845b715b736c:~# cat hello.rs
@dubrousky
dubrousky / svn-pristine-find.sh
Created October 4, 2019 16:48 — forked from mcbrwr/svn-pristine-find.sh
fix for "svn pristine text not present" error in a working copy
#!/bin/bash
# for an "svn pristine text not present" error like this:
# svn: E155010: Pristine text 'd6612ee6af5d9fb4459cbe7e2e8e18f7fb4201f8' not present
# you can delete the file and retrieve it with svn up
# (if you have local modifications, make up your own plan)
# -
# Run this script from the root of the working copy.
# It retrieves the file that's causing the error from wc.db
# usage example : ./svn-pristine-find.sh d6612ee6af5d9fb4459cbe7e2e8e18f7fb4201f8
@dubrousky
dubrousky / CentOS-Docker
Created September 10, 2020 10:25 — forked from silveraid/CentOS-Docker
Creating minimal CentOS docker image from scratch
# Create a folder for our new root structure
$ export centos_root='/centos_image/rootfs'
$ mkdir -p $centos_root
# initialize rpm database
$ rpm --root $centos_root --initdb
# download and install the centos-release package, it contains our repository sources
$ yum reinstall --downloadonly --downloaddir . centos-release
$ rpm --root $centos_root -ivh centos-release*.rpm
$ rpm --root $centos_root --import $centos_root/etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
# install yum without docs and install only the english language files during the process
@dubrousky
dubrousky / di-in-fp.md
Created March 24, 2021 08:53 — forked from gvolpe/di-in-fp.md
Dependency Injection in Functional Programming

Dependency Injection in Functional Programming

There exist several DI frameworks / libraries in the Scala ecosystem. But the more functional code you write the more you'll realize there's no need to use any of them.

A few of the most claimed benefits are the following:

  • Dependency Injection.
  • Life cycle management.
  • Dependency graph rewriting.