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
#题目是给一个方法 foo(),能以各 50%的概率随机返回 0 或者 1。 | |
#问题是基于 foo()方法,实现一个 boo()方法,该方法能以各 10%的概率返回[0-9]中的一个数字。 | |
for i in range(10): | |
print("{:0>32b}".format(i), i) | |
import random | |
def foo(): | |
return random.randint(0,1) | |
# 0000 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
{ | |
"php.executablePath": "D:\\xampp\\php\\php.exe", | |
"search.exclude": { | |
"!/system/*/.ps*": true, | |
"system/": true | |
}, | |
"sync.gist": "48d0310bb13166211cb6e15e0b4bc2ab", | |
"sync.autoUpload": true, | |
"terminal.integrated.shell.windows": "C:\\WINDOWS\\System32\\cmd.exe", | |
"tabnine.experimentalAutoImports": true, |
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
set @uid=12345; | |
SET @tb=CONCAT('table_', lpad(mod(@uid, 64),2,0)); | |
SET @sql = CONCAT('SELECT *,FROM_UNIXTIME(usedtime) FROM ',@tb,' where uid=', @uid); | |
PREPARE st FROM @sql; | |
EXECUTE st; | |
DEALLOCATE PREPARE st; |
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
$redis['redis'] = array( | |
'host' => '192.168.41.33', | |
'auth' => '8GLjx3tdi', | |
'port' => 6379, | |
'db' => 2 | |
); | |
redisConn($redis['redis']); | |
function redisConn($c) | |
{ | |
$redis = new Redis(); |
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 | |
$files = showDir("."); | |
foreach ($files as $key => $value) { | |
file_put_contents('funcs.txt', $value.PHP_EOL, FILE_APPEND); | |
$funcs = getFunc($value); | |
foreach ($funcs as $k2 => $v2) { | |
file_put_contents('funcs.txt', $v2.PHP_EOL, FILE_APPEND); | |
} | |
file_put_contents('funcs.txt', PHP_EOL, FILE_APPEND); | |
} |
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
@echo off | |
:start | |
::启动过程,切换目录 | |
set pwd=%cd% | |
cd %1 | |
echo 工作目录是:& chdir | |
:input | |
::获取输入,根据输入进行处理 |
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 main | |
import ( | |
"bufio" | |
"bytes" | |
"fmt" | |
"os" | |
"runtime" | |
//"runtime/pprof" | |
"flag" |
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
func receiveMsg(conn *net.TCPConn) { | |
var data bytes.Buffer | |
var buffer []byte | |
buffer = make([]byte, 500) | |
for { | |
readLen, err := conn.Read(buffer) | |
if err != nil { | |
if err == io.EOF { | |
fmt.Println("io.EOF error:", err) |
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
#coding=utf-8 | |
''' | |
* 去除指定类型文件的bom头 | |
* 版权所有 | |
* @author t6760915<t6760915@gmail.com> | |
* @version $Id: trim_bom.py $ | |
* 原版 https://gist.github.com/yhben/5169561 | |
* 原版不能检测所有的UTF-8 + bom的文件 | |
''' |
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
#!/usr/bin/env python | |
import sys | |
import paramiko | |
alpha = { | |
'hostname' : '192.168.9.1', | |
'username' : 'root', | |
'password' : 'xxxxxx', | |
'port' : 22, |
NewerOlder