Skip to content

Instantly share code, notes, and snippets.

View joux3's full-sized avatar

Antti Risteli joux3

  • Helsinki, Finland
View GitHub Profile
@joux3
joux3 / pg-promise-bug.js
Created November 19, 2018 05:59
pg-promise statement timeout in tx
const pgp = require('pg-promise')({
connect: setStatementTimeoutOnFirstUse
})
function setStatementTimeoutOnFirstUse(client, dc, useCount) {
if (useCount > 0) {
return
}
client.query("SET statement_timeout = '500ms';")
}
327a328,335
> #### /vessels/<RegExp>/environment/inside/engineRoom/temperature
>
> **Units:** K (Kelvin)
>
> **Description:** Temperature
>
> ---
>
333a342,349
import scala.util.parsing.combinator._
object ParserTest extends RegexParsers {
def text = """\"[^"]*\" ?""".r ^^ {x => DBString(x)}
def double = """[0-9]*\.[0-9]*""".r ^^ {x => DBDouble(x.toDouble)}
def int = ("""[0-9]+""".r) ^^ {x => DBInt(x.toInt)}
def boolean = """(?i)(true|false)""".r ^^ {x => DBBoolean(x.toLowerCase.equals("true"))}
def dbvalue = text | double | int | boolean
def constant = dbvalue ^^ {x => VConstant(x)}
// game mechanics are exposed to the solver with this
public interface GameBridge {
public CellState getCell(int x, int y);
public int getBoardWidth();
public int getBoardHeight();
public int getMineCount();
// returns the number of near mines for a cell
public int getMineCountForCell(int x, int y);
//shows a mine to the user
# Authentication
def socks_authenticate
Socksify::debug_debug "Sending no authentication"
write "\005\001\000"
Socksify::debug_debug "Waiting for authentication reply"
auth_reply = recv(1)
if auth_reply[0] != 4 and auth_reply[0] != 5
raise SOCKSError.new("SOCKS version #{auth_reply[0]} not supported")
end
auth_reply = recv(1)