Skip to content

Instantly share code, notes, and snippets.

@rakrup
rakrup / Recieve_Msg.py
Last active December 16, 2015 15:29
This is program analogous to any hello-world program we write in any other language. Send_Msg.py This python program works like a Producer. It sends a message on to RabbitMQ.It connects to the default Exchange and creates a queue called and then sends a message to the queue. Recieve_Msg,py This program shall consume the messages from the Hello_W…
#!/usr/bin/env python
import pika
import time
connection = pika.BlockingConnection(pika.ConnectionParameters(
host='localhost'))
channel = connection.channel()
channel.queue_declare(queue='Hello_World', durable=True)
print ' [*] Waiting for messages. To exit press CTRL+C'
@rakrup
rakrup / gist:179f3a285025eb0510a7ab24abee0fd3
Created September 19, 2017 14:14
Error Log while running machete tests for binary build packs
Rahuls-MacBook-Pro:binary-buildpack rakrup$ BUNDLE_GEMFILE=cf.Gemfile bundle exec buildpack-build
******* Using the stack 'cflinuxfs2' against the host 'local.pcfdev.io'
******* Fetching CF CLI details
/usr/local/bin/cf
cf version 6.29.1+d5129d651.2017-08-17
******* Building cached buildpack
Cached buildpack created and saved as /Users/rakrup/Code/cloudfoundry/binary-buildpack/binary_buildpack-cached-v1.0.14-1505830048.zip with a size of 64K
rakrup@Rahuls-MacBook-Pro:[~/Code/cloudfoundry/staticfile-buildpack]:$./scripts/integration.sh
+++ stat -f ./scripts
++ dirname ./scripts
+ export ROOT=.
+ ROOT=.
+ '[' '!' -f ./.bin/ginkgo ']'
+ '[' '!' -f ./.bin/buildpack-packager ']'
+ GINKGO_NODES=3
+ GINKGO_ATTEMPTS=2
+ cd ./src/staticfile/integration
#!/usr/bin/env python
# Usage
# compare_files.py. <file_to_compare_1> <file_to_compare_2>
# ALGO
# 1. Check if both the files have same md5 checksum
# 2. If the checksum is same - means files are exactly same ; no need to check line by line
# 3. If the checksum doesnt match; we load the contents fo file to string
# 4. replace all the blank spaces and new line char with nothing. Baiscally get all text in a string.
#!/usr/bin/env python
import sys
import json
import yaml
if sys.argv[2]=="yaml";
print yaml.dump(yaml.load(json.dumps(json.loads(open(sys.argv[1]).read()))), default_flow_style=False)
if sys.argv[2]=="json";
print json.dump(json.load(yaml.dumps(yaml.loads(open(sys.argv[1]).read()))), default_flow_style=False)