Skip to content

Instantly share code, notes, and snippets.

Avatar

Qiyuan Gong qiyuangong

View GitHub Profile
@qiyuangong
qiyuangong / rename_nature_with_fixed_size
Created Oct 12, 2016
Rename nature numbered files with fixed size number
View rename_nature_with_fixed_size
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 / merge_excel.py
Last active Oct 12, 2016
merge excel with xlrd and xlwt
View merge_excel.py
#!/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__':
View plot_matlab.m
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
Temp UDAction.java
View 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 Apr 12, 2019
ImageNet Resized image and crop to 224*224
View imagenet_preprocessing.py
import os
import cv2
import argparse
_RESIZE_MIN = 256
def resize_image(image):
height, width, _ = image.shape
View ddns_dnspod.md

DDNS_DNSPOD

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

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

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

You can’t perform that action at this time.