Skip to content

Instantly share code, notes, and snippets.

View sagorbrur's full-sized avatar
🎯
Focusing

Sagor Sarker sagorbrur

🎯
Focusing
View GitHub Profile
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.sagorsarker.addingswiprefresh.MainActivity">
<!--refresh layout-->
<android.support.v4.widget.SwipeRefreshLayout
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/menu_refresh"
android:title="@string/menu_refresh"
app:showAsAction="never"
/>
</menu>
SRL = (SwipeRefreshLayout) findViewById(R.id.swiperefresh);
SRL.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener(){
@Override
public void onRefresh() {
Log.i(TAG, "onRefresh called from SwipeRefreshLayout");
// This method performs the actual data-refresh operation.
// The method calls setRefreshing(false) when it's finished.
myUpdateOperation();
}
SRL = (SwipeRefreshLayout) findViewById(R.id.swiperefresh);
SRL.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener(){
@Override
public void onRefresh() {
Log.i(TAG, "onRefresh called from SwipeRefreshLayout");
// This method performs the actual data-refresh operation.
// The method calls setRefreshing(false) when it's finished.
myUpdateOperation();
}
case R.id.menu_refresh:
Log.i(TAG, "Refresh menu item selected");
// Signal SwipeRefreshLayout to start the progress indicator
SRL.setRefreshing(true);
// Start the refresh background task.
// This method calls setRefreshing(false) when it's finished.
myUpdateOperation();
import android.app.Service;
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
/**
* Created by Sagor Sarker on 17-Nov-17.
*/
public class ConnectionDetector {
public class Hello{
public static void main(String[] args){
System.out.println("Hello World!");
}
}
# dependency
# pip install pydbgen
from pydbgen import pydbgen
import pandas as pd
generator = pydbgen.pydb()
# Generate a license-plate (US style)
print(generator.license_plate())
"""
This script will help you to create dset.h5 file for synthtext data generation.
SynthText: https://github.com/ankush-me/SynthText
First download imnames.cp, bg_img, depth.h5, seg.h5
Rename imnames.cp to imagesName.txt
Run generate_dset_for_synthtext.py
It will create dset.h5
Then put it inside SynthText/data and run
python gen.py --viz
# a simple script to rename multiple files
import os
import re
path = 'myimages/'
files = os.listdir(path)
files.sort(key=lambda var:[int(x) if x.isdigit() else x for x in re.findall(r'[^0-9]|[0-9]+', var)])
for i, file in enumerate(files):
os.rename(path + file, path + "rename_{}".format(i)+".jpg")