Skip to content

Instantly share code, notes, and snippets.

View stonyw's full-sized avatar

Stony Wang stonyw

  • Tianrang
  • Shanghai, CN
View GitHub Profile
@stonyw
stonyw / .bumpversion.cfg
Created September 19, 2016 04:04
.bumpversion.cfg for custmized version format support
[bumpversion]
commit = True
tag = True
current_version = 0.1.0
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(\-(?P<release>[a-z]+))?
serialize =
{major}.{minor}.{patch}-{release}
{major}.{minor}.{patch}
[bumpversion:file:docker.build]
@stonyw
stonyw / sketch_apr04a.ino
Last active April 9, 2016 22:17
WiFi Web Server LED Blink
/*
WiFi Web Server LED Blink
A simple web server that lets you blink an LED via the web.
This sketch will print the IP address of your WiFi Shield (once connected)
to the Serial monitor. From there, you can open that address in a web browser
to turn on and off the LED on pin 9.
If the IP address of your shield is yourAddress:
http://yourAddress/H turns the LED on
http://yourAddress/L turns it off
This example is written for a network using WPA encryption. For
@stonyw
stonyw / canvas_clock.html
Last active March 9, 2016 00:11
A clock made by html canvas animation
<!DOCTYPE html>
<html>
<body>
<canvas id="myCanvas" width="400" height="400" style="border:1px solid #000000;">
Your browser does not support the HTML5 canvas tag.
</canvas>
<script>
window.requestAnimFrame = (function(callback) {
android.applicationVariants.all { variant ->
if (variant.getBuildType().name == "debug") {
task "configDevice${variant.name.capitalize()}" (type: Exec){
dependsOn variant.install
group = 'nameofyourtaskgroup'
description = 'Describe your task here.'
def adb = android.getAdbExe().toString()
def mypermission = 'android.permission.READ_ACCOUNTS'
#!/bin/sh
if [ "$#" -ne 1 ]; then
echo "Illegal number of parameters: " $@ ". Use xx_XX format instead."
exit
fi
IFS="_" arr=($1)
IFS=" "
if [ ${#arr[@]} -ne 2 ]; then
echo "Illegal number of parameters: " $@ ". Use xx_XX format instead."
exit
@stonyw
stonyw / .bash_profile
Last active June 15, 2016 08:38
My global git config file
# Git branch autocomplete
# curl https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash -o ~/shell/git-completion.bash
if [ -f ~/shell/git-completion.bash ]; then
. ~/shell/git-completion.bash
fi
# Show git branch
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
@stonyw
stonyw / ARCMacros.h
Created August 6, 2014 07:06
ARC Macros for both ARC and MRC
//
// ARCMacros.h
//
// Created by John Blanco on 1/28/2011.
// Rapture In Venice releases all rights to this code. Feel free use and/or copy it openly and freely!
//
#if !defined(__clang__) || __clang_major__ < 3
#ifndef __bridge
#define __bridge
26 abcdefghijklmnopqrstuvwxyz
26 ABCDEFGHIJKLMNOPQRSTUVWXYZ
10 0123456789
1lI -> 1
0O -> 0
26*2+10-(5-2)
int => key
@stonyw
stonyw / gist:5344689
Last active December 15, 2015 23:59
Install List for new Mac.
Homebrew
ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"
// Install ACK
brew install ack
// Install pip with pkg-config readline gdbm python sqlite
brew install python
@stonyw
stonyw / unused_images
Created April 9, 2013 08:06
The shell to find unused images in iOS project.
Shell for finding unused images in iOS project
Source:
http://stackoverflow.com/questions/6113243/how-to-find-unused-images-in-an-xcode-project
Version 1:
#!/bin/sh
PROJ=`find . -name '*.xib' -o -name '*.[mh]' -o -name '*.storyboard' -o -name '*.mm'`
for png in `find . -name '*.png'`