Skip to content

Instantly share code, notes, and snippets.

View zhangyangjing's full-sized avatar

Yangjing Zhang zhangyangjing

View GitHub Profile
@zhangyangjing
zhangyangjing / gist:8414811
Created January 14, 2014 08:06
android utils
// 判断是否是中文
private boolean isChinese(char c) {
Character.UnicodeBlock ub = Character.UnicodeBlock.of(c);
if (ub == Character.UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS
|| ub == Character.UnicodeBlock.CJK_COMPATIBILITY_IDEOGRAPHS
|| ub == Character.UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS_EXTENSION_A
|| ub == Character.UnicodeBlock.GENERAL_PUNCTUATION
|| ub == Character.UnicodeBlock.CJK_SYMBOLS_AND_PUNCTUATION
|| ub == Character.UnicodeBlock.HALFWIDTH_AND_FULLWIDTH_FORMS) {
return true;
#!/usr/bin/python
# coding=utf-8
import smtplib
from email.mime.text import MIMEText
class Sms(object):
def __init__(self, mail_host, mail_user, mail_pswd):
self._mail_host = mail_host
@zhangyangjing
zhangyangjing / dtd.py
Last active August 29, 2015 14:03
dtd
#!/usr/bin/python
# -*- coding: utf-8 -*-
dt = ['3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 'G',
'H', 'J', 'K', 'L', 'M', 'N', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',
'X', 'Y']
td = {
'3': 0, '4': 1, '5': 2, '6': 3, '7': 4, '8': 5, '9': 6, 'A': 7, 'B': 8,
'C': 9, 'D': 10, 'E': 11, 'F': 12, 'G': 13, 'H': 14, 'J': 15, 'K': 16,
public class SingletonSample {
private static SingletonSample mInstance;
private SingletonSample() {
}
public static SingletonSample getInstance() {
if (null == mInstance) {
synchronized(SingletonSample.class) {
@zhangyangjing
zhangyangjing / loader.html
Last active April 14, 2022 00:50
html loader
<!DOCTYPE html>
<html>
<body>
<div style="height: 51px; width: 54px; margin: 0px auto; overflow: hidden; background-image: url(loader.png); background-repeat: no-repeat;">
<style type="text/css">.disqus-loader{animation:disqus-embed-spinner .7s infinite linear;-webkit-animation:disqus-embed-spinner .7s infinite linear}@keyframes disqus-embed-spinner{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}@-webkit-keyframes disqus-embed-spinner{0%{-webkit-transform:rotate(0deg)}100%{-webkit-transform:rotate(360deg)}}</style>
<div class="disqus-loader" style="width: 29px; height: 29px; margin: 11px 14px; transform-origin: 50% 50% 0px; background-image: url(loader.png); background-position: -54px 0px; background-repeat: no-repeat;"></div>
</div>
</body>
</html>
@zhangyangjing
zhangyangjing / bg-clouds.png
Last active April 14, 2022 00:50
cloud html
bg-clouds.png
@zhangyangjing
zhangyangjing / clear.sh
Created November 6, 2014 02:14
clear mac ._* bash shell
#!/bin/sh
#find . -name "._*" -exec rm {} \;
function clear() {
for file in `ls -A $1`
do
if [ -d $1/$file ]
then
@zhangyangjing
zhangyangjing / MainView.java
Last active August 29, 2015 06:27
extract points position from image
package com.example.zyj.myapplication;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Point;
import android.graphics.Rect;
@zhangyangjing
zhangyangjing / hn.py
Created February 4, 2016 07:30
hack news rss generator
"""
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
Installing collected packages: requests
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import re
import requests
from datetime import datetime