This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
import datetime | |
date_string = '2013-03-07' | |
date = datetime.datetime.strptime(date_string, '%Y-%m-%d') | |
time.mktime(date.timetuple()) | |
==> 1362582000.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.content.Context; | |
import android.os.AsyncTask; | |
import android.os.Bundle; | |
/** | |
* Use this class when you provide logics for background execution. | |
* | |
* Implement your code in onAsyncTaskExecute(). | |
* | |
* If you have to reuse your code, define a dedicated task class using BDAsyncTaskSkeleton class. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@SuppressLint("NewApi") | |
@SuppressWarnings("unchecked") | |
public static void executeTaskInParallel(@SuppressWarnings("rawtypes") AsyncTask task, Bundle params) { | |
if (MyUtil.hasHoneycomb()) { | |
task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, params); | |
} else { | |
task.execute(params); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
iex> 1 # integer | |
iex> 0x1F # integer | |
iex> 1.0 # float | |
iex> :atom # atom / symbol | |
iex> {1,2,3} # tuple |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// #38 | |
package main | |
import "code.google.com/p/go-tour/pic" | |
func Pic(dx, dy int) [][]uint8 { | |
board := make([][]uint8, dx) | |
for i := 0; i < dx; i++ { | |
board[i] = make([]uint8, dy) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import logging | |
logger = logging.getLogger(__name__) | |
logger.setLevel(logging.INFO) | |
# create a file handler | |
handler = logging.FileHandler('hello.log') | |
handler.setLevel(logging.INFO) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import re | |
regex = re.compile(r"(.*)(GLOG[A-Z]*\([A-Z]+::[A-Z_]+\s*,\s*)(__FUNCTION__)\s*(\")([^\"]+\")(\s*,\s*.*){0,1}(\s*\)\s*;){0,1}") | |
def test_code(): | |
s=[] | |
s.append(' GLOGNOFLA(LOGLEVEL::LL_DEBUG, __FUNCTION__ " toSign [%s]");') | |
s.append(' GLOGNOFLA(LOGLEVEL::LL_DEBUG, __FUNCTION__ " toSign [%s]", toSign.c_str());') | |
s.append('GLOGNOFLA(LOGLEVEL::LL_ERROR, __FUNCTION__ " failed(%s) : %s", rtn.curlerror.c_str(), curl->GetLastURL().c_str());') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ brew install $(brew deps owncloud-client) | |
Warning: cmake-3.3.1 already installed | |
Warning: pkg-config-0.28 already installed | |
==> Downloading https://homebrew.bintray.com/bottles/d-bus-1.8.20.yosemite.bottle.tar.gz | |
######################################################################## 100.0% | |
==> Pouring d-bus-1.8.20.yosemite.bottle.tar.gz | |
==> /usr/local/Cellar/d-bus/1.8.20/bin/dbus-uuidgen --ensure=/usr/local/var/lib/dbus/machine-id | |
==> Caveats | |
To have launchd start d-bus at login: | |
ln -sfv /usr/local/opt/d-bus/*.plist ~/Library/LaunchAgents |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ cmake --help-policy CMP0042 | |
CMP0042 | |
------- | |
``MACOSX_RPATH`` is enabled by default. | |
CMake 2.8.12 and newer has support for using ``@rpath`` in a target's install | |
name. This was enabled by setting the target property | |
``MACOSX_RPATH``. The ``@rpath`` in an install name is a more | |
flexible and powerful mechanism than ``@executable_path`` or ``@loader_path`` |