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
match query_parts[0].to_ascii_uppercase().as_str() { | |
"BAN" => { | |
trace!("BAN"); | |
ban(stream, query_parts).await | |
} | |
"UNBAN" => { | |
trace!("UNBAN"); | |
unban(stream, query_parts).await | |
} | |
"RELOAD" => { |
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
#!/bin/sh | |
set -e | |
if [ -f /usr/local/bin/mo.sh ]; then | |
echo "mo.sh already installed" | |
else | |
apt-get update | |
apt-get install -yqq --no-install-recommends ca-certificates curl | |
curl -sSL https://raw.githubusercontent.com/tests-always-included/mo/master/mo -o mo.sh | |
chmod a+x mo.sh |
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
#!/bin/bash | |
declare -r ES_BOLD=$(tput bold) | |
declare -r ES_NORM=$(tput sgr0) | |
declare -r DEFAULT_SCROLLBACK=9999 | |
declare -r MIL_TIME_NOW=$(date +'%Y-%m-%d-%H-%M-%S') | |
declare -r TARGET_PANE=$1 | |
declare -r SCROLLBACK_COUNT=$2 | |
function main { |
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
/** | |
* Logic is from: | |
* https://stackoverflow.com/questions/66797767/lsn-external-representation | |
* You may also look at: | |
* https://www.crunchydata.com/blog/postgres-wal-files-and-sequuence-numbers | |
*/ | |
function lsn2int (str) { | |
return parseInt( | |
str.split('/').map((n) => n.padStart(8, '0')).join(''), |
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
%r{ | |
\x1B(?:[@-Z\\-_]|\[[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
/** | |
* Runs funcs in serial, and returns each result | |
* | |
* @param {arr<Function(onFullFilled, onRejected)>} funcs - function to be executed | |
*/ | |
Promise.execSerial = function (funcs) { | |
return new Promise(async function (res, rej) { | |
const result = []; | |
for (let i = 0, len = funcs.length; i < len; ++i) { | |
try { |
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
{ | |
"Amsterdam (AMS)": "amsterdam-nl", | |
"Copenhagen (CPH)": "cph-copenhagen-dk", | |
"Dublin (DUB)": "dub-dublin-ie", | |
"Frankfurt (FRA)": "frankfurt-de", | |
"Frankfurt": "hhn-frankfurt-de", | |
"Helsinki (HEL)": "hel-helsinki-fi", | |
"London (LCY)": "london_city-uk", | |
"London (LON)": "lon-london-uk", | |
"London": "london-uk", |
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
<script> | |
import Controller from './game/Controller.svelte'; | |
function handleGlobal (ev) { | |
console.log('handleGlobal on App!'); | |
console.log(ev); | |
} | |
</script> | |
<h1>Hello!</h1> |
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
amounts = []; | |
thetable = document.getElementsByTagName('tbody').item(0) | |
for (item of thetable.getElementsByTagName('tr')) { | |
const mytd = item.getElementsByTagName('td').item(3); | |
const mysize = parseFloat(mytd.textContent.split(' ')[0]); | |
amounts.push(mysize); | |
} | |
amounts.reduce((accum, cur) => { return accum + cur; }, 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
'use strict'; | |
const quickSort = function (items, left, right) { | |
let index; | |
if (left === undefined) { | |
left = 0; | |
} | |
if (right === undefined) { | |
right = items.length - 1; | |
} |
NewerOlder