Skip to content

Instantly share code, notes, and snippets.

View sahidursuman's full-sized avatar

Sahidur Rahman Suman sahidursuman

View GitHub Profile
@sahidursuman
sahidursuman / digital_ocean_setup.md
Created October 17, 2018 12:16 — forked from ChuckJHardy/digital_ocean_setup.md
DigitalOcean Ubuntu 14.04 x64 + Rails 4 + Nginx + Unicorn + PostgreSQL + Capistrano 3 Setup Instructions
# A module which is an instance of the Script class encapsulates in its scope
# the top-level methods, top-level constants, and instance variables defined in
# a ruby script file (and its subfiles) loaded by a ruby program. This allows
# use of script files to define objects that can be loaded into a program in
# much the same way that objects can be loaded from YAML or Marshal files.
#
# See intro.txt[link:files/intro_txt.html] for an overview.
class Script < Module
# The file with which the Script was instantiated.
@sahidursuman
sahidursuman / bootstrap_user.rb
Created October 12, 2018 15:37 — forked from glebm/bootstrap_user.rb
Capistrano recipe to create a user on EC2
set :aws_private_key_path, "~/.ec2/mrkey.pem"
namespace :setup_server do
desc "adds a user and uploads his id_rsa.pub to the EC2 instance's deploy users authorized_keys2 file"
task :create_deploy_user do
# \\n becomes \n
commands = <<-SH.split("\n").map(&:strip).join(";")
sudo echo hi
sudo groupadd admin
@sahidursuman
sahidursuman / setup_load_paths.rb
Created October 12, 2018 15:37 — forked from glebm/setup_load_paths.rb
Sets up load paths for RVM to be used with Passenger
if ENV['MY_RUBY_HOME'] && ENV['MY_RUBY_HOME'].include?('rvm')
begin
rvm_path = File.dirname(File.dirname(ENV['MY_RUBY_HOME']))
rvm_lib_path = File.join(rvm_path, 'lib')
$LOAD_PATH.unshift rvm_lib_path
require 'rvm'
RVM.use_from_path! File.dirname(File.dirname(__FILE__))
rescue LoadError
# RVM is unavailable at this point.
raise "RVM ruby lib is currently unavailable."
@sahidursuman
sahidursuman / unicorn
Created October 12, 2018 15:36 — forked from glebm/unicorn
Unicorn /etc/init.d script for use with bundler
#!/bin/sh
#
# init.d script for single or multiple unicorn installations. Expects at least one .conf
# file in /etc/unicorn
#
# Modified by [email protected] http://github.com/jaygooby
# based on http://gist.github.com/308216 by http://github.com/mguterl
# Updated by glebm for newer unicorn and to use with bundle exec
#
## A sample /etc/unicorn/my_app.conf
@sahidursuman
sahidursuman / url_subdomain.rb
Created October 12, 2018 15:36 — forked from glebm/url_subdomain.rb
Get subdomains working in tests (scary)
# -*- encoding : utf-8 -*-
module UrlSubdomain
def subdomain!(sub = 'account')
# Some day this hack won't be necessary
# (when Capybara, Rspec, and Rails learn to work together)
# For now it only works if we run it twice
# I do not know why, and it would be a waste of time to find out
2.times do
sub = 'account' if sub.blank?
host = "#{sub}.#{DOMAIN}"
#!/usr/bin/env ruby
# coding: utf-8
require 'net/http'
require 'json'
# a simple wrapper to do an HTTPS GET
def fetch_uri(url)
STDERR.puts "GET #{url}" if ENV['VERBOSE']
uri = URI(url)
#!/usr/bin/env ruby
require 'base64'
require 'open-uri'
# file or url
def get_css(src)
if src.start_with? 'http'
src = src.gsub('|', '%7C')
STDERR.puts "# GET #{src}"
# simulate modern browser to get woff
@sahidursuman
sahidursuman / README.md
Created October 12, 2018 15:36 — forked from glebm/README.md
Universal Rails async onPageLoad script (Turbolink v2, v5.0, v5.1, jquery-turbolinks, and no Turbolinks)

This lets you load application JavaScript asynchronously from <head>. Compatible with Turbolink v2, v5.0, v5.1, jquery-turbolinks, and no Turbolinks. Compatible with all browsers and IE9+ (only IE10+ will actually benefit from this though).

How to use this:

  1. Add the HTML snippet just before the closing </body> tag.

  2. Add the on_page_load.js script to the beginning of your application.js, and use window.App.onPageLoad(...) instead of document.addEventListener('DOMContentLoaded', ...) and jQuery(($) -> ...) everywhere.

  3. Include your JavaScript like so:

    <head>
from jira import JIRA
import pandas as pd
import pdb
from collections import defaultdict
import datetime
import pprint
class ImportJiraAnalyticsData: