Skip to content

Instantly share code, notes, and snippets.

View luxinyan's full-sized avatar

Lu Xinyan luxinyan

  • Shanghai, China
View GitHub Profile
NSString *myString = @"1233 12313";
[myString stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]
@luxinyan
luxinyan / Increase_Build_Number.sh
Last active August 29, 2015 14:04
Xcode Increase Build Number
buildNumber=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "${PROJECT_DIR}/${INFOPLIST_FILE}")
buildNumber=$(($buildNumber + 1))
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildNumber" "${PROJECT_DIR}/${INFOPLIST_FILE}"
#!/usr/bin/env python
# -*- coding:utf-8 -*-
#author:rikugun
import sys
import urllib
import os
from shutil import copyfile
@luxinyan
luxinyan / reportlab_barcode.py
Created April 23, 2014 07:14
Generate barcode with reportlab.
from reportlab.pdfgen import canvas
from reportlab.lib.pagesizes import A4
from reportlab.lib.units import mm
#I"ll be generating code39 barcodes, others are available
from reportlab.graphics.barcode import code39
# generate a canvas (A4 in this case, size doesn"t really matter)
c=canvas.Canvas("barcode_example.pdf",pagesize=A4)
# create a barcode object
# (is not displayed yet)
@luxinyan
luxinyan / generate_pdf_by_reportlab.py
Created April 23, 2014 03:54
python generate pdf with reportlab.
'''
This is a simple code for generate pdf with reportlab.
More information:http://www.reportlab.com/software/opensource/rl-toolkit/faq/
'''
from reportlab.pdfgen import canvas
from reportlab.lib.units import cm
my_pdf = canvas.Canvas("hello.pdf")
my_pdf.drawString(9*cm, 22*cm, "Hello World!")
my_pdf.showPage()
my_pdf.save()
@luxinyan
luxinyan / get_pic.py
Created April 22, 2014 15:21
This is a simple web crawler to get image from jandan.net
import re
import urllib2
import urllib
import sys
import time
#get html of page
def getHtml(url):
page = urllib2.urlopen(url)
html = page.read()