Skip to content

Instantly share code, notes, and snippets.

View karthik20522's full-sized avatar
👊

Karthik Srinivasan karthik20522

👊
View GitHub Profile
# Create application
mkdir dnsvc
cd dnsvc
dotnet new console
# Program.cs
using System;
using System.Threading;
namespace dnsvc
@karthik20522
karthik20522 / es_scan.js
Created August 17, 2019 20:18
es_scan.js
scanAndScroll: function(queryString, sourceFieldArray) {
var client = new $.es.Client({
hosts: 'http://search.es.io:9200'
});
var allRecords = [];
$("#exportProgressBarDiv").show();
client.search({
@karthik20522
karthik20522 / AkkaSampling.scala
Last active August 17, 2019 20:06
AkkaSampling
package akka.actor
import java.io.BufferedOutputStream
import java.io.FileOutputStream
import akka.dispatch._
import java.util.concurrent.ExecutorService
import scala.concurrent.forkjoin.ForkJoinPool
import java.io.{OutputStream, Writer, OutputStreamWriter}
import TraversalHelper._
import scala.collection.mutable.SortedSet
@karthik20522
karthik20522 / exif.js
Created August 17, 2019 19:43
exif xmp
function handleBinaryFile(binFile) {
var data = findEXIFinJPEG(binFile);
var iptcdata = findIPTCinJPEG(binFile);
var xmpdata= findXMPinJPEG(binFile); // add
img.exifdata = data || {};
img.iptcdata = iptcdata || {};
img.xmpdata = xmpdata || {}; //add
if (callback) {
callback.call(img);
}
@karthik20522
karthik20522 / xmp_exif_2.js
Created August 17, 2019 19:40
xmp_exif_2.js
function xml2Object(xml) {
try {
var obj = {};
if (xml.children.length > 0) {
for (var i = 0; i < xml.children.length; i++) {
var item = xml.children.item(i);
var attributes = item.attributes;
for(var idx in attributes) {
var itemAtt = attributes[idx];
var dataKey = itemAtt.nodeName;
@karthik20522
karthik20522 / xmp_exif.js
Created August 17, 2019 19:37
xmp_exif.js
function findXMPinJPEG(file) {
var dataView = new DataView(file);
if (debug) console.log("Got file of length " + file.byteLength);
if ((dataView.getUint8(0) != 0xFF) || (dataView.getUint8(1) != 0xD8)) {
if (debug) console.log("Not a valid JPEG");
return false; // not a valid jpeg
}
var offset = 2,
@karthik20522
karthik20522 / dockershipyard.sh
Last active August 17, 2019 19:28
Docker swarm shipyard
#!/bin/bash
set -e
function usage {
echo >&2 "Usage: $0 [ -n nodename ]"
exit 1
}
while getopts ":n:" FLAG; do
case $FLAG in
@karthik20522
karthik20522 / dockerfunctions.sh
Created August 17, 2019 19:23
docker functions
#!/bin/bash
function dock() {
# Point docker client and docker-machine to the given node
eval "$(docker-machine env --shell bash $@)"
}
# Remove all containers as well as clear out dangling images
function cleardock() {
docker rm -f $(docker ps -aq) 2> /dev/null
docker rmi $(docker images --filter "dangling=true" -q) 2> /dev/null
using System.Web.Optimization;
namespace ClipTheTripWeb {
public class BundleConfig {
public static void RegisterBundles(BundleCollection bundles) {
var homeBundleJs = new Bundle("~/content/js/home", new JsMinify());
homeBundleJs.Include(
"~/Content/Js/jquery.fullscreenr.js",
"~/Content/Js/jquery.autoSuggest.js",
"~/Content/Js/home.js"
public class Weather {
public string city;
public int curr_temp;
public string curr_text;
public int curr_icon;
public List < Forecast > forecast = new List < Forecast > ();
}
public class Forecast {
public string day_date;