Skip to content

Instantly share code, notes, and snippets.

View manisnesan's full-sized avatar
🎯
Focusing

Manikandan Sivanesan` manisnesan

🎯
Focusing
View GitHub Profile
/**
* Sample Method to convert the inputstream feed from GSA to JaxB class Gsafeed
*/
public Gsafeed parseRecords(InputStream feedInputStream) {
SAXParserFactory spf = SAXParserFactory.newInstance();
spf.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
spf.setFeature("http://xml.org/sax/features/validation", false);
spf.setNamespaceAware(true); // Binding attributes
EntityResolver entityResolver = new EntityResolver() {
@manisnesan
manisnesan / islocalhost
Last active August 29, 2015 14:22 — forked from ke4roh/islocalhost
#!/bin/bash
set -e
function isLocalhost {
local TEST_IP=$(getent hosts $1 | cut -f1 -d\ | head -1)
local ALL_MY_IPS=$(ip addr | grep inet | grep -v link | cut -f2- -de | cut -f2 -d\ | cut -f1 -d/)
( echo $ALL_MY_IPS | grep -q $TEST_IP ) && return 0
return 1
}
@manisnesan
manisnesan / vm-resize-hard-disk.md
Created September 29, 2015 21:43 — forked from christopher-hopper/vm-resize-hard-disk.md
Resize a Hard Disk for a Virtual Machine provisioned using Vagrant from a Linux base box to run using VirutalBox.

Resize a Hard Disk for a Virtual Machine

Our Virtual Machines are provisioned using Vagrant from a Linux base box to run using VirutalBox. If the Hard Disk space runs out and you cannot remove files to free-up space, you can resize the Hard Disk using some VirtualBox and Linux commands.

Some assumptions

The following steps assume you've got a set-up like mine, where:

@manisnesan
manisnesan / Vagrantfile
Created September 30, 2015 15:29 — forked from nruth/Vagrantfile
vagrant ubuntu 14.04 rbenv mysql for rails
Vagrant.configure(2) do |config|
# Every Vagrant development environment requires a box. You can search for
# boxes at https://atlas.hashicorp.com/search.
config.vm.box = 'ubuntu/trusty64'
# Create a forwarded port mapping which allows access to a specific port
# within the machine from a port on the host machine. In the example below,
# accessing "localhost:8080" will access port 80 on the guest machine.
config.vm.network "forwarded_port", guest: 3000, host: 3000
@manisnesan
manisnesan / DefaultJenkinsEmail
Created October 7, 2015 14:10 — forked from ferventcoder/DefaultJenkinsEmail
Jenkins Email-ext (Editable Email Notifications)
Subject: Jenkins ${BUILD_STATUS} [#${BUILD_NUMBER}] - ${PROJECT_NAME}
Content Type: Plain Text (text/plain)
Trigger for matrix projects: Trigger for each configuration
Choose "Advanced", "Add a Trigger" and choose the following triggers:
Fixed, Failure, Unstable, Still Failing, Still Unstable
Ensure that "Send To Recipient List" is checked for all of these at the very least.
Fixed is the only trigger you will need to expand to change the Content.
@manisnesan
manisnesan / nltk-intro.py
Created February 19, 2016 20:28 — forked from alexbowe/nltk-intro.py
Demonstration of extracting key phrases with NLTK in Python
import nltk
text = """The Buddha, the Godhead, resides quite as comfortably in the circuits of a digital
computer or the gears of a cycle transmission as he does at the top of a mountain
or in the petals of a flower. To think otherwise is to demean the Buddha...which is
to demean oneself."""
# Used when tokenizing words
sentence_re = r'''(?x) # set flag to allow verbose regexps
([A-Z])(\.[A-Z])+\.? # abbreviations, e.g. U.S.A.
@manisnesan
manisnesan / Delete by Query - SOLR
Created February 20, 2019 14:00 — forked from abdollar/Delete by Query - SOLR
Delete by Query to delete from SOLR
delete from solr - delete by query
curl http://hostname:port/solr/update --data-binary '<delete><query>id:123456</query></delete>' -H 'Content-type:text/xml; charset=utf-8'
curl http://hostname:port/solr/update --data-binary '<commit waitFlush="false" waitSearcher="false" expungeDeletes="true"/>' -H 'Content-type:text/xml; charset=utf-8'

JQ to filter by value

Syntax: cat <filename> | jq -c '.[] | select( .<key> | contains("<value>"))'

Example: To get json record having _id equal 611

cat my.json | jq -c '.[] | select( ._id | contains(611))'

Remember: if JSON value has no double quotes (eg. for numeric) to do not supply in filter i.e. in contains(611)

jq -c '. | select(.action == "problem_statement") | select(.context[] | contains("ipsum") | not) | .context[] | select(split(" ") | length &lt; 20)' session_july_last_few_days.jsonl
@manisnesan
manisnesan / Bag of Tricks for Efficient Text Classification.md
Created July 6, 2019 16:49 — forked from shagunsodhani/Bag of Tricks for Efficient Text Classification.md
Summary of "Bag of Tricks for Efficient Text Classification" paper

Bag of Tricks for Efficient Text Classification

Introduction

  • Introduces fastText, a simple and highly efficient approach for text classification.
  • At par with deep learning models in terms of accuracy though an order of magnitude faster in performance.
  • Link to the paper
  • Link to code

Architecture