Skip to content

Instantly share code, notes, and snippets.

@gistsobo
gistsobo / gist:4443187
Created January 3, 2013 12:43
Python: Toplevel script check
if __name__ == '__main__':
main()
@gistsobo
gistsobo / log.conf
Created January 10, 2013 12:49
Python: json logger config
{
"version": 1,
"formatters":
{
"simple":
{
"format": "%(asctime)s - %(name)s - %(levelname)s - %(message)s"
},
"brief":
{
@gistsobo
gistsobo / gist:4501855
Created January 10, 2013 12:55
Python: Configure logging with json config
import json
import logging
import logging.config
config = json.load(open('logging.cfg', 'r'))
logging.config.dictConfig(config)
@gistsobo
gistsobo / gist:4690396
Created February 1, 2013 09:44
Cmd: Import visual studio 10 environment
"%VS100COMNTOOLS%\vsvars32.bat"
@gistsobo
gistsobo / cblock.sublime-snippet
Created March 1, 2013 09:59
Create block comment for using include and forward declarations
<snippet>
<content><![CDATA[
//------------------------------------------------------------------------------
// ${1:u}${1/(u)|(i)|(f)|.*/(?1:sing)(?2:nclude)(?3:orward declaration)/}s
//------------------------------------------------------------------------------
${3}
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>cblock</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
@gistsobo
gistsobo / gtestcase.sublime-snippet
Created March 1, 2013 10:00
create googletest testcase
<snippet>
<content><![CDATA[
TEST${1}${1/(_)|.*/(?1:F)/}(${2:SuiteName}, ${3:TestName})
{
// Setup
${4}
// Execute
// Verify
@gistsobo
gistsobo / vxworks.sublime-build
Created March 1, 2013 10:01
sublime build for vxworks
{
"cmd": ["make", "--no-print-directory", "BUILD_SPEC=SIMPENTIUMgnu_SMP", "DEBUG_MODE=1", "TRACE=1"],
"working_dir" : "${project_path:${folder}}/xxx/SIMPENTIUMgnu_SMP",
"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
"selector": "source.c++",
"variants": [
{
"name": "vxworks: Build xxxTests(sim)",
@gistsobo
gistsobo / gist:5696333
Created June 3, 2013 06:01
CPP: std hello world
#include <iostream>
using namespace std;
int main(int argc, char* argv[])
{
cout << "Hello world!" << endl;
return 0;
}