Skip to content

Instantly share code, notes, and snippets.

View myfreeer's full-sized avatar
💭
I may be slow to respond.

myfreeer

💭
I may be slow to respond.
View GitHub Profile
@myfreeer
myfreeer / MyUnsafeFactory.java
Last active March 17, 2019 10:36
java Unsafe api with docs, DO NOT use this in production
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.util.Arrays;
import java.util.Map;
import java.util.Objects;
@SuppressWarnings({"WeakerAccess", "unused"})
public class MyUnsafeFactory {
#include <windows.h>
/**
* GetModulePathW
* 获取当前程序可执行文件所在路径
* @param {WCHAR *} pDirBuf - destination buffer
* @param {DWORD} bufSize - size of buffer
* @return {DWORD} length of module path, 0 for failure
*/
DWORD WINAPI GetModulePathW(WCHAR *pDirBuf, DWORD bufSize) {
WCHAR *szEnd = NULL;
@myfreeer
myfreeer / build-curl.sh
Last active September 24, 2018 06:32
size-sensitive curl build script for msys2 mingw
#!/bin/bash
# workaround for static zlib
test -e /mingw64/lib/libz.dll.a && mv -f /mingw64/lib/libz.dll.a /mingw64/lib/_libz.dll.a
test -e /mingw32/lib/libz.dll.a && mv -f /mingw32/lib/libz.dll.a /mingw32/lib/_libz.dll.a
set -e
# git clone https://github.com/curl/curl --depth=1 && cd curl
CURL_VER='7.61.1'
# CURL_VER="$(curl -s --retry 10 --retry-connrefused --retry-delay 1 'https://curl.haxx.se/docs/releases.csv' | cut -f2 -d';' | sort -ruV | head -1)"
wget -c https://curl.haxx.se/download/curl-${CURL_VER}.tar.xz
tar xf curl-${CURL_VER}.tar.xz
@myfreeer
myfreeer / rtlversion.h
Created August 10, 2018 06:51
header for RtlGetVersion, RtlVerifyVersionInfo, and RtlGetNtVersionNumbers in user mode
// Compiles with -lntdll
#pragma once
#ifndef __RTL_VERSION_H__
#define __RTL_VERSION_H__
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#include <windows.h>
#ifdef _MSC_VER
// not tested yet
@myfreeer
myfreeer / copy.js
Last active August 26, 2018 08:07
Copy text to clipboard
'use strict';
/**
* Copy text to clipboard
* @param {string | Element} text
* @return {boolean}
*/
const copy = (text = '') => {
if (text instanceof Function)
text = text();
@myfreeer
myfreeer / brainFuck.js
Last active July 17, 2018 09:14
Brainfuck interpreter in js
const brainFuckInput = () => {
const input = prompt('输入一个字符或不输入。\n若输入多个字符,只有输入的第一个字符有效。');
if (input) return input.codePointAt();
else return 0;
};
const brainFuckOutput = (value) => {
console.info(String.fromCodePoint(value));
};
## 下载路径
### 可用值: /path/to/directory
#dir=
## 日志文件
### 日志文件的路径. 如果设置为 "-", 日志则写入到 stdout. 如果设置为空字符串(""), 日志将不会记录到磁盘上.
### 可用值: /path/to/file, -
#log=
## 最大同时下载数
# Packages
*.gz
*.bz2
*.xz
*.7z
*.tar
# Source folders
nginx/*
openssl-*/*
@myfreeer
myfreeer / areaSel.js
Created May 10, 2018 06:20
省市区三级联动选项
const areaSel = (()=>{
const data = JSON.parse('{"北京市":{"id":110000,"child":{"市辖区":{"id":110100,"child":{"东城区":110101,"西城区":110102,"朝阳区":110105,"丰台区":110106,"石景山区":110107,"海淀区":110108,"门头沟区":110109,"房山区":110111,"通州区":110112,"顺义区":110113,"昌平区":110114,"大兴区":110115,"怀柔区":110116,"平谷区":110117,"密云区":110118,"延庆区":110119}}}},"天津市":{"id":120000,"child":{"市辖区":{"id":120100,"child":{"和平区":120101,"河东区":120102,"河西区":120103,"南开区":120104,"河北区":120105,"红桥区":120106,"东丽区":120110,"西青区":120111,"津南区":120112,"北辰区":120113,"武清区":120114,"宝坻区":120115,"滨海新区":120116,"宁河区":120117,"静海区":120118,"蓟州区":120119}}}},"河北省":{"id":130000,"child":{"石家庄市":{"id":130100,"child":{"市辖区":130101,"长安区":130102,"桥西区":130104,"新华区":130105,"井陉矿区":130107,"裕华区":130108,"藁城区":130109,"鹿泉区":130110,"栾城区":130111,"井陉县":130121,"正定县":130123,"行唐县":130125,"灵寿县":130126,"高邑县":130127,"深泽县":130128,"赞皇县":130129,"无极县":130130,"平山县":130131,"元氏县":130132,"赵县":130133,"晋州市":130183,"新乐市":130184}},"唐山市":{"id":130200,"child":{"市辖区":130201,"路南区":130202,"路北区":130203,"古冶区":130204,"开平区":1
diff --git a/Makefile b/Makefile
index 5da7705..0803537 100644
--- a/Makefile
+++ b/Makefile
@@ -230,7 +230,7 @@ indexes:
./index2autolinker.py index-functions-c.xml output/indexes/autolink-c
./index2autolinker.py index-functions-cpp.xml output/indexes/autolink-cpp
-#redownloads the source documentation directly from en.cppreference.com
+#redownloads the source documentation directly from zh.cppreference.com