Skip to content

Instantly share code, notes, and snippets.

View navono's full-sized avatar
:octocat:
I may be slow to respond.

Darkness navono

:octocat:
I may be slow to respond.
View GitHub Profile
@navono
navono / hmac.java
Created October 5, 2020 02:54
HMAC in 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 / Makefile-x64.msc
Created November 2, 2020 05:25
sqlcipher: Windows x64 version of Makefile
#
# 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 November 2, 2020 05:24
sqlcipher: Windows x86 version of Makefile
#
# 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 / arm64-on-Win10.md
Created December 14, 2020 04:58 — forked from billti/arm64-on-Win10.md
ARM64 Linux on Win10

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 / offsets_adapter_sqlite3.go
Last active February 5, 2021 11:20
watermill sqlite3
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 / schema_adapter_sqlite3.go
Created February 5, 2021 11:21
watermill sqlite3
package main
import (
stdSQL "database/sql"
"encoding/json"
"fmt"
"strings"
"github.com/pkg/errors"
@navono
navono / proto.js
Created July 6, 2021 09:06
compile proto file with 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');
@navono
navono / CMakeLists.txt
Created July 7, 2021 07:42
CMake include Windows SDK path
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 / .bashrc
Created September 30, 2021 01:59
.bashrc for WSL2
# CUSTOM MIRRORS
export HOST_IP=$(grep -oP '(?<=nameserver\ ).*' /etc/resolv.conf)
export PORXY_ADDR="http://$HOST_IP:1080"
# PROXY FOR APT
function proxy_apt() {
# make sure apt.conf existed
sudo touch /etc/apt/apt.conf
sudo sed -i '/^Acquire::https\?::Proxy/d' /etc/apt/apt.conf
@navono
navono / mouse.py
Last active October 14, 2021 06:07
检测鼠标点击
# This is a sample Python script.
# Press Shift+F10 to execute it or replace it with your code.
# Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings.
from pynput import mouse
from psutil import *
import time
from datetime import datetime
class mouseTimer(object):