Skip to content

Instantly share code, notes, and snippets.

set keep-english-in-normal
set keep-english-in-normal-and-restore-in-insert
set showmode
set showcmd
set number " line numbers
set hlsearch " highlight search occurrences
set ignorecase " ignore case in search patterns
set smartcase " no ignore case when pattern is uppercase
set incsearch " show search results while typing

The process about Microsoft Office Document.md

Description of the way that Excel saves files

Applies to: Microsoft Office Excel 2003, Microsoft Office Excel 2007, Excel 2010. From: MS.

Summary

This article describes how Microsoft Excel saves files.

More Information

When you save an existing file in Excel, Excel creates a temporary file in the destination folder that you specify in the Save As dialog box. The temporary file contains the whole contents of your workbook. If Excel successfully saves the temporary file, the temporary file is renamed with the file name you specify in the Save As dialog box.

@Leaking
Leaking / FragmentArgumentDelegate.kt
Created July 28, 2018 07:09 — forked from yanngx/FragmentArgumentDelegate.kt
Fragment arguments without hassle !
package be.brol
import android.os.Binder
import android.os.Bundle
import android.support.v4.app.BundleCompat
import android.support.v4.app.Fragment
/**
* Eases the Fragment.newInstance ceremony by marking the fragment's args with this delegate
* Just write the property in newInstance and read it like any other property after the fragment has been created
@Leaking
Leaking / gist:8e0ac94aeb80800c2376f39010eac41d
Created April 10, 2018 03:25
Get excel picture dimension using apache poi
/**
* 获取图片大小
*/
public static Dimension getDimensionFromAnchor(Picture picture) {
ClientAnchor anchor = picture.getClientAnchor();
boolean isHSSF = (anchor instanceof HSSFClientAnchor);
Sheet sheet = picture.getSheet();
double w = 0;
int col2 = anchor.getCol1();
@Leaking
Leaking / gist:e15760ff075cd5a1cbe993d6c6b9299b
Created December 4, 2017 09:45
getTrustManagerFromSSLSocketFactory
// 18(samsung) 19 (oppo) sslSocketFactory -- sslParameters -- trustManager
// 22(oppo) 24(hw) 27(nexus) sslSocketFactory -- sslParameters -- x509TrustManager
public TrustManager getTrustManagerFromSSLSocketFactory(SSLSocketFactory sslSocketFactory) {
try {
TrustManager result = null;
Field fieldSslPm = sslSocketFactory.getClass().getDeclaredField("sslParameters");
fieldSslPm.setAccessible(true);
Object objSSLParameters = fieldSslPm.get(sslSocketFactory);
if(Build.VERSION.SDK_INT > 19) {
Field fieldTmg = objSSLParameters.getClass().getDeclaredField("x509TrustManager");
@Leaking
Leaking / find TrustManager From SSLContext
Created December 3, 2017 12:38
find TrustManager From SSLContext
private X509TrustManager findTrustManagerFromSocketFactory(SSLContext mCtx) {
try {
//SSLContext --> contextSpi(OpenSSLContextImpl) --> sslParameters(SSLParametersImpl) --> x509TrustManager(X509TrustManager)
// find OpenSSLContextImpl
Field contextSpiField = mCtx.getClass().getDeclaredField("contextSpi");
contextSpiField.setAccessible(true);
Object openSSLContextImplObj = contextSpiField.get(mCtx);
// find SSLParametersImpl
@Leaking
Leaking / record.sh
Created August 17, 2016 12:50
Bash script to take screen-record on android and export to for Mac Desktop
#! /bin/bash
adb shell screenrecord --time-limit 12 /sdcard/demo.mp4
dir=~/Desktop/
curr=`date "+%Y-%m-%d %H:%M:%S"`
name=${dir}"screenrecord"${curr}".mp4"
echo "${name}"
adb pull /sdcard/demo.mp4 "$name"
adb shell rm /sdcard/demo.mp4
@Leaking
Leaking / screenshot.sh
Last active July 2, 2019 03:58
Bash script to take screenshot on android and export to for Mac Desktop
#! /bin/bash
adb shell screencap -p /sdcard/test.png
#adb pull /sdcard/test.png ~/Desktop/test.png
dir=~/Desktop/
curr=`date "+%Y-%m-%d %H:%M:%S"`
name=${dir}"screenshot"${curr}".png"
echo "${name}"
adb pull /sdcard/test.png "$name"
adb shell rm /sdcard/test.png
XMPPTCPConnectionConfiguration config = XMPPTCPConnectionConfiguration.builder()
//.setUsernameAndPassword("peter", "123456")
.setServiceName("quinndemacbook-pro.local")
.setDebuggerEnabled(true)
.setSecurityMode(ConnectionConfiguration.SecurityMode.disabled)
.setHost("10.180.145.92")
.setPort(5222)
.build();
conn = new XMPPTCPConnection(config);
new Thread(new Runnable() {
@Leaking
Leaking / Sort Algorithm
Created April 6, 2015 05:21
Sort Algorithm
/**
* 冒泡排序
*
* @param a
*/
public static void bubbleSort(int[] a) {
int temp;
for (int i = 0; i < a.length; i++)
for (int j = 0; j < a.length - i - 1; j++) {