Skip to content

Instantly share code, notes, and snippets.

Mizan Rahman mizanRahman

Block or report user

Report or block mizanRahman

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View .vimrc
source ~/.vim_runtime/vundle_plugins
set runtimepath+=~/.vim_runtime
set number
set relativenumber
source ~/.vim_runtime/vimrcs/basic.vim
source ~/.vim_runtime/vimrcs/filetypes.vim
@mizanRahman
mizanRahman / one-liners.md
Last active Sep 15, 2018
one liner scripts
View one-liners.md

kill process by port. can be defined as an alias

lsof -i :8080 | awk '{l=$2} END {print l}' | xargs kill

Output an arbitrary number of open TCP or UDP ports in an arbitrary range

comm -23 <(seq "$FROM" "$TO") <(ss -tan | awk '{print $4}' | cut -d':' -f2 | grep "[0-9]\{1,5\}" | sort | uniq) | shuf | head -n "$HOWMANY"
View KpcatApplication.java
package com.example.kpcat;
import com.ulisesbocchio.jasyptspringboot.annotation.EnableEncryptableProperties;
import org.jasypt.encryption.StringEncryptor;
import org.jasypt.encryption.pbe.PooledPBEStringEncryptor;
import org.jasypt.encryption.pbe.config.SimpleStringPBEConfig;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
View UniqueRandomNumberGeneratorImplV2.java
public class UniqueRandomNumberGeneratorImplV2 implements UniqueRandomNumberGenerator {
private SecureRandom random;
@Autowired
public UniqueRandomNumberGeneratorImplV2(SecureRandom random) {
this.random = random;
}
@Override
View metric.py
import requests
services = (
("http://httpbin.org/get", 'POST'),
("http://httpbin.org/get", 'POST'),
("http://httpbin.org/get", 'POST'),
("http://httpbin.org/get", 'POST'),
("http://httpbin.org/get", 'POST'),
("http://httpbin.org/get", 'POST')
)
View metric.py
#!/usr/bin/env python
import urllib2
import json
url = "http://localhost:8080/api/metrics"
res = urllib2.urlopen(url).read()
json_res= json.loads(res)
print json_res['threads']
@mizanRahman
mizanRahman / error_code_diff.gradle
Created Aug 11, 2018
finds new properties added in source.properties from dest.properties file
View error_code_diff.gradle
def sourceProps = new Properties()
def destProps = new Properties()
def diffProps = new Properties()
file("source.properties").withInputStream { sourceProps.load(it) }
file("dest.properties").withInputStream { destProps.load(it) }
task diff {
doFirst {
def sourceKeys = sourceProps.stringPropertyNames();
@mizanRahman
mizanRahman / install-ntp.sh
Created Jun 22, 2018
install network time server agent
View install-ntp.sh
yum install ntp
chkconfig ntpd on
ntpdate pool.ntp.org
service ntpd start
@mizanRahman
mizanRahman / net.sh
Created Jun 22, 2018
network analysis
View net.sh
# tcpdump standard
sudo tcpdump -nvvv -i any -c 20 'port 9090'
@mizanRahman
mizanRahman / odoo-install-pre.sh
Last active Jan 5, 2018
packages required to install odoo in ubuntu
View odoo-install-pre.sh
sudo apt-get install libxml2-dev libxslt1-dev
sudo pip install lxml
sudo apt-get install libjpeg-dev
sudo apt-get install libsasl2-dev python-dev libldap2-dev libssl-dev
You can’t perform that action at this time.