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 errors | |
import ( | |
"fmt" | |
"reflect" | |
"strconv" | |
) | |
type CodedError struct { | |
code int64 // 错误码 |
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
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean) | |
Dim lngres As Long | |
'检查邮件是否添加附件 | |
If InStr(1, Item.Body, "附件") <> 0 Then | |
If Item.Attachments.Count = 0 Then | |
Application.Explorers(1).Activate | |
lngres = MsgBox("邮件内容中包含“附件”,但没有上传附件!" & Chr(10) & "仍然发送?", _ | |
vbYesNo + vbDefaultButton2 + vbQuestion, "提示") | |
If lngres = vbNo Then |
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
<?php | |
/* Try http://mutouxiaogui.cn/blog/list_server_variable.php?v1=1&v2=2 in your browser */ | |
$indicesServer = array('PHP_SELF', | |
'argv', | |
'argc', | |
'GATEWAY_INTERFACE', | |
'SERVER_ADDR', | |
'SERVER_NAME', | |
'SERVER_SOFTWARE', | |
'SERVER_PROTOCOL', |
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
<?php | |
/* Try http://mutouxiaogui.cn/blog/list_server_variable.php?v1=1&v2=2 in your browser */ | |
$indicesServer = array('PHP_SELF', | |
'argv', | |
'argc', | |
'GATEWAY_INTERFACE', | |
'SERVER_ADDR', | |
'SERVER_NAME', | |
'SERVER_SOFTWARE', | |
'SERVER_PROTOCOL', |
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
<?php | |
/* redirect mutouxiaogui.cn/blog to stay-stupid.com, the parameters remain unchanged */ | |
/* notify search engines that a page has been permanently moved to another location */ | |
header('Status: 301 Moved Permanently', false, 301); | |
/* redirect to another page */ | |
$redirect_url = 'http://stay-stupid.com/'.basename($_SERVER['REQUEST_URI']); | |
header('Location: '.$redirect_url); | |
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
/* | |
* Demo of libpq epoll. | |
* Build: g++ libpq-epoll.cpp -o libpq-epoll -lpq | |
* Run: ./libpq-epoll | |
*/ | |
#include <arpa/inet.h> | |
#include <cstdlib> | |
#include <cstring> | |
#include <errno.h> |
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
/* | |
* Demo of gflags | |
* Build: g++ test-gflags.cc -o test-gfalgs -lgflags | |
* // ERROR: illegal value '-1' specified for uint64 flag 'u64' | |
* ./test-gflags.out --b=false --i32=-1 --i64=1 --u64=-1 --d=10.01 -s="string value" | |
* // ERROR: failed validation of new value '11' for flag 'i32' | |
* ./test-gflags.out --b=false --i32=11 --i64=1 --u64=1 --d=10.01 -s="string value" | |
* ./test-gflags.out --b=false --i32=1 --i64=1 --u64=1 --d=10.01 extraa extrab extrac | |
* | |
* Refer to gflags.h for more detail help message of structs and function. |
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
/* | |
* Demo of glog. | |
* Build: g++ test-glog.cc -o test-glog.out -lglog | |
* Run: export GLOG_log_dir=/path/to/logdir && ./test-glog | |
*/ | |
#include <glog/logging.h> | |
int main(int argc, char* argv[]) { | |
google::InitGoogleLogging(argv[0]); |
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
// concurrent-queue.h | |
#ifndef CONCURRENT_QUEUE_H_ | |
#define CONCURRENT_QUEUE_H_ | |
#include <queue> | |
#include <thread> | |
#include <mutex> | |
#include <condition_variable> | |
template <typename T> |
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
#!/bin/bash | |
# Demo of check list using whiptail | |
whiptail --title "Check list example" --checklist \ | |
"Choose user's permissions" 20 78 4 \ | |
"NET_OUTBOUND" "Allow connections to other hosts" ON \ | |
"NET_INBOUND" "Allow connections from other hosts" OFF \ | |
"LOCAL_MOUNT" "Allow mounting of local devices" OFF \ | |
"REMOTE_MOUNT" "Allow mounting of remote devices" OFF |
NewerOlder