Skip to content

Instantly share code, notes, and snippets.

View omkar-tenkale's full-sized avatar
☸️
Planning

Omkar Tenkale omkar-tenkale

☸️
Planning
View GitHub Profile
@omkar-tenkale
omkar-tenkale / AndroidManifest.xml
Last active November 20, 2022 23:33
android FileUriExposedException fix view file intent crash with fileprovider approach
<provider
android:name=".GenericFileProvider"
android:authorities="${applicationId}"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/provider_paths"/>
</provider>
@omkar-tenkale
omkar-tenkale / gist:bb64ad9ed8a9f5588921aeb77516ed58
Created March 12, 2021 17:46
retrofit logging to logcat one line
private MovieService() {
Retrofit retrofit = new Retrofit.Builder()
.baseUrl(URL)
.client(new OkHttpClient.Builder().addInterceptor(new HttpLoggingInterceptor().setLevel(HttpLoggingInterceptor.Level.BODY)).build())
.addConverterFactory(GsonConverterFactory.create())
.build();
mMovieApi = retrofit.create(MovieApi.class);
}
@omkar-tenkale
omkar-tenkale / hibernateubuntu20.txt
Created March 12, 2021 16:22
hibernate ubuntu 20 steps to enable hibernation
Enabling Hibernate
[https://kaigo.medium.com/ubuntu-20-04-on-dell-xps-15-9570-14efd881f0d2]
Install gparted from Ubuntu Software Centre
Find the partition with the file system linux-swap
Right click > Swapon (if not already on)
Right click > Information
Copy the UUID=14cee2ec-9d37–4ac0-b594-eae0e55814aa (for example)
Add this UUID to /etc/default/grub file by running sudo gedit /etc/default/grub and editing the line
@omkar-tenkale
omkar-tenkale / gist:69558fcc182eb5d3a0f44cae47f7194e
Last active March 12, 2021 07:56
nginx ubuntu wordpress theme upload error
How to fix errors while uploading themes on wordpress site (Ubuntu NGINX LEMP)
[Useful nano shortcut]
Search: CTRL + W
Save file: CTRL + X
1.Fix "413 Request Entity Too Large" Error
sudo nano /etc/nginx/nginx.conf
Add a line in the http section:
//Given width and height of a rectangle which is rotated from center by angle in radians,
//returns width and height of rectangle to crop from center of original image to eliminate the black borders
// https://i.stack.imgur.com/KWoeo.jpg
//Similar to this image above,input params are input's width and height,rotation in radians
//Output is pair.first = width of cropped image in B, pair.second = height of cropped image in B
//You can use the scaleCenterCrop function to crop the image bitmap on android
// Usage:
// Pair<Integer, Integer> pair = rotatedRectWithMaxArea(originalImageWidth, originalImageHeight, Math.toRadians(rotation));