Skip to content

Instantly share code, notes, and snippets.

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 Aug 29, 2015
批量修改后缀名
View modify-extension.md

change jpg to png

bat

ren *.jpg *png
@litefeel
litefeel / stringutil.php
Last active Aug 29, 2015
php string function
View stringutil.php
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 / python.py
Last active Oct 22, 2015
python 脚本
View python.py
#!/usr/bin/python
# coding=utf-8
import os.path
import sys
import shutil
"""
getpath.py [path]
命令行所在目录
@litefeel
litefeel / appstore.mm
Last active Aug 29, 2015
app store 更新链接
View appstore.mm
- (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
设置快捷方式
View shortcut.vbs
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
shell 脚本 添加cron
View addcron.sh
#!/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
View changeip.bat
:: 设置静态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
@litefeel
litefeel / urlencode.cpp
Last active Jul 1, 2020
c++ urlencode
View urlencode.cpp
// http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/package.html#encodeURIComponent()
void hexchar(unsigned char c, unsigned char &hex1, unsigned char &hex2)
{
hex1 = c / 16;
hex2 = c % 16;
hex1 += hex1 <= 9 ? '0' : 'a' - 10;
hex2 += hex2 <= 9 ? '0' : 'a' - 10;
View zip.py
#!/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 Aug 29, 2015
masker by blendFunc
View masker.cpp
// 使用混合做遮罩
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);
You can’t perform that action at this time.