Skip to content

Instantly share code, notes, and snippets.

@lingyfh
lingyfh / desc.text
Created August 18, 2017 01:41
intellij idea break
进入ide主页面,help-register-license server,然后输入 http://idea.iteblog.com/key.PHP(注意:php要小写)即可~
@lingyfh
lingyfh / SwipeBackDelegate.txt
Created August 7, 2017 07:06
ios navigationController 右滑返回
self.navigationController.interactivePopGestureRecognizer.delegate = self;
@lingyfh
lingyfh / main.py
Created July 28, 2017 07:10
体感温度计算方法;Feels like temperature numerical computation method
# -*- coding:utf-8 -*-
# from https://www.weather.gov/epz/wxcalc_heatindex
import math
# 体感温度计算方法
# param F Fahrenheit
# param rh relative humidity
def parseHumanTemp(F, rh):
Hindex = -42.379 + 2.04901523 * F + 10.14333127 * rh - 0.22475541 * F * rh - 6.83783 * math.pow(10, -3) * F * F - 5.481717 * math.pow(10, -2) * rh * rh + 1.22874 * math.pow(10, -3) * F * F * rh + 8.5282 * math.pow(10, -4) * F * rh * rh - 1.99 * math.pow(10, -6) * F * F * rh * rh
@lingyfh
lingyfh / jarsigner
Created July 24, 2017 09:31
使用jarsigner重新签名apk无效问题, 增加-digestalg SHA1 -sigalg MD5withRSA参数
jarsigner -digestalg SHA1 -sigalg MD5withRSA -verbose -keystore yourkeysrotefile -signedjar output.apk input.apk alias
@lingyfh
lingyfh / recover_mongodb_data.py
Created December 17, 2016 10:22
恢复mongodb结构异常的数据,前提数据id还存在
# !/usr/bin/env python
# -*- coding: utf-8 -*-
import time
from pymongo import MongoClient
from pymongo import MongoReplicaSetClient
from pymongo.read_preferences import ReadPreference
DEFAULT_REPLSET = 'replset_name'
@lingyfh
lingyfh / sentinel.conf
Last active November 2, 2016 11:37
redis sentinel config
# Example sentinel.conf
# port <sentinel-port>
# The port that this sentinel instance will run on
port 26379
# sentinel announce-ip <ip>
# sentinel announce-port <port>
#
# The above two configuration directives are useful in environments where,
@lingyfh
lingyfh / redis_slave.conf
Created October 16, 2016 17:13
redis slave config
# Redis configuration file example
# Note on units: when memory size is needed, it is possible to specify
# it in the usual form of 1k 5GB 4M and so forth:
#
# 1k => 1000 bytes
# 1kb => 1024 bytes
# 1m => 1000000 bytes
# 1mb => 1024*1024 bytes
# 1g => 1000000000 bytes
@lingyfh
lingyfh / redis_master.conf
Created October 16, 2016 17:12
redis master config
# Redis configuration file example
# Note on units: when memory size is needed, it is possible to specify
# it in the usual form of 1k 5GB 4M and so forth:
#
# 1k => 1000 bytes
# 1kb => 1024 bytes
# 1m => 1000000 bytes
# 1mb => 1024*1024 bytes
# 1g => 1000000000 bytes
@lingyfh
lingyfh / Foreground.java
Created May 5, 2016 02:28 — forked from steveliles/Foreground.java
Class for detecting and eventing whether an Android app is currently foreground or background (requires API level 14+)
package com.sjl.util;
import android.app.Activity;
import android.app.Application;
import android.content.Context;
import android.os.Bundle;
import android.os.Handler;
import android.util.Log;
import java.util.List;
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="260dp"
android:descendantFocusability="blocksDescendants"
android:background="@color/WHITE">
<RelativeLayout
android:id="@+id/ad_top_layout"