Skip to content

Instantly share code, notes, and snippets.

@ssfang
ssfang / ndk-path.sh
Last active August 26, 2022 00:44
Get NDKPath
#!/bin/bash --posix
# Avoid an error about function xx() statement on some os, e.g. on ubuntu, Syntax error: "(" unexpected
# http://ubuntuforums.org/archive/index.php/t-499045.html
#filename: ndk-path.sh
###############################################
# . ./ndk-path.sh -tla 4.9 9 mips > result.txt
###############################################
@ssfang
ssfang / NtQueryInformationProcess.cpp
Last active January 23, 2020 11:51
Get N level parent process id
//#include <stdio.h>
#include <io.h>
#include <fcntl.h>
//#include <windows.h>
//typedef LONG (__stdcall *FPTR_NtQueryInformationProcess) (HANDLE, INT, PVOID, ULONG, PULONG);
//FPTR_NtQueryInformationProcess NtQueryInformationProcess;
// Retrieve function address from DLL
//NtQueryInformationProcess = (FPTR_NtQueryInformationProcess) GetProcAddress(GetModuleHandle("ntdll"), "NtQueryInformationProcess");
//if (NtQueryInformationProcess == NULL) {
@ssfang
ssfang / trick.md
Last active April 6, 2016 10:58
EclipseExternalTools

JAVA_HOME=D:\ProgramFiles\Java\jdk1.8.0_40

External Tools – External Tools Configurations

  • Location: ${env_var:JAVA_HOME}/bin/javah.exe

  • Working Directoy: ${container_loc}

  • Arguments: ${string_prompt}

  • container_loc Returns the absolute file system path of a resource's container. The target resource is the selected resource when no argument is specified, or the resource identified by a workspace relative path.

  • string_prompt Returns the text value entered into a prompt dialog. When one argument is provided, it is used as a prompt hint on the input dialog. When a second argument is provided, it is used as an initial value in the input dialog. The first and second arguments must be separated with a ':'.

@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" {
@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 / 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 / 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 / shell_parameter_manipulation.md
Last active April 15, 2016 05:41
Shell Parameter Manipulation
@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 / ps1.md
Created April 22, 2016 14:52
PowerShell on Windows
  • Powershell脚本的扩展名为“.ps1”

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

<#
文件:touch.ps1
用途:用于修改已存在文件时间属性的功能脚本
创建:2016-02-22,ss
修改:2016-02-22,ss