To see messages from other users and the system as well as performing various log operations from a regular user add it to the group:
sudo usermod -aG systemd-journal $USER
@Module | |
abstract class ActivitiesModule { | |
@ContributesAndroidInjector(modules = [MainActivityModule::class]) | |
abstract fun contributeMainActivity(): MainActivity | |
// Other activities come here, same as above. | |
} |
import android.content.ContentResolver | |
import android.net.Uri | |
import okhttp3.MediaType | |
import okhttp3.RequestBody | |
import okio.BufferedSink | |
import okio.Okio | |
import java.lang.IllegalStateException | |
class ContentUriRequestBody( | |
private val contentResolver: ContentResolver, |
/interface wireless channels | |
add band=2ghz-b/g/n width=20 list=2GHz/20MHz frequency=2412 name=ch1 | |
add band=2ghz-b/g/n width=20 list=2GHz/20MHz frequency=2437 name=ch6 | |
add band=2ghz-b/g/n width=20 list=2GHz/20MHz frequency=2462 name=ch11 | |
add band=5ghz-onlyac width=20 list=5GHz/80MHz extension-channel=Ceee frequency=5180 name=ch36/38/42 | |
add band=5ghz-onlyac width=20 list=5GHz/80MHz extension-channel=eCee frequency=5200 name=ch40/38/42 | |
add band=5ghz-onlyac width=20 list=5GHz/80MHz extension-channel=eeCe frequency=5220 name=ch44/46/42 | |
add band=5ghz-onlyac width=20 list=5GHz/80MHz extension-channel=eeeC frequency=5240 name=ch48/46/42 |
cd /home/<user>/ | |
sudo apt-get install unzip | |
wget https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip | |
unzip sdk-tools-linux-4333796.zip -d Android | |
rm sdk-tools-linux-4333796.zip | |
sudo apt-get install -y lib32z1 openjdk-8-jdk | |
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64 | |
export PATH=$PATH:$JAVA_HOME/bin | |
printf "\n\nexport JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64\nexport PATH=\$PATH:\$JAVA_HOME/bin" >> ~/.bashrc | |
cd Android/tools/bin |
The libdispatch is one of the most misused API due to the way it was presented to us when it was introduced and for many years after that, and due to the confusing documentation and API. This page is a compilation of important things to know if you're going to use this library. Many references are available at the end of this document pointing to comments from Apple's very own libdispatch maintainer (Pierre Habouzit).
My take-aways are:
You should create very few, long-lived, well-defined queues. These queues should be seen as execution contexts in your program (gui, background work, ...) that benefit from executing in parallel. An important thing to note is that if these queues are all active at once, you will get as many threads running. In most apps, you probably do not need to create more than 3 or 4 queues.
Go serial first, and as you find performance bottle necks, measure why, and if concurrency helps, apply with care, always validating under system pressure. Reuse
package com.commonsware.android.pwnedcheck; | |
import java.io.IOException; | |
import java.security.MessageDigest; | |
import io.reactivex.Observable; | |
import okhttp3.OkHttpClient; | |
import okhttp3.Request; | |
import okhttp3.Response; | |
public class PwnedCheck { |
From -> https://forum.synology.com/enu/viewtopic.php?t=98124 | |
1. Go to your console ( https://console.developers.google.com/ ) and create a project. | |
2. Create a bucket in Storage -> Cloud Storage -> Storage Browser | |
3. Go to Storage -> Cloud Storage -> Storage Access and enable Interoperability | |
4. Generate access key | |
5. Now go to DSM 5.2 and install Hyper Backup if you havent already. | |
6. Pick S3 storage | |
7. The input next to the label "S3 Server" is both text input and drop-down. This is where you write "storage.googleapis.com" | |
8. Enter key and secret. |
#import <objc/runtime.h> | |
@interface DebuggingOverlay: NSObject | |
@end | |
@implementation DebuggingOverlay | |
+ (void)toggleOverlay { | |
id debugInfoClass = NSClassFromString(@"UIDebuggingInformationOverlay"); |
I recently happened upon a very interesting implementation of popen()
(different API, same idea) called popen-noshell using clone(2)
, and so I opened an issue requesting use of vfork(2)
or posix_spawn()
for portability. It turns out that on Linux there's an important advantage to using clone(2)
. I think I should capture the things I wrote there in a better place. A gist, a blog, whatever.
This is not a paper. I assume reader familiarity with
fork()
in particular and Unix in general, though, of course, I link to relevant wiki pages, so if the unfamiliar reader is willing to go down the rabbit hole, they should be able to come ou