Skip to content

Instantly share code, notes, and snippets.

View mhshimul's full-sized avatar
💭
I may be slow to respond.

Monzurul Shimul mhshimul

💭
I may be slow to respond.
View GitHub Profile
#!/bin/bash
DIRS=`ls -l $MYDIR | egrep '^d' | awk '{print $9}'`
# "ls -l $MYDIR" = get a directory listing
# "| egrep '^d'" = pipe to egrep and select only the directories
# "awk '{print $9}'" = pipe the result from egrep to awk and print only the 9th field
# and now loop through the directories:
for DIR in $DIRS
@mhshimul
mhshimul / ipfs-server-setup.md
Created April 25, 2018 07:22 — forked from claus/ipfs-server-setup.md
Host Your Site Under Your Domain on IPFS

Host Your Site Under Your Domain on IPFS

This is a step-by-step tutorial for hosting your website under your domain on IPFS, from zero, on a DigitalOcean Ubuntu 16.04.3 x64 Droplet (i am using the $10 variant with 2GB RAM).

Install IPFS

Log in as root.

First, make sure the system is up to date, and install tar and wget:

@mhshimul
mhshimul / migrate-bitbucket.sh
Last active April 28, 2018 06:24 — forked from kostajh/migrate-bitbucket.sh
Migrate repositories from gitolite (or somewhere else) to Bitbucket
#!/bin/bash
# Usage: ./bitbucket-migrate.sh repos.txt
#
# repos.txt should have one repository per line.
echo "Reading $1"
while read line
do
@mhshimul
mhshimul / Slf4jSessionLogger.java
Created March 25, 2018 07:09 — forked from dilnei/Slf4jSessionLogger.java
To use SLF4j for them EclipseLink logs
package com.webapp.useful;
import java.util.HashMap;
import java.util.Map;
import org.eclipse.persistence.logging.AbstractSessionLog;
import org.eclipse.persistence.logging.SessionLog;
import org.eclipse.persistence.logging.SessionLogEntry;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@mhshimul
mhshimul / InValueTimestampExtractor.java
Created April 20, 2017 10:05 — forked from nfo/InValueTimestampExtractor.java
Kafka Streams - Custom timestamp extractor, from a `long` field named "timestamp"
/**
* Handle records with a timestamp in their Avro value.
* Expects a LONG field named "timestamp".
* Any problem makes this extractor return the record's internal timestamp.
*/
public class InValueTimestampExtractor implements TimestampExtractor {
@Override
public long extract(ConsumerRecord<Object, Object> record) {
if (record != null && record.value() != null) {