Skip to content

Instantly share code, notes, and snippets.

Panshul Gupta panshul007

Block or report user

Report or block panshul007

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@panshul007
panshul007 / benchmark_results.sh
Last active Jun 11, 2019
concurrent merge sort
View benchmark_results.sh
goos: darwin
goarch: amd64
pkg: puzzles-golang/algos/mergesort
BenchmarkConcurrentMergeSort_20-12 100000 15146 ns/op
BenchmarkConcurrentMergeSort_50-12 50000 32069 ns/op
BenchmarkConcurrentMergeSort_80-12 30000 49633 ns/op
BenchmarkConcurrentMergeSort_200-12 10000 104311 ns/op
BenchmarkConcurrentMergeSort_500-12 10000 221560 ns/op
BenchmarkConcurrentMergeSort_5000-12 500 2779299 ns/op
BenchmarkConcurrentMergeSort_100000-12 20 57669829 ns/op
@panshul007
panshul007 / bash-executor.go
Created Feb 15, 2019
bash-executor using github.com/go-cmd
View bash-executor.go
package services
import (
"fmt"
"github.com/go-cmd/cmd"
"github.com/golang/glog"
"time"
)
type BashExecutor struct {
@panshul007
panshul007 / JavaMapAdapter.java
Created Sep 18, 2018
Parsing Map<K,V> to and from JSON
View JavaMapAdapter.java
import _.model.MapEntry;
import _.model.MapType;
import javax.xml.bind.annotation.adapters.XmlAdapter;
import java.util.HashMap;
import java.util.Map;
public class JavaMapAdapter<K,V> extends XmlAdapter<MapType<K,V>, Map<K, V>> {
@panshul007
panshul007 / pom.go
Created Apr 11, 2018
Generate an xml file, write to file and load it from file.
View pom.go
package models
import (
"encoding/xml"
"errors"
"io/ioutil"
"os"
"gopkg.in/resty.v1"
"crypto/tls"
"encoding/json"
@panshul007
panshul007 / promises.js
Created Aug 10, 2016
Concept of nested promises
View promises.js
function getLocation() {
return new Promise(function (resolve, reject) {
resolve('Lucknow');
});
}
function getWeather(location) {
return new Promise(function (resolve, reject) {
resolve('It\'s 39 degrees in ' + location);
});
@panshul007
panshul007 / displayMatchingArrayElements.js
Last active Aug 29, 2015
Display documents with array elements - matching the given condition in the array elements - gives back only the matching array elements
View displayMatchingArrayElements.js
db.gSearchParseResultBundle.find({"units.displayedUrl":"www.toptarif.de/gasvergleich"},{_id:0, units:{$elemMatch:{"displayedUrl" : "www.toptarif.de/gasvergleich"}}});
@panshul007
panshul007 / downloadFileIOUtils.java
Created Aug 7, 2014
Download a web resource using apache commons #java
View downloadFileIOUtils.java
private byte[] downloadObject(String srcUrl) throws IOException
{
URL url = new URL(srcUrl);
InputStream in = new BufferedInputStream(url.openStream());
return IOUtils.toByteArray(in);
}
@panshul007
panshul007 / scp_commands.sh
Created Aug 1, 2014
SCP Commands #linux_commands
View scp_commands.sh
Copy Jars to remote locations
#!/bin/bash
nodes="192.168.2.70 192.168.2.71 192.168.2.72 192.168.2.73 192.168.2.74 192.168.2.75"
for node in $nodes
do
echo deploy node: $node
ssh -o StrictHostKeyChecking=no user@$node 'mkdir /home/user/vrnet &'
@panshul007
panshul007 / SimpleImageConverter.java
Created Aug 1, 2014
Convert java.awt.Image to byte array #java #images
View SimpleImageConverter.java
import java.awt.image.BufferedImage;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;
import com.sun.org.apache.xerces.internal.impl.dv.util.Base64;
public class SimpleConvertImage {
You can’t perform that action at this time.