Skip to content

Instantly share code, notes, and snippets.

View HassankSalim's full-sized avatar
💭
Always looking for interesting work and tech

Hassan K Salim HassankSalim

💭
Always looking for interesting work and tech
View GitHub Profile
kafka-topics.sh --list --zookeeper localhost:2181
kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic status
docker stop kafka-server && docker rm kafka-server
docker stop zookeeper-server && docker rm zookeeper-server
docker run -d --name zookeeper-server --network host -e ALLOW_ANONYMOUS_LOGIN=yes bitnami/zookeeper:latest
docker run -d --name kafka-server --network host -e ALLOW_PLAINTEXT_LISTENER=yes -e KAFKA_CFG_ZOOKEEPER_CONNECT=localhost:2181 bitnami/kafka:latest
rosbag info --yaml --key=types[0].type 2020-07-15-11-29-48.bag
select * from pg_stat_activity where (state = 'idle in transaction') and xact_start is not null;
import re
# Custom grep
grep = lambda lib, regex : filter(lambda x : re.search(regex, x), dir(lib))
# Usage
# input: list(grep(bson, 'deco'))
# result: ['_utf_8_decode', 'decode_all', 'decode_file_iter', 'decode_iter']
# input: list(grep(numpy, '^a.*y$'))
# result: ['any', 'array', 'asanyarray', 'asarray', 'ascontiguousarray', 'asfarray', 'asfortranarray']
import numpy as np
import cv2
import os
import random
import pandas as pd
import sys
class ImageDataLoader():
def __init__(self, data_path, gt_path, shuffle=False, gt_downsample=False, pre_load=False, num_classes=10):
#pre_load: if true, all training and validation images are loaded into CPU RAM for faster processing.
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
import torch
import torch.nn as nn
import torch.nn.functional as F
from src.network import Conv2d, FC
import torch
import torch.nn as nn
import torch.nn.functional as F
import src.network as network
from src.models import CMTL
class CrowdCounter(nn.Module):
def __init__(self, ce_weights=None):
super(CrowdCounter, self).__init__()
import os
import torch
import numpy as np
from src.crowd_count import CrowdCounter
from src import network
from src.data_loader import ImageDataLoader
from src import utils
torch.backends.cudnn.enabled = True