Skip to content

Instantly share code, notes, and snippets.

View qiyuangong's full-sized avatar

Qiyuan Gong qiyuangong

View GitHub Profile

DDNS_DNSPOD

###功能 基于DNSPOD (www.dnspod.com)的动态域名解析脚本:

适用于有域名在手,并且托管到dnspod的童鞋。

###原理 基于dnspod提供的api,提交信息。 如果IP地址没有改变,则不处理;如果改变了则提交新的IP地址。

@qiyuangong
qiyuangong / merge_excel.py
Last active October 12, 2016 14:37
merge excel with xlrd and xlwt
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import pdb
import os
from xlrd import open_workbook
from xlwt import Workbook
# from xlwt import
if __name__ == '__main__':
@qiyuangong
qiyuangong / rename_nature_with_fixed_size
Created October 12, 2016 14:37
Rename nature numbered files with fixed size number
import os
def rename_nature_with_fixed_size(size=3, sep='_'):
files = [f for f in os.listdir('.') if os.path.isfile(f)]
for f in files:
if sep in f and f[0] != sep:
new_name = f.split(sep)
if len(new_name[0]) < size:
new_name[0] = '0' * (size - len(new_name[0])) + new_name[0]
os.rename(f, sep.join(new_name))
@qiyuangong
qiyuangong / plot_matlab.m
Created November 16, 2016 09:35
plot in matlab
figure1 = figure('Color',[1 1 1]);
axes1 = axes('Parent',figure1,'YTick',[0:1:10],...
'XTick',[10:10:40],...
'GridLineStyle','--','FontSize', 15);
box(axes1,'on');
%grid(axes1,'on');
hold(axes1,'all');
X = 10:10:40
plot(X, multitest(:, 1),'s-','Color',[1 0 1] ,'LineWidth',2.5, 'DisplayName','adult-7');
@qiyuangong
qiyuangong / UDAction.java
Last active May 27, 2017 13:32
Temp UDAction.java
package org.smartdata.server.actions;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hdfs.DFSClient;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.smartdata.common.actions.ActionType;
import java.util.UUID;
@qiyuangong
qiyuangong / imagenet_preprocessing.py
Created April 12, 2019 07:53
ImageNet Resized image and crop to 224*224
import os
import cv2
import argparse
_RESIZE_MIN = 256
def resize_image(image):
height, width, _ = image.shape