Skip to content

Instantly share code, notes, and snippets.

View iRajul's full-sized avatar

Rajul iRajul

  • New Delhi
View GitHub Profile
@iRajul
iRajul / common.csv
Last active July 25, 2018 10:02
common
count word meaning rank cumulative_fraction
12218247 de from 1 0.03557
12131641 que what 2 0.07088
10444550 no do not 3 0.1013
8037570 a to 4 0.1247
7711865 la the 5 0.1471
6389567 el he 6 0.1657
6003821 y 7 0.1832
5897102 es 8 0.2004
5770082 en 9 0.2172
@iRajul
iRajul / memusg
Created May 25, 2018 15:51 — forked from netj/memusg
memusg -- Measure memory usage of processes
#!/usr/bin/env bash
# memusg -- Measure memory usage of processes
# Usage: memusg COMMAND [ARGS]...
#
# Author: Jaeho Shin <netj@sparcs.org>
# Created: 2010-08-16
############################################################################
# Copyright 2010 Jaeho Shin. #
# #
# Licensed under the Apache License, Version 2.0 (the "License"); #
@iRajul
iRajul / digitalocean-promo-code-february-march-april-2018.md
Last active April 16, 2018 15:31
Digital Ocean Promo Code for February / March / April / May 2018 [Updated]

Digital Ocean Promo Code for Spring 2018 February / March / April / May 2018

Save $25 for your Cloud Computing Solution with Digital Ocean.

How to get the Discount?

1.) Use this link to Sign Up and save your first $10.

2.) Enter the Promocode LOWENDBOX when you choose your payment method and get another $15 discount.

@iRajul
iRajul / latest-ffmpeg-centos6.sh
Last active April 1, 2018 07:40 — forked from mustafaturan/latest-ffmpeg-centos6.sh
Installs latest ffmpeg on Centos 6
# source: https://trac.ffmpeg.org/wiki/CentosCompilationGuide
yum install autoconf automake gcc gcc-c++ git libtool make nasm pkgconfig zlib-devel
mkdir ~/ffmpeg_sources
cd ~/ffmpeg_sources
curl -O http://www.tortall.net/projects/yasm/releases/yasm-1.2.0.tar.gz
tar xzvf yasm-1.2.0.tar.gz
cd yasm-1.2.0
@iRajul
iRajul / pyargs.md
Created March 24, 2018 13:47 — forked from dideler/pyargs.md
Parsing Command-Line Argument in Python

Command-line arguments in Python show up in sys.argv as a list of strings (so you'll need to import the sys module).

For example, if you want to print all passed command-line arguments:

import sys
print(sys.argv)  # Note the first argument is always the script filename.

Command-line options are sometimes passed by position (e.g. myprogram foo bar) and sometimes by using a "-name value" pair (e.g. myprogram -a foo -b bar).

Here's a simple way to parse command-line pair arguments. It scans the argv list looking for -optionname optionvalue word pairs and places them in a dictionary for easy retrieval. The code is heavily commented to help Python newcomers.

@iRajul
iRajul / gist:8e7b8bf29cfdff6d8122074ceb0d9958
Created June 17, 2017 09:59 — forked from tamoyal/gist:10441108
Create super user and database user in Mongo 2.6
# Create your superuser
$ mongo
> use admin
> db.createUser({user:"someadmin",pwd:"secret", roles:[{role:"root",db:"admin"}]})
> exit
# Alias for convenience (optional and at your own risk)
$ echo 'alias mongo="mongo --port 27017 -u someadmin -p secret --authenticationDatabase admin"' >> ~/.bash_profile
$ source ~/.bash_profile
@iRajul
iRajul / s3-curl-backups.md
Created June 1, 2017 16:25 — forked from jareware/s3-curl-backups.md
Simple, semi-anonymous backups with S3 and curl

⇐ back to the gist-blog at jrw.fi

Simple, semi-anonymous backups with S3 and curl

Backing stuff up is a bit of a hassle, to set up and to maintain. While full-blown backup suites such as duplicity or CrashPlan will do all kinds of clever things for you (and I'd recommend either for more complex setups), sometimes you just want to put that daily database dump somewhere off-site and be done with it. This is what I've done, with an Amazon S3 bucket and curl. Hold onto your hats, there's some Bucket Policy acrobatics ahead.

There's also a tl;dr at the very end if you just want the delicious copy-pasta.

Bucket setup

@iRajul
iRajul / EachDirectoryPath.md
Created March 16, 2017 16:02 — forked from granoeste/EachDirectoryPath.md
[Android] How to get the each directory path.

System directories

Method Result
Environment.getDataDirectory() /data
Environment.getDownloadCacheDirectory() /cache
Environment.getRootDirectory() /system

External storage directories

The method i am telling is quite Simple and requires Dynamic Programming and have time complexity O(n).
Your Sample Input:
n=10 , W = 3
10 3
1 -2 5 6 0 9 8 -1 2 0
Answer = 5 6 6 9 9 9 8 2
Concept: Dynamic Programming