Skip to content

Instantly share code, notes, and snippets.

View gdakram's full-sized avatar
😺

Shahrier Akram gdakram

😺
  • Slytrunk
  • Pacifica, CA
View GitHub Profile
import numpy as np
def ecdf(data):
n = len(data)
x = np.sort(data)
y = np.true_divide(np.arange(1, n+1), n)
return x, y
@gdakram
gdakram / poeditor-download.py
Last active October 20, 2017 22:02
Poeditor Python Curl Wrapper Scripts
import sys
import subprocess
from optparse import OptionParser
import json
parser = OptionParser()
parser.add_option("-l", "--language", dest="language", help="The language file to download.")
parser.add_option("-t", "--api-token", dest="api_token", help="poeditor api token.")
parser.add_option("-i", "--project-id", dest="project_id", help="poeditor project id.")
(options, args) = parser.parse_args()
# Try to tap the screen until view open on screen
# x:: starting x value
# y:: starting y value
# x_delta:: Value to change in x direction
# y_delta:: Value to change in y direction
# query:: query to wait for the view
# number_of_tries:: number of tries
def touch_element_by_moving(x, y, x_delta, y_delta, query, number_of_tries=5)
i = 0
begin
@gdakram
gdakram / yoda.java
Created May 23, 2014 06:44
media player with surface view example that scales with cropping
final SurfaceView sv = (SurfaceView) findViewById(R.id.splash_surface);
MediaPlayer mp = new MediaPlayer();
mp.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
@Override
public void onPrepared(MediaPlayer mp) {
mp.setVideoScalingMode(MediaPlayer.VIDEO_SCALING_MODE_SCALE_TO_FIT_WITH_CROPPING);
mp.setDisplay(sv.getHolder());
mp.start();
@gdakram
gdakram / elasticsearch.repo
Last active August 29, 2015 13:56
CentOS (64bit) - ElasticSearch Installation
[elasticsearch-1.0]
name=Elasticsearch repository for 1.0.x packages
baseurl=http://packages.elasticsearch.org/elasticsearch/1.0/centos
gpgcheck=1
gpgkey=http://packages.elasticsearch.org/GPG-KEY-elasticsearch
enabled=1
@gdakram
gdakram / install-rabbitmq.sh
Created February 12, 2014 18:32
CentOS - RabbitMQ Installation
# Install rabbitmq
wget -O /etc/yum.repos.d/epel-erlang.repo http://repos.fedorapeople.org/repos/peter/erlang/epel-erlang.repo
yum install erlang
rpm --import http://www.rabbitmq.com/rabbitmq-signing-key-public.asc
rpm -Uvh http://www.rabbitmq.com/releases/rabbitmq-server/v3.2.3/rabbitmq-server-3.2.3-1.noarch.rpm
@gdakram
gdakram / install-rabbitmq.sh
Created February 11, 2014 20:51
Debian - RabbitMQ Installtion
# as root
echo -e "\ndeb http://www.rabbitmq.com/debian/ testing main" >> /etc/apt/sources.list
wget http://www.rabbitmq.com/rabbitmq-signing-key-public.asc
apt-key add rabbitmq-signing-key-public.asc
apt-get update
@gdakram
gdakram / install-elastic-search.sh
Created February 11, 2014 19:55
Debian - Install ElasticSearch
VERSION=0.90.1
sudo apt-get update
sudo apt-get install openjdk-6-jdk
wget https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-$VERSION.deb
sudo dpkg -i elasticsearch-$VERSION.deb
# be sure you add "action.disable_delete_all_indices" : true to the config!!
@gdakram
gdakram / uri_count.rb
Created November 25, 2013 03:10
Poor man's unique URI count parsing apache access log with referrers.
require 'optparse'
require 'ostruct'
require 'pp'
# Default settings
options = OpenStruct.new :file => '', :from => nil, :to => nil, :include_referrer => false
OptionParser.new do |opts|
opts.banner = """
# Author: Pieter Noordhuis
# Description: Simple demo to showcase Redis PubSub with EventMachine
#
# Update 7 Oct 2010:
# - This example does *not* appear to work with Chrome >=6.0. Apparently,
# the WebSocket protocol implementation in the cramp gem does not work
# well with Chrome's (newer) WebSocket implementation.
#
# Requirements:
# - rubygems: eventmachine, thin, cramp, sinatra, yajl-ruby