This file contains hidden or 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 | |
/** | |
* ShmCache: 基于 shmop 的多进程共享缓存库 | |
* 支持 key-value 存储,兼容 PHP 原生数据结构,优化读写数据量,保持 ACID | |
* 需要启用 shmop 扩展 | |
*/ | |
class ShmCache { | |
private $shmId; | |
private $shmKey; | |
private $shmSize; |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or 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
{ | |
"nbformat": 4, | |
"nbformat_minor": 0, | |
"metadata": { | |
"colab": { | |
"provenance": [], | |
"collapsed_sections": [], | |
"machine_shape": "hm", | |
"authorship_tag": "ABX9TyMK+iTIWvrDxWHWBIXKg3Xw", | |
"include_colab_link": true |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or 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
function 获取网络资源(网址) { | |
return new Promise((解决, 拒绝)=> { | |
var 请求 = new XMLHttpRequest(); | |
请求.open('GET', 网址, true); | |
请求.onload = 括弧=> { | |
if (请求.status === 200) { | |
解决(请求.responseText); | |
} else { | |
拒绝(new Error(请求.statusText)); | |
} |
This file contains hidden or 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
function 获取网络资源(网址) { | |
return new Promise((解决, 拒绝)=> { | |
var 请求 = new XMLHttpRequest(); | |
请求.open('GET', 网址, true); | |
请求.onload = 括弧=> { | |
if (请求.status === 200) { | |
解决(请求.responseText); | |
} else { | |
拒绝(new Error(请求.statusText)); | |
} |
This file contains hidden or 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 flashtext | |
type bytetrie struct { | |
key byte | |
next [256]*bytetrie | |
word string | |
} | |
func NewByteTrie(b byte) *bytetrie { | |
return &bytetrie{ |
This file contains hidden or 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 ( | |
"bytes" | |
"encoding/binary" | |
"os" | |
"sync" | |
"fmt" | |
"math/rand" | |
"path/filepath" |
This file contains hidden or 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
this.class.classLoader.rootLoader.addURL(new URL("file:////Users/linkerlin/.m2/repository/mysql/mysql-connector-java/5.1.21/mysql-connector-java-5.1.21.jar")) | |
import groovy.sql.Sql | |
sql = Sql.newInstance("jdbc:mysql://localhost:3306/test", "root", "", "com.mysql.jdbc.Driver") | |
sql.eachRow("SELECT id, username FROM users") | |
{ | |
println "The employee's name is ${it.username}" | |
} | |
// Or using grape | |
@GrabConfig(systemClassLoader=true) // this is very important... |
This file contains hidden or 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
class Timer(object): | |
def __init__(self, name): | |
print("%s: " % name, end="") | |
def __enter__(self): | |
self.t0 = time.time() | |
def __exit__(self, *args): | |
print("%.3fs" % (time.time() - self.t0)) | |
with Timer("XXX"): | |
call_function() |
NewerOlder