Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000
context 'performance' do | |
before do | |
require 'benchmark' | |
@posts = [] | |
@users = [] | |
8.times do |n| | |
user = Factory.create(:user) | |
@users << user | |
aspect = user.aspects.create(:name => 'people') | |
connect_users(@user, @aspect0, user, aspect) |
# post_loc.txt contains the json you want to post | |
# -p means to POST it | |
# -H adds an Auth header (could be Basic or Token) | |
# -T sets the Content-Type | |
# -c is concurrent clients | |
# -n is the number of requests to run in the test | |
ab -p post_loc.txt -T application/json -H 'Authorization: Token abcd1234' -c 10 -n 2000 http://example.com/api/v1/locations/ |
Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000
class DevelopmentProfiler | |
def self.prof(file_name) | |
RubyProf.start | |
yield | |
results = RubyProf.stop | |
# Print a flat profile to text | |
File.open "#{Rails.root}/tmp/performance/#{file_name}-graph.html", 'w' do |file| |
#!/usr/bin/env python | |
import threading, logging, time | |
from kafka import KafkaConsumer, KafkaProducer | |
class Producer(threading.Thread): | |
daemon = True | |
def run(self): |
from kafka import KafkaConsumer | |
consumer = KafkaConsumer(bootstrap_servers='localhost:9092', | |
auto_offset_reset='earliest') | |
while True: | |
requested_data = consumer.poll() | |
if len(requested_data) > 0: | |
print requested_data |
import pika | |
connection = pika.BlockingConnection(pika.ConnectionParameters(host='localhost')) | |
channel = connection.channel() | |
channel.queue_declare(queue='ad_accounts', durable=True) | |
def process_ad_accounts(ch, method, properties, body): | |
print(" [x] Received %r" % body) | |
print body | |
print(" [x] Done") |
In this article, I will share some of my experience on installing NVIDIA driver and CUDA on Linux OS. Here I mainly use Ubuntu as example. Comments for CentOS/Fedora are also provided as much as I can.