Skip to content

Instantly share code, notes, and snippets.

View rayworks's full-sized avatar
:atom:

rayworks rayworks

:atom:
  • Shanghai, China
  • 19:47 (UTC +08:00)
View GitHub Profile
@tibo
tibo / org.jenkins-ci.jenkins.plist
Created February 7, 2011 01:37
Jenkins Launchd configuration
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>UserName</key>
<string>jenkins</string>
<key>Label</key>
<string>org.jenkins-ci.jenkins</string>
<key>EnvironmentVariables</key>
<dict>
@icodeforlove
icodeforlove / mp4-chunk-test.js
Created September 18, 2012 22:57
Simple file server test for video
/*jshint node:true*/
var fs = require('fs'),
http = require('http'),
path = require('path'),
port = 1338,
dir = '.';
http.createServer(function (request, response) {
var filePath = path.join(dir, path.basename(request.url));
if (path.extname(request.url) !== '.mp4' || !fs.existsSync(filePath)) return throw404();
@arriolac
arriolac / TopCropImageView.java
Last active October 1, 2024 10:40
Custom Android ImageView for top-crop scaling of the contained drawable.
import android.annotation.TargetApi;
import android.content.Context;
import android.graphics.Matrix;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.util.AttributeSet;
import android.widget.ImageView;
/**
* Created by chris on 7/27/16.
@mpost
mpost / Entry.java
Created September 18, 2013 11:50
Android application demonstrating the usage of ViewOverlay and OnPreDrawListener to achieve animations effects.
package com.example.overlay;
public class Entry {
private final int imageResId;
private final String title;
public Entry( int imageResId, String title ) {
this.imageResId = imageResId;
@staltz
staltz / introrx.md
Last active November 17, 2024 01:08
The introduction to Reactive Programming you've been missing
@cyndibaby905
cyndibaby905 / build_ffmpeg_android
Created August 5, 2014 07:14
Build ffmpeg on OS X 10.9
此处主要参考 http://harryhsu.logdown.com/posts/198416-build-ffmpeg-on-mac-os-109
根据我的编译过程做了适当修改
1. Download NDK
https://developer.android.com/tools/sdk/ndk/index.html
我下载的版本是android-ndk-r10,不同的版本在下面的build脚中本需要修改的地方大致相同.
2. Download ffmpeg source code
下载 ffmpeg(http://www.ffmpeg.org/download.html)
推荐 git clone git://source.ffmpeg.org/ffmpeg.git ffmpeg
@eduardb
eduardb / CountingFileRequestBody.java
Last active May 26, 2023 00:07
Uploading a file with a progress displayed using OkHttp
public class CountingFileRequestBody extends RequestBody {
private static final int SEGMENT_SIZE = 2048; // okio.Segment.SIZE
private final File file;
private final ProgressListener listener;
private final String contentType;
public CountingFileRequestBody(File file, String contentType, ProgressListener listener) {
this.file = file;
@moondroid
moondroid / GrayScale.java
Created March 12, 2015 09:15
Transform Bitmap to grayscale
public static Bitmap toGrayScale(Bitmap bmpOriginal) {
int width, height;
height = bmpOriginal.getHeight();
width = bmpOriginal.getWidth();
Bitmap bmpGrayscale = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
Canvas c = new Canvas(bmpGrayscale);
Paint paint = new Paint();
ColorMatrix cm = new ColorMatrix();
@CMCDragonkai
CMCDragonkai / http_streaming.md
Last active October 24, 2024 17:43
HTTP Streaming (or Chunked vs Store & Forward)

HTTP Streaming (or Chunked vs Store & Forward)

The standard way of understanding the HTTP protocol is via the request reply pattern. Each HTTP transaction consists of a finitely bounded HTTP request and a finitely bounded HTTP response.

However it's also possible for both parts of an HTTP 1.1 transaction to stream their possibly infinitely bounded data. The advantages is that the sender can send data that is beyond the sender's memory limit, and the receiver can act on

@renshuki
renshuki / ubuntu_agnoster_install.md
Last active October 23, 2024 13:16
Ubuntu 16.04 + Terminator + Oh My ZSH with Agnoster Theme

Install Terminator (shell)

sudo add-apt-repository ppa:gnome-terminator
sudo apt-get update
sudo apt-get install terminator

Terminator should be setup as default now. Restart your terminal (shortcut: "Ctrl+Alt+T").

Install ZSH