Skip to content

Instantly share code, notes, and snippets.

@GauthamBanasandra
GauthamBanasandra / build-release.cmd
Created February 14, 2024 07:58
Build Hadoop release
set MVN_ARGS="-Dshell-executable=C:\Git\bin\bash.exe -Dhttps.protocols=TLSv1.2 -Pnative-win -Drequire.openssl -Dopenssl.prefix=C:\vcpkg\installed\x64-windows -Dcmake.prefix.path=C:\vcpkg\installed\x64-windows -Dwindows.cmake.toolchain.file=C:\vcpkg\scripts\buildsystems\vcpkg.cmake -Dwindows.cmake.build.type=RelWithDebInfo -Dwindows.build.hdfspp.dll=off -Duse.platformToolsetVersion=v142 -Dwindows.no.sasl=on -DskipTests -DskipDocs -Drequire.test.libhadoop"
C:\Git\bin\bash.exe C:\h\dev-support\bin\create-release --mvnargs=%MVN_ARGS%
@GauthamBanasandra
GauthamBanasandra / Test the rods.cpp
Created March 11, 2019 16:16
Incorrect code highlight
#include <tuple>
#include <utility>
#include <vector>
#include <iostream>
#include <limits>
#include <cassert>
#include <ios>
namespace uva10086
{
@GauthamBanasandra
GauthamBanasandra / Sherlock and cost.cpp
Created February 14, 2019 14:33
Sherlock and cost
#include <vector>
#include <algorithm>
#include <iostream>
class CostEstimator
{
public:
explicit CostEstimator(const std::vector<int> &numbers) :numbers_(numbers) {}
int Estimate() const;
@GauthamBanasandra
GauthamBanasandra / print-headers-401.go
Last active December 18, 2018 10:11
A simple HTTP server in Golang which just prints all the headers
package main
import (
"net/http"
"fmt"
"time"
)
func handler(w http.ResponseWriter, r *http.Request) {
fmt.Printf("Request at %v\n", time.Now())
@GauthamBanasandra
GauthamBanasandra / input1.js
Created May 25, 2018 09:41
source map not getting applied
function OnUpdate(doc, meta) {
var bucket = '`beer-sample`',
city = 'Bangalore';
var res = new N1qlQuery(`SELECT * FROM system:bucket WHERE city == "city"`);
}
@GauthamBanasandra
GauthamBanasandra / doc-exists.go
Last active March 22, 2018 14:19
Check to see if document exists without retrieving its contents
package main
import (
"fmt"
"github.com/couchbase/gocb"
)
func lookupDoc(clusterAddress, bucketName, docId string) (exists bool, err error) {
exists = false
cluster, err := gocb.Connect(clusterAddress)
@GauthamBanasandra
GauthamBanasandra / throw-double-exception.cc
Last active February 27, 2018 09:26
Throw exception one after the other
void Bucket::BucketSet<v8::Local<v8::Name>>(
const v8::Local<v8::Name> &name, const v8::Local<v8::Value> &value_obj,
const v8::PropertyCallbackInfo<v8::Value> &info) {
auto isolate = info.GetIsolate();
if (name->IsSymbol()) {
auto js_exception = UnwrapData(isolate)->js_exception;
js_exception->Throw("Symbol data type is not supported");
++bucket_op_exception_count;
return;
}
@GauthamBanasandra
GauthamBanasandra / abv-track.js
Last active February 20, 2018 16:29
zipping a file in go
function OnUpdate(doc, meta) {
var abv = 2,
count = 0,
lim = 10;
var q = SELECT * FROM `beer-sample`
WHERE abv >: abv LIMIT: lim;
for (var row of q) {
var id = meta.id + (++count);
sample[id] = row;
}
@GauthamBanasandra
GauthamBanasandra / auth-bucket.cpp
Last active February 8, 2018 08:41
Trying out lcb dynamic auth
//
// main.cpp
// auth-change
//
// Created by Gautham Banasandra on 07/12/17.
// Copyright © 2017 Couchbase. All rights reserved.
//
#include <chrono>
#include <fstream>
@GauthamBanasandra
GauthamBanasandra / pos_params.cc
Created October 5, 2017 05:14
Positional parameters in libcouchbase SDK
//
// pos_param.cpp
// libcb
//
// Created by Gautham Banasandra on 04/10/17.
// Copyright © 2017 Couchbase. All rights reserved.
//
#include <iostream>
#include <string>