This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const sqlQuery = ({sql, connection}) => { | |
return new Promise((resolve, reject) => { | |
connection.query(sql, (err, result) => { | |
if (err) { | |
reject(err); | |
} | |
resolve(result); | |
}) | |
}) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for i in `ls`; do | |
mv $i `echo $i | sed 's/from/to/'` | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const crypto = require('crypto'); | |
const sha256 = (str) => { | |
const hash = crypto.createHash('sha256'); | |
return hash.update(str, "utf-8").digest("hex"); | |
} | |
const md5 = (str) => { | |
const hash = crypto.createHash('md5'); | |
return hash.update(str, "utf-8").digest("hex"); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
project(lua C) | |
cmake_minimum_required(VERSION 3.16) | |
set(src_code | |
src/lapi.c src/lcode.c src/lctype.c src/ldebug.c src/ldo.c src/ldump.c src/lfunc.c src/lgc.c src/llex.c | |
src/lmem.c src/lobject.c src/lopcodes.c src/lparser.c src/lstate.c src/lstring.c src/ltable.c src/ltm.c | |
src/lundump.c src/lvm.c src/lzio.c) | |
set(src_lib | |
src/lauxlib.c src/lbaselib.c src/lcorolib.c src/ldblib.c src/liolib.c src/lmathlib.c src/loadlib.c | |
src/loslib.c src/lstrlib.c src/ltablib.c src/lutf8lib.c src/linit.c) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
{ | |
"compilerOptions": { | |
///////////////////////////////////////////////////////////////////////////////////////////////////////// | |
/* 项目 */ | |
"incremental": true, /* 启用增量编译 */ | |
/* 语言和环境 */ | |
"target": "es2016", /* 设置 JavaScript 语言版本 */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; Segment Descriptor | |
; | |
; |------------------------------------------------------|----------------------------------------| | |
; | 63 56 | 55 52 | 51 48 | 47 40 | 39 32 | | |
; | Base (24~31) | Flags (3~0) | Limit (19~16) | Access Byte (7~0) | Base (23~16) | | |
; |------------------------------------------------------|----------------------------------------| | |
; | 31 16 | 15 0 | | |
; | Base (0~15) | Limit (0~15) | | |
; |------------------------------------------------------|----------------------------------------| | |
; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define offset_of(type, member) ((size_t) &((type *)0)->member) | |
#define container_of(ptr, type, member) ({ \ | |
const typeof( ((type *)0)->member ) *__mptr = (ptr); \ | |
(type *)( (char *)__mptr - offset_of(type, member) );}) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import kotlinx.coroutines.runBlocking | |
import kotlinx.serialization.SerialName | |
import kotlinx.serialization.Serializable | |
import kotlinx.serialization.decodeFromString | |
import kotlinx.serialization.json.Json | |
private val json = Json { | |
classDiscriminator = "myType" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package host.skyone.native | |
import kotlinx.cinterop.* | |
import platform.posix.* | |
fun main() { | |
val file = "test.txt" | |
val contentSize = nativeHeap.alloc<stat>().apply { stat(file, this.ptr) }.st_size | |
val buffer = ByteArray(contentSize) | |
val fp = open(file, O_RDONLY) |
OlderNewer