Skip to content

Instantly share code, notes, and snippets.

View noushi's full-sized avatar

Reda NOUSHI noushi

  • EDC4IT
  • EMEA Literally
View GitHub Profile
@noushi
noushi / ebs_stats.py
Last active August 29, 2015 14:15 — forked from beaufour/ebs_stats.py
#!/usr/bin/python
#
# Get Cloudwatch metrics for the EBS volumes attached to an instance
#
import datetime
import logging
import sys
import urllib
@noushi
noushi / introrx.md
Last active August 29, 2015 14:16 — forked from staltz/introrx.md

The introduction to Reactive Programming you've been missing

(by @andrestaltz)

So you're curious in learning this new thing called Reactive Programming, particularly its variant comprising of Rx, Bacon.js, RAC, and others.

Learning it is hard, even harder by the lack of good material. When I started, I tried looking for tutorials. I found only a handful of practical guides, but they just scratched the surface and never tackled the challenge of building the whole architecture around it. Library documentations often don't help when you're trying to understand some function. I mean, honestly, look at this:

Rx.Observable.prototype.flatMapLatest(selector, [thisArg])

Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.

This all applies to Ruby 2.1. In some cases a setting is not available in 2.0, this is noted. There is also a different with 1.9, 1.8, and REE --- these are not noted.

All the relevant code is in https://github.com/ruby/ruby/blob/trunk/gc.c

RUBY_HEAP_MIN_SLOTS

default: 10000

The number of heap slots to start out with. This should be set high enough so that your app has enough or almost enough memory after loading so that it doesn't have to allocate more memory on the first request (althogh this probably isn't such a big deal for most apps).

(todo: figure out how big a slot is. i think the answer can be infered from this code.)

@noushi
noushi / vagrant-kvm.md
Created November 5, 2017 14:16 — forked from yuanying/vagrant-kvm.md
How to use vagrant-kvm

Install Vagrant

sudo su
apt-get update && apt-get install -y libvirt-dev ruby-all-dev apparmor-utils
curl -O -L https://dl.bintray.com/mitchellh/vagrant/vagrant_1.6.5_x86_64.deb
dpkg -i vagrant_1.6.5_x86_64.deb 
aa-complain /usr/lib/libvirt/virt-aa-helper # workaround
exit

Install vagrant-kvm as user

@noushi
noushi / vagrant-kvm.md
Created November 9, 2017 19:51 — forked from congto/vagrant-kvm.md
How to use vagrant-kvm

Install Vagrant

sudo su
apt-get update && apt-get install -y libvirt-dev ruby-all-dev apparmor-utils
curl -O -L https://dl.bintray.com/mitchellh/vagrant/vagrant_1.6.5_x86_64.deb
dpkg -i vagrant_1.6.5_x86_64.deb 
aa-complain /usr/lib/libvirt/virt-aa-helper # workaround
exit

Install vagrant-kvm as user

@noushi
noushi / gist:3dddf23debfe4ed672bd11d79d61c214
Last active April 26, 2018 13:06 — forked from jeremypruitt/gist:ca62a5cdc95f579713b9
Modified ansible windows remoting script
# Configure a Windows host for remote management with Ansible
# -----------------------------------------------------------
#
# This script checks the current WinRM/PSRemoting configuration and makes the
# necessary changes to allow Ansible to connect, authenticate and execute
# PowerShell commands.
#
# Set $VerbosePreference = "Continue" before running the script in order to
# see the output messages.
#
@noushi
noushi / sysctl.conf
Created November 8, 2018 21:24 — forked from voluntas/sysctl.conf
Sysctl configuration for high performance
### KERNEL TUNING ###
# Increase size of file handles and inode cache
fs.file-max = 2097152
# Do less swapping
vm.swappiness = 10
vm.dirty_ratio = 60
vm.dirty_background_ratio = 2

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

Kerberos + Apache + SVN
=======================
I did this on Ubuntu server 10.10. Based on this: https://help.ubuntu.com/community/Kerberos
1) Make sure the server has appropriate DNS info, e.g.: (/etc/hosts)
10.0.1.147 draco.madebysofa.com
127.0.0.1 localhost ubuntu
@noushi
noushi / vm.sh
Created April 27, 2020 18:23 — forked from julian-klode/vm.sh
#!/bin/bash
[ -e $XDG_RUNTIME_DIR/OVMF_VARS.fd ] || cp /usr/share/OVMF/OVMF_VARS.ms.fd $XDG_RUNTIME_DIR/OVMF_VARS.fd
kvm -smp 2 \
-m 4096 \
-cpu host \
-M q35 \
-drive if=pflash,format=raw,readonly,file=/usr/share/OVMF/OVMF_CODE.fd \