Skip to content

Instantly share code, notes, and snippets.

View asif31iqbal's full-sized avatar
🙂

Asif Iqbal asif31iqbal

🙂
View GitHub Profile
@asif31iqbal
asif31iqbal / gist:d920a83e067a50ce2f0715aec37673c4
Created June 8, 2016 15:52 — forked from edwardw/gist:1518116
Install and start storm nimbus and supervisor

First, install storm dependencies. How do I compile jzmq for ZeroMQ on OSX? helps.

$ brew install zeromq
$ git clone https://github.com/nathanmarz/jzmq.git
$ cd jzmq
$ sudo vim /usr/share/aclocal/dirlist (sudo cat > /usr/share/aclocal/dirlist permission denied?)
/usr/local/share/aclocal
/usr/local/Cellar/pkg-config/0.25/share/aclocal/
$ export JAVA_HOME=/Library/Java/Home
@asif31iqbal
asif31iqbal / supervisor reload
Last active June 16, 2016 16:07
Commands needed after adding a new process (config) under supervisord
supervisord -c /etc/supervisord.conf
supervisorctl reread
supervisorctl reload
@asif31iqbal
asif31iqbal / QueryTest.java
Created June 10, 2016 21:57 — forked from mocobeta/QueryTest.java
Lucene 4.1 querying sample
import static org.junit.Assert.*;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.Properties;
import org.apache.lucene.analysis.core.WhitespaceAnalyzer;
import org.apache.lucene.analysis.standard.StandardAnalyzer;
import org.apache.lucene.document.Document;
@asif31iqbal
asif31iqbal / Storm misc
Last active February 2, 2017 16:44
Some facts about Apache Storm
Each spout and bolt can have one or more tasks, each of which corresponds to a thread.
Each topology can run under one or more JVMs. For example, if the combined parallelism (number of tasks) of the topology is 300 and 50
workers are allocated, then each worker will execute 6 tasks (as threads within the worker). Storm tries to spread the tasks evenly
across all the workers.
Refer to this [http://storm.apache.org/releases/1.0.1/Understanding-the-parallelism-of-a-Storm-topology.html]
also http://stackoverflow.com/questions/17257448/what-is-the-task-in-storm-parallelism
JMX remote with jconsole via ssh tunneling with socks proxy:
1. Add this to JAVA_OPTS in remote process:
-Dcom.sun.management.jmxremote=true -Dcom.sun.management.jmxremote.port={remoteJMXport} -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false
2. ssh -D {proxyport} user@remotehost
3. jconsole -J-DsocksProxyHost=localhost -J-DsocksProxyPort={proxyport} service:jmx:rmi:///jndi/rmi://{remotehost}:{remoteJMXport}/jmxrmi
For visualvm, see this link:
https://theholyjava.wordpress.com/2012/09/21/visualvm-monitoring-remote-jvm-over-ssh-jmx-or-not/
For MAT:
@asif31iqbal
asif31iqbal / spring oauth help
Last active December 30, 2016 05:00
Spring rest help
oauth:
https://jaxenter.com/rest-api-spring-java-8-112289.html
https://raymondhlee.wordpress.com/2014/12/21/implementing-oauth2-with-spring-security/
http://websystique.com/spring-security/secure-spring-rest-api-using-oauth2/
@asif31iqbal
asif31iqbal / solr_help.txt
Last active February 19, 2017 02:35
solr help
Analyzer
- Tokenizer
- Series of filters
StandardAnalyzer
- StandardTokenizer
- StandardFilter, LowercaseFilter, StopFilter
Stemming:
- Swimming -> Swim, catlike, cattly -> cat
- Create custom Analyzer, override createComponents()
- PorterStemFilter
https://www.facebook.com/v2.8/dialog/oauth?
client_id={app-id}
&redirect_uri={redirect-uri}
https://graph.facebook.com/v2.8/oauth/access_token?
client_id={app-id}
&redirect_uri={redirect-uri}
&client_secret={app-secret}
&code={code-parameter}
@asif31iqbal
asif31iqbal / pandas-numpy
Last active July 26, 2017 20:28
pandas cheatsheet
import pandas as pd
df = pd.DataFrame({'id': [12, None, 56], 'name': ['asif', 'iqbal', 'anika']})
# df to numpy array
df.values
# df to boolean df (null/ notnull)
df.notnull()
# oppposite of notnull
df.isnull()
@asif31iqbal
asif31iqbal / pytorch_mnist.py
Created October 3, 2018 18:53 — forked from xmfbit/pytorch_mnist.py
an example of pytorch on mnist dataset
import os
import torch
import torch.nn as nn
from torch.autograd import Variable
import torchvision.datasets as dset
import torchvision.transforms as transforms
import torch.nn.functional as F
import torch.optim as optim
## load mnist dataset
use_cuda = torch.cuda.is_available()