NOTE: 534 stars, 106 forks. I love you all. Please contribute tips and edits back to this cheat sheet -- email's [email protected] and you can treat gists like git repositories and send git diffs.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 | |
} |
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.
The following steps assume you've got a set-up like mine, where:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' |
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 < 20)' session_july_last_few_days.jsonl
- 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
OlderNewer