Skip to content

Instantly share code, notes, and snippets.

View asif31iqbal's full-sized avatar
🙂

Asif Iqbal asif31iqbal

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

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 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()
@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()
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 / 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
@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/
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 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
@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;