Skip to content

Instantly share code, notes, and snippets.

@ssfang
ssfang / getcharIfNeeded.cpp
Last active May 19, 2016 14:41
union test
#include <stdio.h>
#include <stdint.h>
// getcharIfNeeded();
#ifdef _MSC_VER
# include <io.h>
# define ISATTY _isatty(_fileno(stdout))
#if _WIN32_WINNT < 0x0500
#undef _WIN32_WINNT
#define _WIN32_WINNT 0x0500
@ssfang
ssfang / PathFindBaseName.c
Created April 23, 2016 01:40
PathFindBaseName
#include <stdio.h>
#include <stdio.h>
// #include <iostream>
// using namespace std;
#ifndef _T
#define _T(S) (S)
#endif
@ssfang
ssfang / CPP.sublime-build.txt.json
Last active April 24, 2016 06:47
Notepad++ NppExec Example
{
//http://docs.sublimetext.info/en/latest/reference/build_systems.html
//"name": "Complie",
"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
"cmd": "C:\\Cygwin\\bin\\g++.exe ${file} -o $file_path\\\\$file_base_name.exe",
"working_dir": "${file_path}",
"selector": "source.c, source.c++, source.cpp",
"encoding": "UTF-8",
@ssfang
ssfang / ps1.md
Created April 22, 2016 14:52
PowerShell on Windows
  • Powershell脚本的扩展名为“.ps1”

一个获取文件列表并修改文件时间属性的用法:

<#
文件:touch.ps1
用途:用于修改已存在文件时间属性的功能脚本
创建:2016-02-22,ss
修改:2016-02-22,ss
@ssfang
ssfang / CDataAlignment.java
Last active January 7, 2022 00:08
Data Structure Alignment
public class CDataAlignment {
public static void main(String[] args) throws java.lang.Exception {
System.out.println(Struct.aligned(1, 1));
structCharShortDoubleIntTest(1, false);
structCharShortDoubleIntTest(2, false);
structCharShortDoubleIntTest(4, false);
structCharShortDoubleIntTest(8, false);
structCharShortDoubleIntTest(16, false);
structCharShortDoubleIntTest(32, false);
@ssfang
ssfang / shell_parameter_manipulation.md
Last active April 15, 2016 05:41
Shell Parameter Manipulation
@ssfang
ssfang / PropagatingShellFunctions.md
Created April 14, 2016 09:47
Propagating Shell Functions

The export [4] command makes available variables to all child processes of the running script or shell. One important use of the export command is in startup files, to initialize and make accessible environmental variables to subsequent user processes.

Caution Unfortunately, there is no way to export variables back to the parent process, to the process that called or invoked the script or shell.

@ssfang
ssfang / calling_conversion.c
Created April 13, 2016 09:14
calling conversion
#include <stdio.h>
#if (_MSC_VER < 1300) || !defined(_MSC_VER)
typedef signed char i8_t;
typedef signed short i16_t;
typedef signed int i32_t;
typedef unsigned char u8_t;
typedef unsigned short u16_t;
typedef unsigned int u32_t;
@ssfang
ssfang / How_CDT_GCC_Build_Ouput_Parser_Works.md
Last active April 11, 2016 03:20
What's CDT GCC Build Ouput Parser
root@desktop:~# gcc --help
Usage: gcc [options] file...
Options:
  -pass-exit-codes         Exit with highest error code from a phase
  --help                   Display this information
  --target-help            Display target specific command line options
  --help={target|optimizers|warnings|params|[^]{joined|separate|undocumented}}[,...]
                           Display specific types of command line options
@ssfang
ssfang / !ReadMe.md
Last active December 25, 2017 08:32
cygwin vs mingw gcc and jni
  • Local Reference And Local Frame

[IBM: Overview of JNI object references][1] [JNI Local Reference Changes in ICS][2]

  • NewObjectA
extern "C" {