Skip to content

Instantly share code, notes, and snippets.

Avatar
🙂

Asif Iqbal asif31iqbal

🙂
View GitHub Profile
@asif31iqbal
asif31iqbal / limitConcurrentGoroutines.go
Created Mar 1, 2021 — forked from AntoineAugusti/limitConcurrentGoroutines.go
Limit the maximum number of goroutines running at the same time
View limitConcurrentGoroutines.go
package main
import (
"flag"
"fmt"
"time"
)
// Fake a long and difficult work.
func DoWork() {
View keybase.md

Keybase proof

I hereby claim:

  • I am asif31iqbal on github.
  • I am asif31iqbal (https://keybase.io/asif31iqbal) on keybase.
  • I have a public key ASBm0K2uHWDp4Dxr2u1-2m2hdd15llI0IitAI013_cp07Qo

To claim this, I am signing this object:

@asif31iqbal
asif31iqbal / pytorch_mnist.py
Created Oct 3, 2018 — forked from xmfbit/pytorch_mnist.py
an example of pytorch on mnist dataset
View pytorch_mnist.py
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()
@asif31iqbal
asif31iqbal / pandas-numpy
Last active Jul 26, 2017
pandas cheatsheet
View pandas-numpy
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()
View gist:3e8708390d395d1b76ae363bcb789e8a
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}
View solr_help.txt
Analyzer
- Tokenizer
- Series of filters
StandardAnalyzer
- StandardTokenizer
- StandardFilter, LowercaseFilter, StopFilter
Stemming:
- Swimming -> Swim, catlike, cattly -> cat
- Create custom Analyzer, override createComponents()
- PorterStemFilter
View spring oauth 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/
View jvm misc
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 / Storm misc
Last active Feb 2, 2017
Some facts about Apache Storm
View Storm misc
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
@asif31iqbal
asif31iqbal / QueryTest.java
Created Jun 10, 2016 — forked from mocobeta/QueryTest.java
Lucene 4.1 querying sample
View QueryTest.java
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;