Skip to content

Instantly share code, notes, and snippets.

public class CustomZoomableImageView extends ImageView {
private Paint borderPaint = null;
private Paint backgroundPaint = null;
private float mPosX = 0f;
private float mPosY = 0f;
private float mLastTouchX;
private float mLastTouchY;
private static final int INVALID_POINTER_ID = -1;
@Nathaniel100
Nathaniel100 / styles.xml
Created November 8, 2016 07:01
Dialog styles
<resources>
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="alertDialogTheme">@style/Theme.Dialog.Alert</item>
</style>
</resources>
@Nathaniel100
Nathaniel100 / Steam Dota2
Created November 3, 2016 13:13
Steam Dota2 启动选项
-fullscreen -language schinese -novid -international -high -perfectworld
@Nathaniel100
Nathaniel100 / toRSAPublicKey.c
Created October 26, 2016 05:36
convert Modulus and Exponent to RSA PublicKey
#include <string.h>
#include <openssl/rsa.h>
#include <openssl/evp.h>
#include <openssl/bn.h>
#include <openssl/pem.h>
// cheating, .. ignoring deprecation warnings
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
unsigned char *base64_decode(const char* base64data, int* len) {
@Nathaniel100
Nathaniel100 / EasyPermissions.md
Created October 18, 2016 15:36
Simplify basic system permissions logic when targeting Android M or higher.

EasyPermissions [![Build Status][1]][2]

EasyPermissions is a wrapper library to simplify basic system permissions logic when targeting Android M or higher.

Installation

EasyPermissions is installed by adding the following dependency to your build.gradle file:

#!/bin/bash
# Copyright 2014, The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
@Nathaniel100
Nathaniel100 / externalNativeBuild.gradle
Created September 8, 2016 07:27
Building C++ in Android Studio
externalNativeBuild{
cmake{
path "CMakeLists.txt"
}
}
defaultConfig {
externalNativeBuild {
cmake {
targets "target1", "target2"
@Nathaniel100
Nathaniel100 / openssl.md
Created September 6, 2016 01:30
Generate PKCS10 request

Generate a new private key and Certificate Signing Request

openssl req -out CSR.csr -new -newkey rsa:2048 -nodes -keyout privateKey.key

Generate a certificate signing request (CSR) for an existing private key

openssl req -out CSR.csr -key privateKey.key -new
#include <string>
#include <sys/ptrace.h>
#include <unistd.h>
#include <stdlib.h>
#include <chrono>
#include <thread>
#include "log.h"
void be_attached_check()
{
@Nathaniel100
Nathaniel100 / TouchInterceptActivity.java
Created August 18, 2016 14:29
ViewPager as listview header view
public class TouchInterceptActivity extends Activity implements ViewPager.OnPageChangeListener {
private ViewPager mViewPager;
private ListView mListView;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.touch_intercept);
mViewPager = new ViewPager(this);