Skip to content

Instantly share code, notes, and snippets.

View narendrans's full-sized avatar

Naren narendrans

View GitHub Profile
@narendrans
narendrans / Program.cs
Last active January 7, 2024 15:35
Dremio C# example using flight sql odbc driver
using System;
using System.Data.Odbc;
class Program
{
static void Main()
{
string connectionString = "DRIVER={Arrow Flight SQL ODBC Driver};host=localhost;UID=dremio;PWD=dremio123;PORT=32010;UseEncryption=false;DisableHostVerification=1;DisableCertificateVerification=1;HandshakeTimeout=100;ROUTING_TAG=testing";
using (OdbcConnection connection = new OdbcConnection(connectionString))
{
@narendrans
narendrans / Main.java
Last active May 30, 2023 10:38
Dremio JDBC example
// Requires JDK 1.8
// Run it with:
// javac Main.java && java -cp .:dremio-jdbc-driver-20.0.0-202201050826310141-8cc7162b.jar Main
// If the output in terminal shows the following then the test is successful.
// Printing the result
// -------------------
// User: dremio
// -------------------
import java.sql.*;
@narendrans
narendrans / Dockerfile
Last active September 15, 2020 19:26
Superset with Dremio ODBC on Centos7 Docker image
FROM centos:7
RUN yum install -y python3 python3-devel python3-pip unixODBC unixODBC-devel python3-setuptools gcc gcc-c++ https://download.dremio.com/odbc-driver/dremio-odbc-LATEST.x86_64.rpm && \
pip3 install apache-superset sqlalchemy_dremio && \
export LC_ALL=en_US.UTF-8 && \
superset db upgrade && \
superset init && \
export FLASK_APP=superset && \
flask fab create-admin --username admin --firstname admin --lastname admin --email admin@admin --password admin
from pyarrow import flight
import base64,time,pandas
class HttpDremioClientAuthHandler(flight.ClientAuthHandler):
def __init__(self, username, password):
super().__init__()
self.username = bytes(username)
self.password = bytes(password)
self.token = None
{
"description": "my doc",
"foo": {
"bar": "baz",
"quux": "revlos",
"level1" : {
"l2string": "l2val",
"l2struct": {
"level3": "l3val"
}
[
{
"_id": "5ab556035819188e4e0f11ed",
"index": 0,
"guid": "96733393-88fd-4a56-a566-e83bd36ea8a2",
"isActive": false,
"balance": "$1,612.00",
"picture": "http://placehold.it/32x32",
"age": 27,
"eyeColor": "blue",
Movie ID Movie Name Year
0000008 Edison Kinetoscopic Record of a Sneeze 1894
0000091 Le manoir du diable 1896
0000417 Le voyage dans la lune 1902
0000628 The s of Dollie 1908
0000833 The Country Doctor 1909
0001223 Frankenstein 1910
0001740 The Lonedale Operator 1911
0002101 Cleopatra 1912
0002130 Linferno 1911
@narendrans
narendrans / hackernews.js
Created November 7, 2014 21:01
Print title, link and score for each HN items
// Print title, link and score for each HN items
// Inject jquery
$('.title>a').each(function(index) {
var titleLink = $(this).text() + "::" + $(this).attr("href");
var score = $(this).parent().parent().next().find($('[id^=score]')).text().replace(/[^\/\d]/g, '');
console.log(titleLink + "::" + score);
});
# Router restart script
# This scrit authenticates itself with the router and then restarts the router
# Version 1.0
# Auther - Naren
# Tested on a faulty Belkin router :X
# To execute:
# $ sh restart.sh
# Note: You may want to chmod 777 restart.sh to give it permission
@narendrans
narendrans / getFeeds.php
Created April 17, 2014 21:32
Parses the feed and displays the title, author, published date etc in html. All parameters are optional except feed_url
<?php
/**
* This script gets the feeds of the specified rss link.
*
* @author - Naren
* @version - 1.0.0
* @since - 4th April, 2014. 17:23 EST
*
*/