Skip to content

Instantly share code, notes, and snippets.

View ab2005's full-sized avatar

alexandre barilov ab2005

View GitHub Profile
@ab2005
ab2005 / MarketLaunch.java
Last active December 22, 2015 21:17
Create the intent to launch the marketplace for an application
/**
* Create the intent to launch the marketplace for an application
*
* @return the intent instance
*/
public static Intent createAndroidMarketPlaceIntent(String appName) {
final Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse(String.format("market://details?id=%s", appName)));
return intent;
}
<title>Broadcast Multiple-Cameras using RTCMultiConnection.js</title>
<h1>Broadcast Multiple-Cameras using <a href="http://www.rtcmulticonnection.org/">RTCMultiConnection.js</a>
</h1>
<style>
video {
width: 30%
}
button {
font-family: Myriad, Arial, Verdana;
<input type="file" id="files" accept="image/*" multiple>
document.querySelector('#files').onchange = function(e) {
var files = e.target.files; // FileList of File objects.
for (var i = 0, f; f = files[i]; ++i) {
console.log(f.name, f.type, f.size,
f.lastModifiedDate.toLocaleDateString());
}
};
@ab2005
ab2005 / .block
Last active September 29, 2016 23:33
Read images with HTML5
license: none
height:400
scrolling:yes
border:yes
@ab2005
ab2005 / .block
Last active September 30, 2016 01:02
Using object URLs to display images
license:none
height:400
scrolling:yes
border:yes
@ab2005
ab2005 / Readme.md
Last active September 30, 2016 22:33
Huston web

Android environment

OPERATOR=`getprop ro.build.target_operator GLOBAL`
COUNTRY=`getprop ro.build.target_country COM
# echo $PATH
/sbin:/vendor/bin:/system/sbin:/system/bin:/system/xbin

# Print system *.png images
su -c 'cat /system/DFFileList.txt' | grep '.png' 
@ab2005
ab2005 / HttpResponse.java
Created October 4, 2016 14:42
Http response as Java enum
public enum HttpResponse {
HTTP_100( 100, "HTTP/1.0 100 Continue\r\n\r\n" ),
HTTP_101( 101, "HTTP/1.0 101 Switching Protocols\r\n\r\n" ),
HTTP_200( 200, "HTTP/1.0 200 OK\r\n\r\n" ),
HTTP_201( 201, "HTTP/1.0 201 Created\r\n\r\n" ),
HTTP_202( 202, "HTTP/1.0 202 Accepted\r\n\r\n" ),
HTTP_203( 203, "HTTP/1.0 203 Non-Authoritative Information\r\n\r\n" ),
HTTP_204( 204, "HTTP/1.0 204 No Content\r\n\r\n" ),
HTTP_205( 205, "HTTP/1.0 205 Reset Content\r\n\r\n" ),
HTTP_206( 206, "HTTP/1.0 206 Partial Content\r\n\r\n" ),
@ab2005
ab2005 / LocalBroadcastManager.java
Created October 4, 2016 15:19
Helper to register for and send broadcasts of Intents to local objects within app.
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Set;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.net.Uri;
import android.os.Handler;
@ab2005
ab2005 / H.java
Created October 8, 2016 18:39
Android main thread handler
private class H extends Handler {
public static final int LAUNCH_ACTIVITY = 100;
public static final int PAUSE_ACTIVITY = 101;
public static final int PAUSE_ACTIVITY_FINISHING= 102;
public static final int STOP_ACTIVITY_SHOW = 103;
public static final int STOP_ACTIVITY_HIDE = 104;
public static final int SHOW_WINDOW = 105;
public static final int HIDE_WINDOW = 106;
public static final int RESUME_ACTIVITY = 107;
public static final int SEND_RESULT = 108;
@ab2005
ab2005 / Readme.md
Last active October 9, 2016 06:20
Cables bandwidth
  • USB 2.0 is rated at 480Mbps. That’s about 60 megabytes per second.
  • USB 3.0 is rated at 5 Gbps. That’s about 640 megabytes per second.
  • eSATA is rated at 3 Gbps and 6 Gbps. That’s about 373 and 750 megabytes per second.
  • Firewire is rated at 3 Gbps (400) and 6 Gbps (800). That’s about 373 and 750 megabytes per second.
  • Thunderbolt is rated at 10 Gbps per channel (x2). Thunderbolt 2 raises that value to 20 Gbps over a single channel. Thunderbolt 3 doubles the bandwidth again to 40 Gbps.
  • Ethernet is rated at 100 Mbps

bit rates