Skip to content

Instantly share code, notes, and snippets.

Avatar

Devesh Khandelwal devkhan

View GitHub Profile
@devkhan
devkhan / mocha-before-and-beforeEach-lifecycles.js
Last active May 18, 2017 — forked from corywheeler/mocha-before-and-beforeEach-lifecycles.js
Show the order of execution of mocha's before and beforeEach hooks for each describe and each test
View mocha-before-and-beforeEach-lifecycles.js
describe('highest level describe', function () {
before(function() {
console.log('This is the highest level before')
})
beforeEach(function() {
console.log('This is the highest level beforeEach')
})
it('This is the first highest level test', function() {
console.log('first highest level test')
View FUtility.java
public class FUtility {
public FUtility() {}
public static boolean isEmpty(Object object) {
return object == null ? true : false;
}
public static boolean isNotEmpty(Object object) {
@devkhan
devkhan / keybase.md
Created Oct 25, 2016
Keybase GitHub Proof
View keybase.md

Keybase proof

I hereby claim:

To claim this, I am signing this object:

@devkhan
devkhan / CORS.xml
Last active Oct 21, 2016
AWS S3 Bucket Policy
View CORS.xml
<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<CORSRule>
<AllowedOrigin>*</AllowedOrigin>
<AllowedMethod>GET</AllowedMethod>
<MaxAgeSeconds>3000</MaxAgeSeconds>
<AllowedHeader>Authorization</AllowedHeader>
</CORSRule>
</CORSConfiguration>
@devkhan
devkhan / crawl.py
Created Sep 23, 2016
GitHub Email ID Crawler
View crawl.py
import os
from github import Github
from github.AuthenticatedUser import AuthenticatedUser
g = Github("devkhan-test", "4cf28f314249c77ea1a64a9a8938b19cf6313e31")
file = open('output/indian_users.csv', 'w')
all_users = open('output/all_users.txt', 'w')
@devkhan
devkhan / boundary_fill.py
Created Mar 8, 2016
Boundary Fill Algorithm
View boundary_fill.py
#!/usr/bin/python2.7
import pygame
import sys, time
import math
pygame.init()
pygame.display.set_caption("Scan line Algorithm")
sys.setrecursionlimit(1000000000)
screen = pygame.display.set_mode((800,600))
View cycling.cpp
#include <iostream>
#include <vector>
using namespace std;
int main(int argc, char const *argv[])
{
int n, m;
int **nm;
int *s, *q;
@devkhan
devkhan / C++11.sublime-build
Created Jul 22, 2015
Sublime Text C++11 Build System
View C++11.sublime-build
{
"shell_cmd": "g++ -std=c++11 \"${file}\" -o \"${file_path}/${file_base_name}\"",
"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
"working_dir": "${file_path}",
"selector": "source.c, source.c++",
"variants":
[
{
"name": "Run",
@devkhan
devkhan / test.java
Created Jun 12, 2015
This is a test class done as an assignment for as part of the tasks given by AppAmplify team to me.
View test.java
import java.io.*; // For Input-Output.
import java.security.MessageDigest; // For encryption.
import java.security.NoSuchAlgorithmException; // Algorithm Exception.
import java.util.Formatter; // Formatting generated key.
import java.util.Random; // Generating random appsflyerkey.
public class task
{
// appsflyerkey - private static member.
@devkhan
devkhan / data_import.sh
Created Mar 9, 2015
Script for automating insertion of data from large CSV files into a MySQL database.
View data_import.sh
#!/bin/bash
#### This script is for automating the insertion of data from large csv files into a myql database.
MAINDIR=csvs/
LINES=$1
insertsql()
{
#### Execute mysql command.