Skip to content

Instantly share code, notes, and snippets.

View mnikhil-git's full-sized avatar

Nikhil Mulley mnikhil-git

View GitHub Profile
@montanaflynn
montanaflynn / easyget.go
Last active September 12, 2020 17:44
GET JSON array in Golang
package easyget
import (
"io"
"io/ioutil"
"net/http"
)
// Define Request struct
type Request struct {
@briatte
briatte / pubmed_ask.r
Last active October 19, 2020 13:14
pubmed scraper
#' Get a PubMed search index
#' @param query a PubMed search string
#' @return the XML declaration of the search
#' @example
#' # Which articles discuss the WHO FCTC?
#' pubmed_ask("FCTC OR 'Framework Convention on Tobacco Control'")
pubmed_ask <- function(query) {
# change spaces to + and single-quotes to URL-friendly %22 in query
query = gsub("'", "%22", gsub(" ", "+", query))
@manchicken
manchicken / circular_buffer.pl
Created August 15, 2013 03:47
A quick demo of a circular buffer in Perl
#!/usr/bin/env perl
use strict;use warnings;
use Test::More;
use Readonly;
Readonly our $LIST_SIZE_LIMIT => 10_000;
{
package Circle;
@spacebat
spacebat / parcel-passer.pl
Created August 8, 2013 06:03
A proof of concept for sending code as strings for evaluation in a child process.
#!/usr/bin/env perl
# ABSTRACT: proof of concept for sending subs to a child process for evaluation
use strict;
use warnings;
use v5.10;
use Data::Dumper;
use Socket;
use Time::HiRes qw(sleep);
@msilvey
msilvey / pruneStagingDirs.sh
Created July 12, 2013 19:03
A loop to remove old staging dirs. This is a part of the workaround for a bug tracked here: https://issues.apache.org/jira/browse/MAPREDUCE-5351
#!/bin/bash
NOW=`date +%s`
SIXHOURSAGO=`echo "$NOW - 21600" |bc`
HADOOPBIN="/usr/bin/hadoop"
IFS=$'\n'
for i in `$HADOOPBIN fs -ls /user/root/.staging/`; do
IFS=' '
JOBDATE=`echo $i|awk '{print $6" "$7}'`
@akishin
akishin / auto_compression_redis.rb
Created June 22, 2013 04:04
redis-rb auto compression client
# -*- coding: utf-8 -*-
require 'json'
require 'zlib'
class Redis
class Client
def call(command, &block)
if write?(command.first)
command[command.length - 1] = encode(command.last)
# coding=UTF-8
from __future__ import division
import re
# This is a naive text summarization algorithm
# Created by Shlomi Babluki
# April, 2013
class SummaryTool(object):
@karmi
karmi / .gitignore
Last active December 24, 2015 14:53
Build a virtual machine with Elasticsearch from scratch with Vagrant
.vagrant
Gemfile.lock
Berksfile.lock
tmp/
@stefanozanella
stefanozanella / gerrit_with_ldaps_auth.md
Created November 21, 2012 11:01
Configuring SSL certificate / private key pair in Gerrit to talk with LDAPS backend

Making Gerrit and LDAP speak in tongues together via SSL

If you're an experienced Java developer or container/AS user, you'll probably want to just skip this, since it involves just some Java tools and standards techniques.
If you, however, like me, have only scratched the surface of the ceremony of the Java world (no troll intended), then you can probably find this useful, since I couldn't find proper documentation about this but had to assembly it together from various sources.

I started to configure a Gerrit instance on our company's server to start putting a bit of order in the mess that is our structure by now. Since the instance is private, I didn't want to enable OpenID authentication, nor I wanted to set it in development mode (aka everyone's invited). Having to choose between offloading authentication to an HTTP proxy and setting up an LDAP backend, I opted for the latter. Also, to complicate things further, I have not only enabled SSL support on the LDAP server, but I required _strict client c

@jbd
jbd / gist:3898953
Created October 16, 2012 12:26
gmond python module for tracking Open Grid Scheduler queue state
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of