This file contains 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
LOGGING = { | |
'version': 1, | |
'disable_existing_loggers': False, | |
'formatters': { | |
'verbose': { | |
'format': '{levelname} {asctime} {process:d} {message}', | |
'style': '{', | |
}, | |
}, | |
'handlers': { |
This file contains 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 json | |
from base64 import b64encode | |
from datetime import datetime | |
import requests | |
from requests.auth import HTTPBasicAuth | |
def get_access_token(): |
This file contains 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
def unique_filename(path): | |
""" | |
Enforce unique upload file names. | |
Usage: | |
class MyModel(models.Model): | |
file = ImageField(upload_to=unique_filename("path/to/upload/dir")) | |
""" | |
import os, base64, datetime |
This file contains 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
# Reset Jetbrains 2020 Products | |
import glob | |
import os | |
import winreg | |
from os import path | |
from os.path import expanduser | |
home = expanduser("~") | |
newJetbrainsHome = path.join(home, "AppData\Roaming\JetBrains") |
This file contains 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
#!/bin/bash | |
# Thanks @ketos @krishjun @denis111 | |
## declare array of tools | |
declare -a tools=( | |
"DataGrip" | |
"CLion" | |
"Rider" | |
"PhpStorm" |
This file contains 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
//Add this to gradle | |
// implementation 'com.google.android.play:core:1.5.0' | |
private static final int MY_REQUEST_CODE = 2399; | |
private void checkForUpdates() { | |
final AppUpdateManager appUpdateManager = AppUpdateManagerFactory.create(this); | |
Task<AppUpdateInfo> appUpdateInfoTask = appUpdateManager.getAppUpdateInfo(); |
This file contains 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.content.Context; | |
import android.view.LayoutInflater; | |
import android.view.View; | |
import android.view.ViewGroup; | |
import android.widget.BaseAdapter; | |
import android.widget.ImageView; | |
import android.widget.TextView; | |
import java.util.ArrayList; |
This file contains 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
package io.walter.foodtaskerapp; | |
import android.content.Intent; | |
import android.os.Bundle; | |
import android.support.v7.app.AppCompatActivity; | |
import android.util.Log; | |
import android.view.View; | |
import android.widget.Button; | |
import android.widget.TextView; | |
import android.widget.Toast; |
This file contains 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
//bit.ly/2WIKPgz | |
double latitude = 0.0; | |
double longitude = 0.0; | |
private FusedLocationProviderClient fusedLocationClient; | |
// fusedLocationClient = LocationServices.getFusedLocationProviderClient(this); | |
public void fetchGPS() { | |
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) { | |
return; |
NewerOlder