Skip to content

Instantly share code, notes, and snippets.

@DoumanAsh
DoumanAsh / custom_hook.rs
Created September 29, 2016 20:33
Custom hook example
macro_rules! format_payload {
($payload:expr, $($p_type:ty),+) => {{
$(
if let Some(result) = $payload.downcast_ref::<$p_type>() {
format!("{}", result)
}
)else+
else {
format!("{:?}", $payload)
}
This file has been truncated, but you can view the full file.
Dr. Memory version 1.11.0 build 2 built on Aug 29 2016 02:41:18
Dr. Memory results for pid 3236: "PicoTorrent.exe"
Application cmdline: "E:\Soft\Main\PicoTorrent\PicoTorrent.exe"
Recorded 115 suppression(s) from default E:\Soft\Develop\DrMemory-Windows\bin64\suppress-default.txt
Error #1: INVALID HEAP ARGUMENT: allocated with operator new, freed with operator delete[]
# 0 replace_operator_delete_array_nothrow [d:\drmemory_package\common\alloc_replace.c:2998]
# 1 ntdll.dll!RtlDosPathNameToRelativeNtPathName_U_WithStatus +0x35a (0x00007ffc9eb25bdb <ntdll.dll+0x25bdb>)
# 2 ntdll.dll!RtlDeactivateActivationContextUnsafeFast +0xc6 (0x00007ffc9eb23c47 <ntdll.dll+0x23c47>)
# 3 _Init_thread_header [f:\dd\vctools\crt\vcstartup\src\misc\thread_safe_statics.cpp:174]
@DoumanAsh
DoumanAsh / test.rs
Created January 31, 2017 08:04
Socket into/from/as
let family: c_int = 2;
let ty: c_int = 1;
let proto: c_int = 6;
let raw_socket;
{
let socket = Socket::new(family, ty, proto).unwrap();
raw_socket = socket.into_raw_socket();
}
@DoumanAsh
DoumanAsh / koa-lazy-static.js
Last active March 16, 2017 16:35
koa2 static file service middleware
const fs = require('fs');
const path = require('path');
function is_stat_error_bad(error) {
switch (error.code) {
case 'ENOENT':
case 'ENAMETOOLONG':
case 'ENOTDIR':
return false;
@DoumanAsh
DoumanAsh / test.js
Created April 15, 2017 06:09
Show fs.stat & fs.statSync diff
"use strict";
const fs = require('fs');
console.log(fs.statSync(__filename));
fs.stat(__filename, (err, stats) => {
console.log(stats);
});
Relational Database Design and Implementation: Clearly Explained
@DoumanAsh
DoumanAsh / log.txt
Created June 23, 2017 08:39
sequelize test
DEBUG [2017-06-23T08:39:07.039Z] (Kok/3660 on maxgolon): Executing (default): CREATE TABLE IF NOT EXISTS `clients` (`id` INTEGER PRIMARY KEY AUTOINCREMENT, `login` VARCHAR(20) NOT NULL UNIQUE, `password` VARCHAR(20) NOT NULL, `name` TEXT NOT NULL, `address` TEXT NOT NULL, `email` TEXT NOT NULL, `materials_version` INTEGER, `prices_version` INTEGER, `createdAt` DATETIME NOT NULL, `updatedAt` DATETIME NOT NULL, UNIQUE (`login`));
DEBUG [2017-06-23T08:39:07.100Z] (Kok/3660 on maxgolon): <--- GET /api/1/clients
host: "127.0.0.1:50546"
accept-encoding: "gzip, deflate"
user-agent: "node-superagent/3.5.2"
connection: "close"
DEBUG [2017-06-23T08:39:07.115Z] (Kok/3660 on maxgolon): Executing (default): SELECT `id`, `login`, `password`, `name`, `address`, `email`, `materials_version`, `prices_version` FROM `clients` AS `clients`;
DEBUG [2017-06-23T08:39:07.123Z] (Kok/3660 on maxgolon): Executing (default): PRAGMA INDEX_LIST(`clients`)
DEBUG [2017-06-23T08:39:07.128Z] (Kok/3660 on maxgolon): Executing (
@DoumanAsh
DoumanAsh / test.js
Created June 23, 2017 12:45
Example of getting raw data from rows with many-to-many associations
const Sequelize = require('sequelize')
const username = "user"
const password = "pass"
const dialect = 'sqlite'
const sequelize = new Sequelize('test', username, password, {
dialect,
pool: {
error: linking with `link.exe` failed: exit code: 1112
|
= note: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Tools\\MSVC\\14.10.25017\\bin\\HostX86\\x86\\link.exe" "/NOLOGO" "/NXCOMPAT" "/LIBPATH:D:\\soft\\Development\\rustup\\rustup_home\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib" "D:\\repos\\rust-code\\sengoku-hime-7-text-clean\\target\\release\\build\\kernel32-sys-a3481bceebd54ed9\\build_script_build-a3481bceebd54ed9.0.o" "/OUT:D:\\repos\\rust-code\\sengoku-hime-7-text-clean\\target\\release\\build\\kernel32-sys-a3481bceebd54ed9\\build_script_build-a3481bceebd54ed9.exe" "/OPT:REF,ICF" "/DEBUG" "/LIBPATH:D:\\repos\\rust-code\\sengoku-hime-7-text-clean\\target\\release\\deps" "/LIBPATH:D:\\soft\\Development\\rustup\\rustup_home\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib" "D:\\repos\\rust-code\\sengoku-hime-7-text-clean\\target\\release\\deps\\libbuild-5e2814596a138818.rlib" "D:\\soft\\Develop
> dumpbin /exports .\twitter.dll
Microsoft (R) COFF/PE Dumper Version 14.10.25019.0
Copyright (C) Microsoft Corporation. All rights reserved.
Dump of file .\twitter.dll
File Type: DLL
Section contains the following exports for twitter.dll