Skip to content

Instantly share code, notes, and snippets.

@lhmwzy
lhmwzy / gist:8129067
Created December 26, 2013 02:38
testdb.lua for agentzh
local mysql = require "resty.mysql"
--local cjson = require "cjson"
local db = mysql:new()
db:set_timeout(300000) -- 1 sec
local ok, err, errno, sqlstate = db:connect({
host = "127.0.0.1",
port = "3306",
database = "tel",
user = "root",
DragonFly v4.4.0rc.10.g9ee45d-RELEASE #0: Thu Dec 3 21:07:55 CST 2015
lhm@:/usr/obj/usr/src/sys/fuhai
TSC clock: 3200003760 Hz, i8254 clock: 1193140 Hz
CPU: Intel(R) Pentium(R) 4 CPU 3.20GHz (3200.13-MHz K8-class CPU)
Origin = "GenuineIntel" Id = 0xf65 Stepping = 5
Features=0xbfebfbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CLFLUSH,DTS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE>
Features2=0xe59d<SSE3,DTES64,MON,DS_CPL,EST,TM2,CNXT-ID,CX16,xTPR,PDCM>
AMD Features=0x20100800<SYSCALL,NX,LM>
AMD Features2=0x1<LAHF>
real memory = 1037026304 (988 MB)
@lhmwzy
lhmwzy / gist:46bf22e9086bc42c1e75
Created January 18, 2016 12:38
my kernel config
machine_arch x86_64
cpu HAMMER_CPU
ident fuhai
maxusers 0
#options CPU_DISABLE_AVX
#makeoptions DEBUG=-g #Build kernel with gdb(1) debug symbols
options INET #InterNETworking
#options INET6 #IPv6 communications protocols
@lhmwzy
lhmwzy / gist:9e1bdb20c9c3a9e22938
Created January 19, 2016 00:24
smartctl -d sat -a /dev/da0 output
smartctl 6.4 2015-06-04 r4109 [DragonFly 4.4-RELEASE x86_64] (local build)
Copyright (C) 2002-15, Bruce Allen, Christian Franke, www.smartmontools.org
=== START OF INFORMATION SECTION ===
Model Family: Western Digital Caviar SE Serial ATA
Device Model: WDC WD800JD-75MSA3
Serial Number: WD-WMAM9NY02964
Firmware Version: 10.01E04
User Capacity: 80,000,000,000 bytes [80.0 GB]
Sector Size: 512 bytes logical/physical
@lhmwzy
lhmwzy / gist:484536a54b3fe4da74aabf5ebd3ed5db
Created February 17, 2019 12:21
mysql8 build error under DragonFlyBSD
[ 56%] Building CXX object sql/CMakeFiles/sql_gis.dir/geometry_rtree.cc.o
cd /usr/obj/dports/databases/mysql80-server/.build/sql && /usr/bin/c++ -DHAVE_CONFIG_H -DHAVE_LIBEVENT2 -DHAVE_OPENSSL -DMYSQL_SERVER -DRAPIDJSON_NO_SIZETYPEDEFINE -DUNISTR_FROM_CHAR_EXPLICIT=explicit -DUNISTR_FROM_STRING_EXPLICIT=explicit -D_USE_MATH_DEFINES -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/usr/obj/dports/databases/mysql80-server/.build -I/usr/obj/dports/databases/mysql80-server/.build/include -I/usr/obj/dports/databases/mysql80-server/mysql-8.0.13 -I/usr/obj/dports/databases/mysql80-server/mysql-8.0.13/include -I/usr/obj/dports/databases/mysql80-server/.build/libbinlogevents/include -I/usr/obj/dports/databases/mysql80-server/mysql-8.0.13/libbinlogevents/export -isystem /usr/local/include -isystem /usr/local/include/editline -isystem /usr/obj/dports/databases/mysql80-server/mysql-8.0.13/extra/rapidjson/include -I/usr/obj/dports/databases/mysql80-server/mysql-8.0.13/libbinlogevents/include -isystem /usr/obj/dports/datab
@lhmwzy
lhmwzy / go-os-arch.md
Created March 19, 2020 09:09 — forked from asukakenji/0-go-os-arch.md
Go (Golang) GOOS and GOARCH

Go (Golang) GOOS and GOARCH

All of the following information is based on go version go1.8.3 darwin/amd64.

A list of valid GOOS values

(Bold = supported by go out of the box, ie. without the help of a C compiler, etc.)

  • android
  • darwin
@lhmwzy
lhmwzy / dfly-install-hammer2.md
Created June 15, 2021 15:01 — forked from liweitianux/dfly-install-hammer2.md
DragonFly BSD Installation (MBR, HAMMER2 boot+root)

DragonFly BSD Installation

1. Create Disk Slice

Assume the disk is /dev/da8, to create a slice of about 100 GB.

dfly# cat > fdisk.conf << _EOF_
@lhmwzy
lhmwzy / waitForKeyElements.js
Created February 15, 2022 07:17 — forked from adamhotep/waitForKeyElements.js
A utility function, for userscripts including Greasemonkey, that detects and handles AJAXed content.
/*--- waitForKeyElements(): A utility function, for Greasemonkey scripts,
that detects and handles AJAXed content.
Original: https://gist.github.com/BrockA/2625891
Non-jQuery version by: Adam Katz,
https://gist.github.com/adamhotep/7c9068f2196326ab79145ae308b68f9e
License: CC BY-NC-SA 4.0 (*not* GPL-compatible)
changes made by Adam Katz (tracked by adamhotep's github gist) are
also licensed GPL v2+ (but note the CC BY-NC-SA prevents commercial use)
License via https://gist.github.com/BrockA/2625891#gistcomment-1617026
@lhmwzy
lhmwzy / move_semantics1.rs
Created January 11, 2023 12:07 — forked from totechite/move_semantics1.rs
My Rustlings answers
// move_semantics1.rs
// Make me compile! Scroll down for hints :)
pub fn main() {
let vec0 = Vec::new();
let mut vec1 = fill_vec(vec0);
println!("{} has length {} content `{:?}`", "vec1", vec1.len(), vec1);