Skip to content

Instantly share code, notes, and snippets.

Reda NOUSHI noushi

  • EDC4IT
  • EMEA Literally
Block or report user

Report or block noushi

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View check_all_docker_containers
#!/bin/bash
check_ghost=https://gist.githubusercontent.com/noushi/f50468678a581023a8e2/raw/86f299e33958a13baaca7d2d2705184f973ea49a/check_ghost
for dock in `docker ps | awk '{print $2;}' | tail -n +2 ` ; do
echo -n -e "$dock\t=>\t" ; curl -s $check_ghost | docker run -i $dock bash
done
View 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
View 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.

View gist:3a58179f733286f820a1

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 Nov 5, 2017 — forked from yuanying/vagrant-kvm.md
How to use vagrant-kvm
View vagrant-kvm.md

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 Nov 9, 2017 — forked from congto/vagrant-kvm.md
How to use vagrant-kvm
View vagrant-kvm.md

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 Apr 26, 2018 — forked from jeremypruitt/gist:ca62a5cdc95f579713b9
Modified ansible windows remoting script
View gist:3dddf23debfe4ed672bd11d79d61c214
# 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 / ansible-summary.md
Created May 16, 2018 — forked from andreicristianpetcu/ansible-summary.md
This is an ANSIBLE Cheat Sheet from Jon Warbrick
View ansible-summary.md

An Ansible summary

Jon Warbrick, July 2014, V3.2 (for Ansible 1.7)

Configuration file

intro_configuration.html

First one found from of

@noushi
noushi / sysctl.conf
Created Nov 8, 2018 — forked from voluntas/sysctl.conf
Sysctl configuration for high performance
View sysctl.conf
### 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
View memcached_operator.go
package memcached
import (
"context"
"reflect"
cachev1alpha1 "github.com/example-inc/memcached-operator/pkg/apis/cache/v1alpha1"
appsv1 "k8s.io/api/apps/v1"
You can’t perform that action at this time.