This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # glob list has a sorting problem. this scrip will solve this issue. | |
| import glob | |
| files = glob.glob('test/*.txt') | |
| files.sort(key=lambda var:[int(x) if x.isdigit() else x for x in re.findall(r'[^0-9]|[0-9]+', var)]) | |
| for file in files: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Removing english word from non english document | |
| import re | |
| doc = """ | |
| নতুন করে কিছু english শব্দ নিয়ে সমস্যা তৈরি হয়েছে। বাক্যের মধ্যে এই English শব্দ খুবেই বিরক্তির উদ্রেক করছে। | |
| Just figure out to remove these words | |
| """ | |
| import re | |
| result = re.sub(r'[A-Za-z]', '', doc) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| Name: Merging multiple json file into one json file | |
| Date: 29/06/2019 | |
| Writer: Sagor Sarker | |
| """ | |
| import glob | |
| import json | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| ---------------------------------------------- | |
| | Convert XML file to JSON file Using Python | | |
| | Writer: Sagor Sarker | | |
| | Date : 27 June 2019 | | |
| ---------------------------------------------- | |
| """ | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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") | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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 file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class Hello{ | |
| public static void main(String[] args){ | |
| System.out.println("Hello World!"); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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(); |