Skip to content

Instantly share code, notes, and snippets.

View litefeel's full-sized avatar
🎯
I may be slow to respond.

litefeel litefeel

🎯
I may be slow to respond.
View GitHub Profile
@litefeel
litefeel / modify-extension.md
Last active August 29, 2015 14:15
批量修改后缀名

change jpg to png

bat

ren *.jpg *png
@litefeel
litefeel / stringutil.php
Last active August 29, 2015 14:15
php string function
function start_with($main_str, $str) {
return substr_compare($main_str, $str, 0, strlen($str)) === 0;
}
function end_with($main_str, $str) {
return substr_compare($main_str, $str, -1, strlen($str)) === 0;
}
@litefeel
litefeel / appstore.mm
Last active August 29, 2015 14:21
app store 更新链接
- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification {
// open app store link
NSString * url = [NSString stringWithFormat:@"itms-apps://itunes.apple.com/app/id%@", APP_STORE_ID];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:url]];
}
// APP INFO URL: http://itunes.apple.com/lookup?id=APP_STORE_ID
@litefeel
litefeel / shortcut.vbs
Created May 18, 2015 16:05
设置快捷方式
Option Explicit
Dim wshShell, shortcut
Dim lnkpath, targetpath
' 生成的快捷方式文件路径, 必须是.lnk结尾
lnkpath = WScript.Arguments(0)
' 目标文件路径
targetpath = WScript.Arguments(1)
@litefeel
litefeel / addcron.sh
Created May 18, 2015 17:16
shell 脚本 添加cron
#!/bin/bash
# put old cron to file
crontab -l > tmpcron.txt
s=`crontab -l | grep '/root/dropbox.py start'`
# echo "$s"x
if [[ -z "$s" ]]; then
echo "00 04 * * * /root/dropbox.py start" >> tmpcron.txt
:: 设置静态ip 192.168.1.246 子网掩码255.255.255.0 网关 192.168.1.1
netsh interface ip set address 本地连接 static 192.168.1.246 255.255.255.0 192.168.1.1 1
:: 设置动态ip
netsh interface ip set address 本地连接 dhcp
#!/usr/bin/python
# coding=utf-8
import os, os.path
import gzip, zipfile
print zipfile.is_zipfile("test.zip")
f = zipfile.ZipFile("test.zip")
@litefeel
litefeel / masker.cpp
Last active August 29, 2015 14:23
masker by blendFunc
// 使用混合做遮罩
CCSize size = m_pMask->getContentSize();
CCRenderTexture *renderTexture = CCRenderTexture::create(size.width, size.height);
// 设置默认颜色
renderTexture->setClearColor(ccc4f(0, 0, 0, 0));
// 设置清除颜色标记,否则autoDraw时不能清除颜色
renderTexture->setClearFlags(GL_COLOR_BUFFER_BIT);
ccBlendFunc func = { GL_ZERO, GL_SRC_ALPHA };
m_pMask->setBlendFunc(func);
@litefeel
litefeel / python.py
Last active October 22, 2015 07:35
python 脚本
#!/usr/bin/python
# coding=utf-8
import os.path
import sys
import shutil
"""
getpath.py [path]
命令行所在目录
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.4'
}
}
apply plugin: 'android'