Skip to content

Instantly share code, notes, and snippets.

View thehoneymad's full-sized avatar
🎯
Focusing

Swagata Prateek thehoneymad

🎯
Focusing
  • AWS
  • Vancouver
  • 10:41 (UTC -08:00)
View GitHub Profile
@thehoneymad
thehoneymad / SecureCallAttribute.cs
Created August 14, 2015 10:28
Custom Authorization Attribute on Asp.net web api 2.2
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;
using System.Net.Http;
using System.Threading.Tasks;
using System.Web.Http.Controllers;
using System.Web.Http;
@thehoneymad
thehoneymad / sample_request.py
Created May 18, 2016 05:24
Sample request towards thor for VTS report submission
import requests
import json
url = 'http://thor.gobd.co/vts/ping'
payload = {
'provider' : 'finder',
'data' : [
{
'status' : 'A',
'number' : '123456',
<?xml version="1.0" encoding="utf-8"?>
<entry xmlns="http://www.w3.org/2005/Atom">
<title type="text">:bbD</title>
<link rel="self" type="application/atom+xml;type=entry" href="http://localhost:8177/dataelements/6970" />
<link rel="alternate" type="application/vnd.vizrt.payload+xml" href="http://localhost:8177/dataelements/6970/payload" />
<link rel="template" type="application/atom+xml;type=entry" href="http://localhost:8177/templates/13781" />
<link rel="thumbnailfeed" type="application/atom+xml;type=feed" href="http://localhost:8177/dataelements/6970/thumbnails" />
<content type="application/vnd.vizrt.payload+xml">
<payload model="http://localhost:8177/templates/13781/model" xmlns="http://www.vizrt.com/types">
<field name="-concept-variant-choice">
@thehoneymad
thehoneymad / Program.cs
Created June 5, 2016 10:07
GreedyKnapsackTest.cs
using System;
using System.Collections.Generic;
using System.Linq;
namespace GreedyKnapsack
{
class Program
{
static void Main(string[] args)
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Mime;
using System.Text;
using System.Threading.Tasks;
namespace StackOverflow
{
public interface A { };
@thehoneymad
thehoneymad / HttpClientSample.cs
Created September 11, 2016 13:41
HttpClient Sample on posting data.
using Newtonsoft.Json;
using System.Collections.Generic;
using System.Net.Http;
using System.Threading.Tasks;
public class Program
{
public static void Main()
{
var task = Login();
@thehoneymad
thehoneymad / MedianOfTwoArrays.py
Created November 4, 2016 11:35
Get median of two sorted same sized array
# Im trying with same sized array here
array1 = [10,11,12,18,20]
array2 = [2,5,8,15,19]
def GetMedianOfTwoArrays(array1, array2, a1Start, a1End, a2Start, a2End):
# Find medians from the two arrays
m1 = (a1Start + a1End) / 2
m2 = (a2Start + a2End) / 2
using System.Collections;
using System.Collections.Generic;
using System.Linq;
namespace MergeIntervals
{
class Program
{
public static IList<Interval> Merge(IList<Interval> intervals)
{
/**
* Definition for an interval.
* public class Interval {
* public int start;
* public int end;
* public Interval() { start = 0; end = 0; }
* public Interval(int s, int e) { start = s; end = e; }
* }
*/
public class Solution {
/**
* Definition for an interval.
* public class Interval {
* public int start;
* public int end;
* public Interval() { start = 0; end = 0; }
* public Interval(int s, int e) { start = s; end = e; }
* }
*/
public class Solution {