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()
@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
@gdakram
gdakram / skin_override_globally.html
Created September 14, 2012 18:01
Disable loader from fetching a skinnable module's assets from YUI's CDN, while on HTTPS.
<script>
var YUI_config = {
skin : {
overrides : {
"widget" : []
}
}
};
</script>
@gdakram
gdakram / yui-widget-structure.js
Created January 21, 2012 01:48 — forked from kara-ryli/yui-widget-structure.js
Basic YUI Widget Structure, commented up to work with yuidocs.
/* global YUI */
/**
* My Module's purpose
* @module my-module
* @requires base-build, widget
*/
YUI.add("my-module", function (Y) {
"use strict";
@gdakram
gdakram / gist:1300136
Created October 20, 2011 00:58
sports-in-motion-hack.js
javascript:(function(){
var images = document.getElementsByTagName("img");
var id_regex = new RegExp(/^thumb-img\d+/i);
var image_source_regex = new RegExp(/(.+?)t(.\w{3})$/);
var image_sources = [];
for (var i = 0; i < images.length; i++) {
if (id_regex.test(images[i].id) && image_source_regex.test(images[i].src)) {
image_source = RegExp.$1 + RegExp.$2;
image_sources.push(image_source);
}
@gdakram
gdakram / absolutize.js
Created July 28, 2011 15:15
Absolutize Image Src Paths for Images in Student Services Sites
// Fixing cascade resources
(function($){
// Fixing cascade resources
$.fn.absolutizePath = function(prefix, base_path) {
this.each(function() {
// No need to rewrite src or links if already inside ccp
if (/\/ccp\//.test(window.location.href)) {
return;
}
@gdakram
gdakram / carousel.html
Created July 6, 2011 16:52
cross-domain carousel rendering. source from the staging server.
@gdakram
gdakram / Rails 2 Environment
Created May 16, 2011 17:58 — forked from laserlemon/Rails 2 Environment
Snow Leopard -- RVM, Homebrew, Git, Imagemagick
# Installs on Snow Leopard.
# Homebrew
ruby -e "$(curl -fsS http://gist.github.com/raw/323731/install_homebrew.rb)"
echo 'export PATH=/usr/local/bin:/usr/local/sbin:$PATH' >> ~/.bash_profile
# Close Terminal window.
# Git
brew install git
brew update