Skip to content

Instantly share code, notes, and snippets.

Maroun Maroun MarounMaroun

Block or report user

Report or block MarounMaroun

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
MarounMaroun /
Created Sep 4, 2019
Get RabbitMQ queues consumers
import requests
import json
uri = 'http://localhost:15677/api/queues'
res = json.loads(requests.get(uri, auth=('username', 'password')).content)
for i in res:
print('{:<40}: {} {}'.format(i.get('name'), i.get('state'), i.get('consumers')))
MarounMaroun /
Created Aug 17, 2019
Git 2.23.0 installation
curl -O
tar -xvf git-2.23.0.tar.gz
cd git-2.23.0/
make && make install
cp git /usr/local/bin/git
View gist:aa0eab5e975081df1601d27a87180a69
"contexts": {
"application-1": {
"beans": {
"spring.transaction-org.springframework.boot.autoconfigure.transaction.TransactionProperties": {
"prefix": "spring.transaction",
"properties": {}
"management.trace.http-org.springframework.boot.actuate.autoconfigure.trace.http.HttpTraceProperties": {
"prefix": "management.trace.http",
MarounMaroun /
Created Mar 23, 2019
Spring 2.x Redis configurations
import java.time.Duration;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cache.CacheManager;
import org.springframework.cache.annotation.CachingConfigurerSupport;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.cache.concurrent.ConcurrentMapCacheManager;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
MarounMaroun /
Last active Jun 26, 2018
Add branch name to commit message githook
mkdir -p ~/.git_hooks
# make it executable
chmod a+x ~/.git_hooks/commit-msg
# ---------------------------
# vi ~/.git_hooks/commit-msg:
NAME=$(git branch | grep '*' | sed 's/* //')
DESCRIPTION=$(git config branch."$NAME".description)
echo "$NAME"': '$(cat "$1") > "$1"
read -p "What version you want to install? " version
brew install mongo@$version
brew install mongod
sudo mkdir -p /data/db
sudo chmod -R go+w /data/db
echo "Done! Run \"mongod\" to start the database"
MarounMaroun / ByNameValue.scala
Created Dec 28, 2017
Call by name VS call by value in Scala
View ByNameValue.scala
// defining a simple function that returns the current time
def getTime = System.currentTimeMillis
// defining a function, by NAME, that prints two times: now and one second later
def getTimeByName(f: => Long) = { println(f); Thread.sleep(1000); println(f)}
// defining it again, but this time, by VALUE
def getTimeByValue(f: Long) = { println(f); Thread.sleep(1000); println(f)}
MarounMaroun /
Last active Dec 18, 2017
AWS instance types extractor
from lxml import etree
import urllib
web = urllib.urlopen("")
s =
html = etree.HTML(s)
tr_nodes = html.xpath('//*[@id="aws-page-content"]/div/div/main/section/div[2]/div[43]/div/table/tbody/tr')
MarounMaroun /
Created Nov 25, 2017
Clone all of your public repositories
repos=$(curl -s{USER}/repos?per_page=1000 | grep -oP "(?<=clone_url\": \").*(?=\")")
echo "$repos" | while read line ; do
git clone $line
MarounMaroun / strict_vs_lazy.scala
Created Nov 22, 2017
Strict VS Lazy evaluation in Scala
View strict_vs_lazy.scala
* Assume we are interested in finding the first two even numbers in a very big file.
* Since we love functional programming, we don't want to use the traditional for loops.
* Instead, we want to apply a series of function to get the desired output.
// for the sake of the example, I assume the input is found in a list, not a file
var l = List(1, 47, 38, 53, 51, 67, 39, 46, 93, 54, 45, 33, 87, 96, 100, 4, 84, 17, 31, 81, 88, 35, 36)
// we don't really need toList here, but since we're assuming the data is coming from a file, I'll use it anyway
You can’t perform that action at this time.