Skip to content

Instantly share code, notes, and snippets.

View tolunayozturk's full-sized avatar

Tolunay Öztürk tolunayozturk

  • Software Engineer @Huawei
  • Istanbul, Turkey
  • 19:20 (UTC +03:00)
View GitHub Profile
@tolunayozturk
tolunayozturk / changeaccel.py
Last active May 8, 2018 11:22
Auto set "Device Accel Constant Deceleration" to a usable level for A4TECH G3-200N Wireless Mice when connected
#!/usr/bin/python3
import subprocess
import pyudev
import time
deceleration = -0.3
# bionic = 'libinput Accel Speed' [-1,1]
# xenial = 'Device Accel Constant Deceleration'
context = pyudev.Context()
@tolunayozturk
tolunayozturk / VSCodeNautilusExt.py
Last active January 19, 2022 20:06
"Open in VSCode" extension for Nautilus
# -*- coding: latin-1 -*-
# Copy this python script under ~/.local/share/nautilus-python/extensions and restart nautilus.
# You may need to create nautilus-python and extensions folders if they do not exist. –
import os
import gi
gi.require_version('Nautilus', '3.0')
from gi.repository import Nautilus, GObject
@tolunayozturk
tolunayozturk / driveSignIn.java
Last active September 15, 2020 13:03
HUAWEI Drive Kit Sign In
private void driveSignIn() {
List<Scope> scopeList = new ArrayList<>();
scopeList.add(new Scope(DriveScopes.SCOPE_DRIVE));
scopeList.add(new Scope(DriveScopes.SCOPE_DRIVE_APPDATA));
scopeList.add(new Scope(DriveScopes.SCOPE_DRIVE_FILE));
scopeList.add(new Scope(DriveScopes.SCOPE_DRIVE_METADATA));
scopeList.add(new Scope(DriveScopes.SCOPE_DRIVE_METADATA_READONLY));
scopeList.add(new Scope(DriveScopes.SCOPE_DRIVE_READONLY));
scopeList.add(HuaweiIdAuthAPIManager.HUAWEIID_BASE_SCOPE);
@tolunayozturk
tolunayozturk / drivePermissions.xml
Created September 15, 2020 12:30
HUAWEI Drive Kit read and write permissions for the phone storage in AndroidManifest.xml
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission
android:name="android.permission.WRITE_MEDIA_STORAGE"
tools:ignore="ProtectedPermissions" />
@tolunayozturk
tolunayozturk / permissions.java
Created September 15, 2020 12:36
Storage permissions for HUAWEI Drive Kit
private static String[] PERMISSIONS_STORAGE = {
Manifest.permission.READ_EXTERNAL_STORAGE,
Manifest.permission.WRITE_EXTERNAL_STORAGE,
Manifest.permission.CAMERA
};
@tolunayozturk
tolunayozturk / requestStoragePermissions.java
Created September 15, 2020 12:38
Request permissions for phone storage
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
requestPermissions(PERMISSIONS_STORAGE, 1);
}
private void uploadFiles() {
new Thread(new Runnable() {
@Override
public void run() {
try {
if (mAccessToken == null) {
Log.d(TAG, "need to sign in first");
return;
}
if (StringUtils.isNullOrEmpty(et_uploadFileName.getText().toString())) {
private void queryFiles() {
new Thread(new Runnable() {
@Override
public void run() {
try {
if (mAccessToken == null) {
Log.d(TAG, "need to sign in first");
return;
}
private void downloadFiles() {
new Thread(new Runnable() {
@Override
public void run() {
try {
if (mAccessToken == null) {
Log.d(TAG, "need to sign in first");
return;
}
if (fileSearched == null) {
private void commentFile() {
new Thread(new Runnable() {
@Override
public void run() {
try {
if (mAccessToken == null) {
Log.d(TAG, "need to sign in first");
return;
}
if (fileSearched == null) {