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
| pub mod cursor { | |
| use std::ops::Deref; | |
| pub struct Cursor<S> { | |
| src: S, | |
| cursor: Index, | |
| } | |
| enum Index { | |
| Asc(usize), | |
| Desc(usize), |
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
| Verifying my Blockstack ID is secured with the address 1FYD3TKnB9gFSpwtRLzmFgPYjRkvJteBfw https://explorer.blockstack.org/address/1FYD3TKnB9gFSpwtRLzmFgPYjRkvJteBfw |
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
| // OnceNoError is like sync.Once but retries until no error occured. | |
| type OnceNoError struct { | |
| mu sync.Mutex | |
| done uint32 | |
| } | |
| func (once *OnceNoError) Do(fn func() error) (err error) { | |
| if atomic.LoadUint32(&once.done) == 1 { | |
| return | |
| } |
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
| #/usr/bin/env python | |
| import sys | |
| [sys.stdout.write(line.decode('unicode_escape')) for line in sys.stdin] |
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
| #!/bin/sh | |
| if [ -z "$(which redis-cli)" ]; then | |
| apk add --no-cache redis | |
| fi | |
| MONITOR_URL=$1 | |
| EVENT_NAME=${EVENT_NAME:=status} | |
| REDIS_HOST=${REDIS_HOST:=localhost} | |
| EVENT_QUEUE=${EVENT_QUEUE:=monitoring:events} |
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
| var db = require('Sequelize')(); | |
| db.dialect.supports.schemas = true; | |
| var Q = db.dialect.QueryGenerator; | |
| module.exports = function (req, res, next) { | |
| var schema = req.schema; | |
| var quoteTable = (param, as) { | |
| if ('string' == param) { | |
| param = { tableName: param }; | |
| } | |
| param.schema = schema; |
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
| CREATE FUNCTION `ST_Distance_Sphere` (a POINT, b POINT) | |
| RETURNS float | |
| no sql deterministic | |
| BEGIN | |
| declare R INTEGER DEFAULT 6371000; | |
| declare `φ1` float; | |
| declare `φ2` float; | |
| declare `Δφ` float; | |
| declare `Δλ` float; |
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
| declare option output:method "json"; | |
| let $page := doc("https://en.wikipedia.org/wiki/Mobile_country_code") | |
| return | |
| <json type="array"> | |
| { | |
| for $h4 in $page//div[@id="bodyContent"]//h4 | |
| let $country-code := $h4/span[@id]/text()[last()] | |
| let $rows := head($h4/following::table)/tr[td] |
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
| UPDATE emails SET data = replace(data, "Α", "Α"); | |
| UPDATE emails SET data = replace(data, "Β", "Β"); | |
| UPDATE emails SET data = replace(data, "Γ", "Γ"); | |
| UPDATE emails SET data = replace(data, "Δ", "Δ"); | |
| UPDATE emails SET data = replace(data, "Ε", "Ε"); | |
| UPDATE emails SET data = replace(data, "Ζ", "Ζ"); | |
| UPDATE emails SET data = replace(data, "Η", "Η"); | |
| UPDATE emails SET data = replace(data, "Θ", "Θ"); | |
| UPDATE emails SET data = replace(data, "Ι", "Ι"); | |
| UPDATE emails SET data = replace(data, "Κ", "Κ"); |
NewerOlder