Skip to content

Instantly share code, notes, and snippets.

@aeesky
aeesky / googlehost2.py
Created December 31, 2014 03:03
update hosts from 360kb.com
#!/usr/bin/env python
# -*- coding:utf-8 -*-
"""
Describe: 自动更新host文件,用xpath处理网页内容
Anthor: Aeesky
Version: 0.0.1
Date: 2014-12-04
Languag: Python2.7.8
Editor: Sublime Text3
@aeesky
aeesky / archiving bak file
Created December 30, 2014 01:52
archiving all bak files in current directory and delete the source bak file
@echo off
for /f "delims=" %%a in ('dir /b/s/a-d *.bak') do (
cd /d "D:\Program Files\WinRAR"
echo archiving ... time /t
winrar A -ep -ibak -df %%a.rar %%a
)
pause
import subprocess
from ConfigParser import SafeConfigParser
from StringIO import StringIO
def GetPorts(filename):
f = file(filename);
scp2 = SafeConfigParser()
f.seek(0)
scp2.readfp(f)
sections = scp2.sections()
import os
for root, dirs, files in os.walk('E:\CodeZone', topdown=False):
for name in files:
if name =='svn-git.log':
log = os.path.join(root, name)
print 'deleted ',log
os.remove(log)
# for name in dirs:
# os.rmdir(os.path.join(root, name))
import os
import subprocess
# git remote -v
def giturl(dir):
os.chdir(dir)
cmd = "git remote -v"
p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
url = p.stdout.readlines()[0].split(' ')[0]
return str(url).rstrip()
@aeesky
aeesky / HtmlAgility
Created June 26, 2014 02:10
HtmlAgility
public Encoding GetEncoding(string CharacterSet)
{
switch (CharacterSet)
{
case "gb2312": return Encoding.GetEncoding("gb2312");
case "utf-8": return Encoding.UTF8;
default: return Encoding.Default;
}
}
@aeesky
aeesky / RunCSharp
Created June 14, 2013 08:40
RunCSharp
@ECHO OFF
cd %~dp1
ECHO Compiling %~nx1.......
IF EXIST %~n1.exe (
DEL %~n1.exe
)
csc %~nx1
IF EXIST %~n1.exe (
ECHO -----------OUTPUT-----------
start %~n1
@aeesky
aeesky / hello world
Created June 14, 2013 08:29
C# demo
using System;
class test
{
public static void Main(string[] args)
{
Console.WriteLine("test");
}
}
@aeesky
aeesky / c#.sublime-build
Created June 14, 2013 07:43
sublime c# build
{
"cmd": ["RunCSharp.bat", "$file"],
"file_regex": "^(...*?):([0-9]*):?([0-9]*)",
"selector": "source.cs",
"encoding": "cp936"
}