Skip to content

Instantly share code, notes, and snippets.

@ouchadam
ouchadam / run.sh
Last active Apr 5, 2022
Run a single https synapse instance
View run.sh
#!/usr/bin/env bash
PYTHONPATH=$(readlink -f "$(pwd)")
export PYTHONPATH
DIR="$( cd "$( dirname "$0" )" && pwd )"
echo "$PYTHONPATH"
port=8080
@ouchadam
ouchadam / upload.sh
Last active Oct 26, 2021
Upload APK to appcenter app=my-cool-app owner=owner-in-appcenter file=path/to/file token=1234-api-token destination_name=group-to-apply
View upload.sh
#!/bin/bash
set -e
CONFIG=$@
for line in $CONFIG; do
eval "$line"
done
AUTH="X-API-Token: $token"
CONTENT_TYPE=application/vnd.android.package-archive
@ouchadam
ouchadam / script.sh
Created Apr 9, 2020
kotlin and java code percentages using cloc
View script.sh
#!/bin/bash
for d in ./*/;
do
result=$(cloc $d --match-d='/java/' --json | jq '. | {total: .SUM.code, kotlin: .Kotlin.code, java: .Java.code}' )
if [ -n "$result" ]
then
total=$(jq '.total' <<< $result)
kotlin=$(jq '.kotlin' <<< $result)
View gist:876aa29b80752ecaaa08
private static Pair<String, CodecCapabilities> getMediaCodecInfoInternal(CodecKey key,
MediaCodecListCompat mediaCodecList) {
String mimeType = key.mimeType;
int numberOfCodecs = mediaCodecList.getCodecCount();
boolean secureDecodersExplicit = mediaCodecList.secureDecodersExplicit();
// Note: MediaCodecList is sorted by the framework such that the best decoders come first.
Log.e("!!!", " --------- secure explicit? : " + secureDecodersExplicit);
for (int i = 0; i < numberOfCodecs; i++) {
MediaCodecInfo info = mediaCodecList.getCodecInfoAt(i);
View gist:6092895
@Override
public void onBind(NetworkStatus networkStatus) {
button.setEnabled(networkStatus.isAvailable());
}
@ouchadam
ouchadam / gist:6092863
Created Jul 26, 2013
Super simple merlin example
View gist:6092863
@Override
public void onConnect() {
button.setEnabled(true);
}
@Override
public void onDisconnect() {
button.setEnabled(false);
}
@ouchadam
ouchadam / Merlin example Button
Last active Dec 20, 2015
Using merlin to enable and disable a button based on network availability
View Merlin example Button
public class FooActivity extends Activity implements Connectable, Disconnectable, Bindable {
private Merlin merlin;
private Button button;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
initMerlin();