Skip to content

Instantly share code, notes, and snippets.

Avatar
📱
Working

Yang Hui kyze8439690

📱
Working
View GitHub Profile
@wuyisheng
wuyisheng / FileDownloadUtil.java
Last active Mar 4, 2019
A HttpURLConnection download example for android
View FileDownloadUtil.java
package org.yeshen.download;
import android.os.Handler;
import android.os.HandlerThread;
import android.os.Looper;
import android.support.annotation.Nullable;
import android.support.annotation.UiThread;
import android.support.annotation.WorkerThread;
import android.util.Log;
@BurningAXE
BurningAXE / HtmlTextEditor
Last active Aug 8, 2021
An Android component that allows to show AND edit text in HTML format using a WebView
View HtmlTextEditor
import android.content.Context;
import android.util.AttributeSet;
import android.util.Xml;
import android.webkit.JavascriptInterface;
import android.webkit.WebView;
import android.webkit.WebViewClient;
public class HtmlTextEditor extends WebView {
class JsObject {
@n1lesh
n1lesh / LinearGradientDrawable.java
Last active Aug 28, 2020
Android Gradient Toolbar and Statusbar
View LinearGradientDrawable.java
RelativeLayout layout = (RelativeLayout) findViewById(R.id.rel);
GradientDrawable drawable = new GradientDrawable();
drawable.setColors(new int[] {
Color.parseColor("#FFF6B7"),
Color.parseColor("#F6416C")
});
drawable.setGradientType(GradientDrawable.LINEAR_GRADIENT);
drawable.setOrientation(GradientDrawable.Orientation.LEFT_RIGHT);
@jhansche
jhansche / watch-fds.sh
Created Oct 28, 2016
Simple script to monitor the number open file descriptors for an Android application.
View watch-fds.sh
#!/bin/sh
# Usage: ./watch-fds.sh <application_id> [delay_secs = 5]
APP_ID=${1:?missing application id}
DELAY=$(( ${2:-5} ))
DEVICE_LIMIT=$(( $(adb shell ulimit -n) ))
WARN_THRESHOLD=$(( ${DEVICE_LIMIT} / 3 ))
echo "Will warn at ${WARN_THRESHOLD}"
@fffaraz
fffaraz / dns.c
Created May 29, 2016
DNS Query Code in C with linux sockets
View dns.c
//DNS Query Program on Linux
//Author : Silver Moon (m00n.silv3r@gmail.com)
//Dated : 29/4/2009
//Header Files
#include<stdio.h> //printf
#include<string.h> //strlen
#include<stdlib.h> //malloc
#include<sys/socket.h> //you know what this is for
#include<arpa/inet.h> //inet_addr , inet_ntoa , ntohs etc
@harrane
harrane / RatingBarVectorFix.java
Created Apr 8, 2016
A temp fix for using vector drawable with RatingBar Raw
View RatingBarVectorFix.java
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapShader;
import android.graphics.Canvas;
import android.graphics.PorterDuff;
import android.graphics.Shader;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.ClipDrawable;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.LayerDrawable;
View crsync-基于rsync rolling算法的文件增量更新.md

最终实现效果:

  1. 无版本概念,任何本地文件均可增量升级到最新.服务器不用管理多版本
  2. 内存小,100M文件升级时只占用500KB内存.

使用流程:

  1. 制作新版本,上传HTTP File Server.
  2. Client自动计算差异,下载差异,合并差异.
  3. done!

#0.起源

@davemorrissey
davemorrissey / PicassoDecoder.java
Last active Dec 26, 2020 — forked from gokhanbarisaker/PicassoDecoder.java
Picasso decoder for subsampling-scale-image-view
View PicassoDecoder.java
/**
* Created by gokhanbarisaker on 8/30/15.
*/
public class PicassoDecoder implements ImageDecoder
{
private String tag;
private String picasso;
public PicassoDecoder(String tag, Picasso picasso) {
this.tag = tag;
@ftvs
ftvs / PhonecallReceiver.java
Last active Oct 15, 2021
Detecting an incoming call coming to an Android device. Remember to set the appropriate permissions in AndroidManifest.xml as suggested in the Stackoverflow link. Usage example in comments. Source: Gabe Sechan http://stackoverflow.com/a/15564021/264619 Explanation: http://gabesechansoftware.com/is-the-phone-ringing/#more-8
View PhonecallReceiver.java
package com.gabesechan.android.reusable.receivers;
import java.util.Date;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.telephony.TelephonyManager;
public abstract class PhonecallReceiver extends BroadcastReceiver {
@lopezjurip
lopezjurip / README.md
Last active Feb 11, 2020
Write to NTFS on OSX Yosemite and El Capitan
View README.md

OUTDATED, see comments below

Install Homebrew:

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Update Homebrew formulae:

brew update