Skip to content

Instantly share code, notes, and snippets.

View kahirul's full-sized avatar
🏠
Working from home

Khairul kahirul

🏠
Working from home
View GitHub Profile
@kahirul
kahirul / ceil_by_factor.rb
Created November 28, 2012 10:33
Custom ceiling
# Custom ceiling function
# Usage : If we want to ceil number by 50, it will ceil last two digit of the number into
# 0 -> 0
# (1..49) --> 50
# 50 --> 50
# (51..99) --> 100
# 123 --> 150
# Then use ceil_by_factor(number, 50)
# ceil_by_factor(123, 100) -> 200
#! /bin/sh
# Base on Gitlab. [email protected]
# GITLAB
# Maintainer: @randx
# Authors: [email protected], @randx
# App Version: 6.0
### BEGIN INIT INFO
@kahirul
kahirul / rvm-setup.md
Created September 25, 2014 10:11
Setup RVM
curl -sSL https://get.rvm.io | sudo bash -s stable
usermod -a -G rvm jerry
source /etc/profile.d/rvm.sh
@kahirul
kahirul / dashed-partial-name
Created December 18, 2014 05:18
Regex to find call for rendering partial with dash in file name, e.g. render "some-partial"
/render\s+["'a-z]+\/[a-z]+\-[a-z]+/i
@kahirul
kahirul / meow.sh
Last active August 29, 2015 14:13
Custom Presto Prompt
#
# A simple theme that displays relevant, contextual information.
#
# Authors:
# Sorin Ionescu <[email protected]>
#
# Screenshots:
# http://i.imgur.com/nBEEZ.png
#
@kahirul
kahirul / signup_location.rb
Last active October 9, 2015 05:20
Create Signup Location
def create_signup_location
glist = Gibbon::API.new.lists
list_ids = glist.list(filters: { list_name: 'register' })['data'].map {|m| m['id'] }
list_ids.each do |list_id|
payload = {
id: list_id,
tag: 'SIGNUP_LOC',
name: 'Signup Location',
options: {
@kahirul
kahirul / Dockerfile
Created August 15, 2016 09:01 — forked from yefim/Dockerrun.aws.json
Build a Docker image, push it to AWS EC2 Container Registry, then deploy it to AWS Elastic Beanstalk
# Example Dockerfile
FROM hello-world
@kahirul
kahirul / udemy_dl.py
Last active October 12, 2022 19:10
UdemyDL. Udemy downloader. Customize for UFB (Udemy For Bussiness). Fix csrf token handling
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Main script for udemy-dl."""
from __future__ import unicode_literals
from __future__ import print_function
from builtins import str
from builtins import input
import json
import re
@kahirul
kahirul / stopwords.rb
Created January 22, 2018 09:01
Sklearn EN Stopwords
stops = ["a", "about", "above", "across", "after", "afterwards", "again", "against", "all", "almost", "alone", "along", "already", "also", "although", "always", "am", "among", "amongst", "amoungst", "amount", "an", "and", "another", "any", "anyhow", "anyone", "anything", "anyway", "anywhere", "are", "around", "as", "at", "back", "be", "became", "because", "become", "becomes", "becoming", "been", "before", "beforehand", "behind", "being", "below", "beside", "besides", "between", "beyond", "bill", "both", "bottom", "but", "by", "call", "can", "cannot", "cant", "co", "con", "could", "couldnt", "cry", "de", "describe", "detail", "do", "done", "down", "due", "during", "each", "eg", "eight", "either", "eleven", "else", "elsewhere", "empty", "enough", "etc", "even", "ever", "every", "everyone", "everything", "everywhere", "except", "few", "fifteen", "fifty", "fill", "find", "fire", "first", "five", "for", "former", "formerly", "forty", "found", "four", "from", "front", "full", "further", "get", "give", "go", "had",
@kahirul
kahirul / postgres_queries_and_commands.sql
Created March 13, 2018 10:31 — forked from rgreenjr/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(query_start, clock_timestamp()), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(query_start, clock_timestamp()), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'