Skip to content

Instantly share code, notes, and snippets.

Avatar
:octocat:
I may be slow to respond.

Darkness navono

:octocat:
I may be slow to respond.
View GitHub Profile
@navono
navono / CMakeLists.txt
Created Jul 7, 2021
CMake include Windows SDK path
View CMakeLists.txt
include(FindWindowsSDK)
if (NOT WINDOWSSDK_FOUND)
message("Windows SDK not found")
endif()
get_windowssdk_include_dirs(${WINDOWSSDK_LATEST_DIR} WINDOWSSDK_INCLUDE_DIRS)
# message(${WINDOWSSDK_INCLUDE_DIRS})
target_include_directories(${TARGET} INTERFACE ${WINDOWSSDK_INCLUDE_DIRS})
set_target_properties(${TARGET} PROPERTIES LINK_FLAGS "/SUBSYSTEM:CONSOLE /SAFESEH:NO")
@navono
navono / proto.js
Created Jul 6, 2021
compile proto file with js
View proto.js
const path = require('path');
const fs = require('fs');
const shell = require('shelljs');
const rimraf = require('rimraf');
// https://github.com/shelljs/shelljs/issues/469
process.env.PATH += (path.delimiter + path.join(process.cwd(), 'node_modules', '.bin'));
const PROTO_DIR = path.join(__dirname, '../proto');
const OUT_DIR = path.join(__dirname, '../src/proto');
View schema_adapter_sqlite3.go
package main
import (
stdSQL "database/sql"
"encoding/json"
"fmt"
"strings"
"github.com/pkg/errors"
View offsets_adapter_sqlite3.go
package main
import "fmt"
type DefaultSQLite3OffsetsAdapter struct {
// GenerateMessagesOffsetsTableName may be used to override how the messages/offsets table name is generated.
GenerateMessagesOffsetsTableName func(topic string) string
}
func (a DefaultSQLite3OffsetsAdapter) SchemaInitializingQueries(topic string) []string {
@navono
navono / arm64-on-Win10.md
Created Dec 14, 2020 — forked from billti/arm64-on-Win10.md
ARM64 Linux on Win10
View arm64-on-Win10.md

Below are the steps to get an ARM64 version of Ubuntu running in the QEMU emulator on Windows 10.

Install QEMU

Install for Windows from https://qemu.weilnetz.de/w64/ (I used qemu-w64-setup-20181211.exe)

Put C:\Program Files\qemu on your PATH, and run the below to check it's working (which will list out the CPUs the AArch64 emulator can emulate):

qemu-system-aarch64 -M virt -cpu help
@navono
navono / Makefile-x64.msc
Created Nov 2, 2020
sqlcipher: Windows x64 version of Makefile
View Makefile-x64.msc
#
# nmake Makefile for SQLite
#
###############################################################################
############################## START OF OPTIONS ###############################
###############################################################################
# The toplevel directory of the source tree. This is the directory
# that contains this "Makefile.msc".
#
@navono
navono / Makefile.msc
Created Nov 2, 2020
sqlcipher: Windows x86 version of Makefile
View Makefile.msc
#
# nmake Makefile for SQLite
#
###############################################################################
############################## START OF OPTIONS ###############################
###############################################################################
# The toplevel directory of the source tree. This is the directory
# that contains this "Makefile.msc".
#
View hmac.java
package hello;
import javax.crypto.Mac;
import javax.crypto.spec.*;
public class HMAC {
public void hash() {
try {
String secret = "salt";// 加密使用的key
String message = "1";// 需要加密的字符串(本项目是 "{uuid}_{timestamp}" )
@navono
navono / env_bat
Created Sep 28, 2020
setup env with bat
View env_bat
@echo off
setlocal EnableDelayedExpansion
setlocal EnableExtensions
set dir=%~dp0
set ligGit2Path=%dir%third_party\libgit2
set pkgConfigPath=%dir%third_party\pkg-config
set zlibPath=%dir%third_party\zlib
set KEY_NAME="HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment"
@navono
navono / utf8-string
Created Sep 28, 2020
UTF8 - string in C++
View utf8-string
std::string ofDewarServer::string_To_UTF8(const std::string & str)
{
int nwLen = ::MultiByteToWideChar(CP_ACP, 0, str.c_str(), -1, NULL, 0);
wchar_t * pwBuf = new wchar_t[nwLen + 1];//一定要加1,不然会出现尾巴
ZeroMemory(pwBuf, nwLen * 2 + 2);
::MultiByteToWideChar(CP_ACP, 0, str.c_str(), str.length(), pwBuf, nwLen);
int nLen = ::WideCharToMultiByte(CP_UTF8, 0, pwBuf, -1, NULL, NULL, NULL, NULL);