- 博客(39)
- 资源 (27)
- 收藏
- 关注
原创 golang 数组、切片用法
* declare.gopackage mainimport ( "fmt")type ElementHandler func (interface{})func slice_for_each(arr []interface{}, n int, fn ElementHandler) { for i := 0; i < n; i++ { fn(arr[i]) }...
2019-03-30 22:45:29 253
原创 shell tetris 终端俄罗斯方块
* tetris.sh#!/bin/bashaBox0_0=(0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0)aBox0_1=(0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0)aBox0_2=(0 0 0 0 0 0 0 0 0 0 0...
2019-03-27 14:45:56 463
转载 beyond compare 附beyond compare密钥被撤销解决方法
beyond compare简介Beyond Compare是一套由Scooter Software推出的共享软件,基本定价30美元。主要用途是对比两个文件夹或者文件,并将差异以颜色标示。但是,在中国你可以随便下载到破解版、绿色版。beyond compare是一款功能强大的文件对比软件。身为SEO,你也许没有用过,甚至没有听说过。这并不代表beyond compare在SEO领域不重要,...
2019-03-27 13:17:40 14852 5
原创 golang 3DES 加密
key, iv 自己随意设定为了让结果可正常打印输入显示,都经过base64处理* TripleDES.gopackage authimport ( "bytes" "crypto/cipher" "crypto/des" "encoding/base64")type TripleDES struct { key string iv string}...
2019-03-27 13:16:57 1803
原创 ubuntu 12.04 安装docker
# 安装软件sudo apt-get autoremove --purge dockersudo apt-get updatesudo apt-get install linux-image-generic-lts-trusty linux-headers-generic-lts-trustysudo apt-get install apt-transport-httpssudo ap...
2019-03-26 14:54:57 595 1
原创 php dos2unix
* LineProcessor.php<?php class LineProcessor { /** @var \SplFileObject */ private $file; /** @var int */ private $linum; /** @var callable */ protected $handler; ...
2019-03-25 09:46:59 381
原创 golang 调用 网易云 滑块验证码 demo
用法PHP示例主要代码 session_start(); $verifier = new NECaptchaVerifier(YIDUN_CAPTCHA_ID, new SecretPair(YIDUN_CAPTCHA_SECRET_ID, YIDUN_CAPTCHA_SECRET_KEY)); $validate = $_POST['NECaptchaValidate']; // 获得...
2019-03-24 23:02:48 3149 2
原创 golang 按key字母顺序遍历map
golang maphttps://ashitani.jp/golangtips/tips_map.html* range.gopackage mainimport ( "fmt" "crypto/md5" "math/rand" "sort" "time")type MapEntryHandler func (string, string)// func p...
2019-03-24 22:13:54 3056
原创 golang xorm 示例 返回临时变量的引用
golang xormhttp://www.xorm.io/docs/// var engine *xorm.Enginevar everyone []Userinfoerr := engine.Find(&everyone)golang 可以返回临时变量的引用, 不会panicxorm 数据库表 实体类定义实体类Entity中有 func (* Ent...
2019-03-23 15:57:15 1871
原创 curl 命令行使用 发送json 提交表单 上传文件 php curl post 测试注册
* curl POST JSONcurl "http://192.168.4.157:8060/v1/validate/getcode" -X POST -d '{"mobilenumber":"18771099612"}' -H "Content-Type:application/json" -v* curl POST Formcurl "http://192.168.4.157...
2019-03-20 11:43:48 930
原创 golang解析json文件
* gopher.json{ "name": "Gopher", "title": "programmer", "contact": { "home":"415.333.3333", "cell":"415.555.5555" }}* gopher.gopackage mainimport ( "encoding/json" "...
2019-03-20 10:37:31 4305
原创 centos 上安装nodejs v8.0.0
centos 上安装nodejs v8.0.0新建目录www下载nodejswget https://npm.taobao.org/mirrors/node/v8.0.0/node-v8.0.0-linux-x64.tar.xz解压tar -xvf node-v8.0.0-linux-x64.tar.xz测试是否安装成功进入解压目录下的bin目录,执行ls...
2019-03-20 09:32:11 229
原创 golang 年级转换入学年份
* map.txt '高三' => '03-2016', '高二' => '03-2017', '高一' => '03-2018', '初三' => '02-2016', '初二' => '02-2017', '初一' => '02-2018', '小六' => '01-2013', // 五四制的初中 '六年级'=&...
2019-03-19 09:53:37 770
原创 golang 实现js 数组 indexOf函数 根据元素找到数组下标
在数组中找到一个元素的下标,找不到返回-1在javascript中可以这样写:var a = ['a','b','c','d']console.log(a.indexOf('c')) // 2* index.goimport ( "fmt" "strings")type CompareFunc func(interface{}, interface{}) int...
2019-03-18 19:00:57 9494
原创 golang 解析xml文件
发送soap请求返回的xml* response.xml<?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://dmdelivery.com/...
2019-03-18 10:57:14 1478
原创 golang DP LCS 最长公共子序列的长度
https://medium.com/@codingfreak/top-50-dynamic-programming-practice-problems-4208fed71aa31. 暴力递归* LCS.gopackage mainimport ( "fmt")func LCSLength(x []byte, y []byte, m int, n int) int {...
2019-03-17 22:20:17 1248
原创 emacs golang 模式tab宽度设置为2
* ~/.emacs(add-hook 'go-mode-hook (lambda () (setq indent-tabs-mode 1) (setq tab-width 2)))在emacs中添加以上配置M-x eval-buffer重启emacshttps://emacs.stackexchang...
2019-03-17 21:53:51 941
原创 curl 发送soap请求 webservice
* soap.php<?php$ch = curl_init();$headers = [ // "Content-Type: application/json", // "Content-Type: application/x-www-form-urlencoded", "Content-Type: text/xml; charset=U...
2019-03-16 18:19:10 3234
原创 golang http post 查询短信平台余额, SMS短信接口
* mongate.goconst SMS_ASMX = "http://???.???.??:???:8016/MWGate/wmgw.asmx" // 梦网请求url前缀const SMS_HOST = "???.???.??.???:8016" // 梦网hostconst SMS_USERID = "JA????" // 梦网充值账号const SMS_PASSWO...
2019-03-16 14:07:12 587
原创 golang 日期相关的方法
* 时间戳转换格式字符串 time.Unix(1552699194, 0).Format("2006-01-02 15:04:05")2006-01-02 15:04:05 这个日期是固定的不能改!http://47.93.27.106:6060/pkg/time/#Time.Format* 当前时间戳 s time.Now().Unix()...
2019-03-16 09:21:00 265
原创 Golang RPC Thrift
进入 thrift_file 目录执行:$ thrift -out .. --gen go example.thrift,就会在 thrift_file 的同级目录下生成 golang 的包:example,其中 format_data-remote 是生成的测试代码可以不用特别关注。的源码,解压后进入:thrift-0.10.0/compiler/cpp 目录执行如下命令完成编译后。,下载完成后改名为:thrift.exe 并将其放入到系统环境变量下即可使用。还需要import "context"
2019-03-15 09:41:27 436 1
转载 golang 数据类型转换
总结了golang中字符串和各种int类型之间的相互转换方式:string转成int:int, err := strconv.Atoi(string)string转成int64:int64, err := strconv.ParseInt(string, 10, 64)int转成string:string := strconv.Itoa(int)int64转成string:...
2019-03-14 17:29:15 388
原创 Longest Palindromic Substring (Manchester)
https://leetcode.com/problems/longest-palindromic-substring/Given a strings, find the longest palindromic substring ins. You may assume that the maximum length ofsis 1000.Example 1:Input: "...
2019-03-13 23:07:03 257
原创 php reflection 反射 dump 对象, get_object_vars函数用法
调用thrift接口不能var_dump对象输出到 STDOUT, 只能往数据库或者log文件输出。function objDump($o) { $s = ""; $reflect = new ReflectionObject($o); $props = $reflect->getProperties(); foreach($props as $...
2019-03-13 17:25:22 297
原创 javascript URL参数转换为php数组
* Usage:Form Data =>View source* uri2assoc.jsvar fs = require("fs")function parse_uri(s) { return s.split('&').reduce(function(o, kvs) { var a = kvs.split('=') o[ a[0] ] = decode...
2019-03-13 10:58:37 431
原创 Mock.js 生成测试数据 MockValue.php
* Mock.jsfunction Mock() {}Mock.mobile_prefix = ["134", "135", "136", "137", "138", "139", "150", "151", "152", "157", "158", "159"
2019-03-12 15:48:55 668
原创 动态引入javascript
* Script.js/** * 动态引入javascript文件, * Usage: * function script_onload() { * alert(1); * } * var load_js = new Script(script_onload); * load_js.set("http://static.gongju.com/js/jquery-1.4....
2019-03-12 15:46:35 288
原创 启用daytime服务 xinet.d udp fsockopen
1. 安装xinetdcat /etc/services | grep "daytime"# for ubuntusudo apt-get install xinetd 如果是centos/red hatsudo yum install xinetd.x86_64centos默认普通用户不能用sudo:https://blog.csdn.net/fareast_mzh/a...
2019-03-12 09:11:58 414
原创 golang string byte[] slice 数组/字符串 相互转化 以及与javascript对比
* bytes.gopackage mainimport "fmt"func main() { // var str = "hello" str := "hello" // var a = str.split('').map(function(c) {return c.charCodeAt(0)}) data := []byte(str) fmt.Println(data)...
2019-03-11 17:27:42 1613
原创 emacs 中文显示 乱码??
emacs ~/.emacs;; set language environment(set-language-environment 'UTF-8)(set-locale-environment "UTF-8")添加这2行代码即可
2019-03-11 16:09:11 1731 1
原创 用minikube运行一个本地单节点Kubernetes集群
* 安装Minikubemac:curl -Lo minikube https://storage.googleapis.com/minikube/releases/v0.23.0/minikube-darwin-amd64linux:curl -Lo minikube https://storage.googleapis.com/minikube/releases/v0.23....
2019-03-10 15:39:36 673
原创 start docker daemon linux
ubuntu docker环境配置https://blog.csdn.net/fareast_mzh/article/details/88820445代码以及命令行下载git clone git://github.com/luksa/kubernetes-in-actionStart the Docker daemonStart manuallyOnce Docker is ...
2019-03-10 14:00:49 4901
原创 javascript实现简单的yield语义
* yield.jsfunction yield() { var i = 0, state = 0; return function() { var N = 10; switch (state) { case 0: for (; i < N; i++) { state = 1; return i; } break;...
2019-03-07 16:34:05 353
原创 javascript 生成随机手机号用于测试
* Mock.js// ================= BEGIN Mock.js ===================function Mock() {}Mock.mobile_prefix = ["134", "135", "136", "137", "138", "139", "150", "151", "152&
2019-03-07 10:05:25 1421
原创 golang 生成 6位随机 短信验证码 rand random
* getcode.gopackage mainimport ( "fmt" "math/rand" "strings" "time")func GenValidateCode(width int) string { numeric := [10]byte{0,1,2,3,4,5,6,7,8,9} r := len(numeric) rand.Seed(time.No...
2019-03-06 16:52:24 8558 3
原创 php assoc => golang map php关联数组转换go map
* php assoc private static $_GRADE_NAME_TO_ID = array( 'a' => '03-2016', 'b' => '03-2017', 'zxc' => '03-2018', 'd' => '02-2016', 'e' => '02...
2019-03-06 11:46:52 503
原创 php curl 登录接口测试 token写入token.txt 提取http header
* login.php<?phpfunction build_query($a) { $m = []; array_walk($a, function($item, $key) use (&$m) { $m[] = $key.'='.urlencode($item); }); return implode('&', $...
2019-03-05 16:04:23 2903
原创 gin orm 模板搬砖代码生成 字段批量赋值, 错误码switch case代码生成
* rows.php<?phpfunction fileForEachRow($path, $handler) { $handle = fopen($path, "r"); if (! $handle ) { return; } while (($buffer = fgets($handle, 1024) ) !== false) {...
2019-03-05 11:01:13 773
原创 php扩展开发
1. 下载php代码cd /Volumes/Applications/lnmp/srcwget http://am1.php.net/distributions/php-7.3.2.tar.bz2tar xvjf php-7.3.2.tar.bz2 -C .cd php-7.3.2mkdir -p /Volumes/Applications/lnmp/php/7.3.2./conf...
2019-03-03 15:25:46 591
CRYPTOPP-8-5-0.tar.gz
2024-05-25
aMule源代码,eMule Linux版源代码,amuled
2024-05-25
1119. Metro. dynamic programming, graph theory
2024-05-10
https://acm.timus.ru/print.aspx?space=1&num=1002 题目答案
2024-05-06
Assembly Language Step-By-Step - (Wiley, 2009, 0470497025).pdf
2024-04-21
libevent库, http-server静态文件服务器示例
2023-12-14
nasm-10.09.tar.gz
2023-11-21
windows, which命令找到.exe文件路径
2023-09-30
xxd用16进制打印文件内容,调试代码用
2023-08-23
windows Visual Studio dll动态库模板
2022-09-26
windows环境Visual studio创建静态库,项目框架
2022-09-26
PHP-TreeMap.zip
2021-08-13
DesignPatterns.zip
2020-06-22
composer.phar
2020-05-19
phalcon-stub-3.4.12.zip
2020-04-27
XhUser.vue
2020-01-15
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人