Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@wakasann
wakasann / token_transfer_smart_contract
Created August 3, 2023 05:23
token transfer smart contract
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.14;
import {IERC20} from "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/IERC20.sol";
contract MyUsdtTransfer{
mapping(string => uint) public orders; //orderNo => orderType
drop procedure if exists add_all_timestamp;
CREATE PROCEDURE add_all_timestamp()
BEGIN
DECLARE tableName varchar(30) default '';
DECLARE allAddr varchar(40) default '';
DECLARE tableSchemaName varchar(30) default 'test';
DECLARE done INT DEFAULT 0;
DECLARE curl CURSOR FOR select table_name from information_schema.tables where table_schema=tableSchemaName;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1;
OPEN curl;
@wakasann
wakasann / laravel_admin_helpers.php
Created January 7, 2019 11:06
try run laravel admin ^1.6 in subfolder
<?php
// var_dump(function_exists('admin_url'));
if (!function_exists('admin_url')) {
/**
* Get admin url.
*
* @param string $path
* @param mixed $parameters
* @param bool $secure
*
@wakasann
wakasann / functions.php
Created December 25, 2018 10:34 — forked from lmartins/functions.php
By default WooCommerce redirects the user to the My Account page after a successful login. You may change this and use a custom URL based on the user role, like the Dashboard for admins and My Account page for customers. To do this, add this code at the end of the file functions.php located in wp-content/themes/your-theme-name/ https://support.w…
<?php
/**
* Redirect users to custom URL based on their role after login
*
* @param string $redirect
* @param object $user
* @return string
*/
function wc_custom_user_redirect( $redirect, $user ) {
// Get the first of all the roles assigned to the user
@wakasann
wakasann / lopencv431.cpp
Created June 20, 2018 13:39
学习opencv3变成第4章
#include <opencv2/opencv.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
using namespace std;
using namespace cv;
#define WINDOW_WIDTH 600 //定义窗口大小的宏
#define WINDOW_NAME1 "【绘制图1】" // 为窗口标题定义的宏
@wakasann
wakasann / lopencv33.cpp
Last active June 19, 2018 14:51
鼠标点击开始绘制,弹起之后停止绘制
#include <opencv2/opencv.hpp>
using namespace std;
using namespace cv;
#define WINDOW_NAME "【程序窗口】"
void on_MouseHandle(int event, int x, int y, int flags, void* param);
void DrawRectangle(cv::Mat& img,cv::Rect box);
void ShowHelpText();
@wakasann
wakasann / lopencv16.cpp
Created June 19, 2018 14:49
opencv播放视频
#include <opencv2/opencv.hpp>
using namespace std;
using namespace cv;
int main()
{
//打开视频文件
VideoCapture capture(0); //"1.mp4"
@wakasann
wakasann / lcv321.cpp
Created June 19, 2018 14:47
线性混合示例
#include <opencv2./opencv.hpp>
#include "opencv2/highgui/highgui.hpp"
using namespace std;
using namespace cv;
#define WINDOW_NAME "【线性混合示例】" //为窗口标题定义的宏
const int g_nMaxAlphaValue = 100; //Alpha 值的最大值
int g_nAlphaValueSlider; //滑动条对应的变量
@wakasann
wakasann / phpconnectmqttserver.php
Created June 8, 2018 03:29
use php-amqplib connect to mqttserver
<?php
//php connection to mqtt server(rabbitmq)
//use https://packagist.org/packages/php-amqplib/php-amqplib
define('AMQP_DEBUG', true);
require_once __DIR__.'/vendor/autoload.php';
use PhpAmqpLib\Connection\AMQPStreamConnection;
use PhpAmqpLib\Message\AMQPMessage;
$exchange = 'fanout2';
$queue = 'test';
<?php
function p($array){
echo "<pre>";
print_r($array);
echo "</pre>";
}
$array = array();
for($i = 0;$i < 5;$i++){